mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
...
This commit is contained in:
@@ -152,7 +152,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
||||
{
|
||||
XSetRegion(xfc->display, xfc->gc, reg1);
|
||||
XFillRectangle(xfc->display, xfc->window->handle, xfc->gc, 0, 0,
|
||||
xfc->window->width, xfc->window->height);
|
||||
xfc->window->width, xfc->window->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
|
||||
@@ -162,9 +162,9 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
||||
picFormat = XRenderFindVisualFormat(xfc->display, xfc->visual);
|
||||
pa.subwindow_mode = IncludeInferiors;
|
||||
primaryPicture = XRenderCreatePicture(xfc->display, xfc->primary, picFormat,
|
||||
CPSubwindowMode, &pa);
|
||||
CPSubwindowMode, &pa);
|
||||
windowPicture = XRenderCreatePicture(xfc->display, xfc->window->handle,
|
||||
picFormat, CPSubwindowMode, &pa);
|
||||
picFormat, CPSubwindowMode, &pa);
|
||||
XRenderSetPictureFilter(xfc->display, primaryPicture, FilterBilinear, 0, 0);
|
||||
transform.matrix[0][0] = XDoubleToFixed(xScalingFactor);
|
||||
transform.matrix[0][1] = XDoubleToFixed(0.0);
|
||||
@@ -184,7 +184,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
||||
h = ceil(y2 / yScalingFactor) + 1 - y;
|
||||
XRenderSetPictureTransform(xfc->display, primaryPicture, &transform);
|
||||
XRenderComposite(xfc->display, PictOpSrc, primaryPicture, 0, windowPicture, x,
|
||||
y, 0, 0, xfc->offset_x + x, xfc->offset_y + y, w, h);
|
||||
y, 0, 0, xfc->offset_x + x, xfc->offset_y + y, w, h);
|
||||
XRenderFreePicture(xfc->display, primaryPicture);
|
||||
XRenderFreePicture(xfc->display, windowPicture);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ void xf_draw_screen(xfContext* xfc, int x, int y, int w, int h)
|
||||
|
||||
#endif
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->window->handle, xfc->gc, x, y, w, h,
|
||||
x, y);
|
||||
x, y);
|
||||
}
|
||||
|
||||
static BOOL xf_desktop_resize(rdpContext* context)
|
||||
@@ -235,8 +235,8 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
||||
XFreePixmap(xfc->display, xfc->primary);
|
||||
|
||||
if (!(xfc->primary = XCreatePixmap(
|
||||
xfc->display, xfc->drawable,
|
||||
xfc->sessionWidth, xfc->sessionHeight, xfc->depth)))
|
||||
xfc->display, xfc->drawable,
|
||||
xfc->sessionWidth, xfc->sessionHeight, xfc->depth)))
|
||||
return FALSE;
|
||||
|
||||
if (same)
|
||||
@@ -256,7 +256,7 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
||||
if (!xfc->fullscreen)
|
||||
{
|
||||
xf_ResizeDesktopWindow(xfc, xfc->window, settings->DesktopWidth,
|
||||
settings->DesktopHeight);
|
||||
settings->DesktopHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -275,7 +275,7 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, 0);
|
||||
XFillRectangle(xfc->display, xfc->drawable, xfc->gc, 0, 0, xfc->window->width,
|
||||
xfc->window->height);
|
||||
xfc->window->height);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -314,7 +314,7 @@ static BOOL xf_sw_end_paint(rdpContext* context)
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image,
|
||||
x, y, x, y, w, h);
|
||||
x, y, x, y, w, h);
|
||||
xf_draw_screen(xfc, x, y, w, h);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
@@ -332,7 +332,7 @@ static BOOL xf_sw_end_paint(rdpContext* context)
|
||||
w = cinvalid[i].w;
|
||||
h = cinvalid[i].h;
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc,
|
||||
xfc->image, x, y, x, y, w, h);
|
||||
xfc->image, x, y, x, y, w, h);
|
||||
xf_draw_screen(xfc, x, y, w, h);
|
||||
}
|
||||
|
||||
@@ -372,8 +372,8 @@ static BOOL xf_sw_desktop_resize(rdpContext* context)
|
||||
}
|
||||
|
||||
if (!(xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap,
|
||||
0,
|
||||
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0)))
|
||||
0,
|
||||
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0)))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
@@ -470,7 +470,7 @@ static BOOL xf_hw_desktop_resize(rdpContext* context)
|
||||
}
|
||||
|
||||
BOOL xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds,
|
||||
int* wcount)
|
||||
int* wcount)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) instance->context;
|
||||
rfds[*rcount] = (void*)(long)(xfc->xfds);
|
||||
@@ -546,15 +546,15 @@ BOOL xf_create_window(xfContext* xfc)
|
||||
else if (settings->ServerPort == 3389)
|
||||
{
|
||||
windowTitle = malloc(1 + sizeof("FreeRDP: ") + strlen(
|
||||
settings->ServerHostname));
|
||||
settings->ServerHostname));
|
||||
sprintf(windowTitle, "FreeRDP: %s", settings->ServerHostname);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowTitle = malloc(1 + sizeof("FreeRDP: ") + strlen(settings->ServerHostname)
|
||||
+ sizeof(":00000"));
|
||||
+ sizeof(":00000"));
|
||||
sprintf(windowTitle, "FreeRDP: %s:%i", settings->ServerHostname,
|
||||
settings->ServerPort);
|
||||
settings->ServerPort);
|
||||
}
|
||||
|
||||
#ifdef WITH_XRENDER
|
||||
@@ -599,7 +599,7 @@ BOOL xf_create_window(xfContext* xfc)
|
||||
|
||||
if (!xfc->primary)
|
||||
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->sessionWidth,
|
||||
xfc->sessionHeight, xfc->depth);
|
||||
xfc->sessionHeight, xfc->depth);
|
||||
|
||||
xfc->drawing = xfc->primary;
|
||||
|
||||
@@ -608,23 +608,23 @@ BOOL xf_create_window(xfContext* xfc)
|
||||
|
||||
if (!xfc->gc_mono)
|
||||
xfc->gc_mono = XCreateGC(xfc->display, xfc->bitmap_mono, GCGraphicsExposures,
|
||||
&gcv);
|
||||
&gcv);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, BlackPixelOfScreen(xfc->screen));
|
||||
XFillRectangle(xfc->display, xfc->primary, xfc->gc, 0, 0, xfc->sessionWidth,
|
||||
xfc->sessionHeight);
|
||||
xfc->sessionHeight);
|
||||
XFlush(xfc->display);
|
||||
|
||||
if (!xfc->image)
|
||||
{
|
||||
rdpGdi* gdi = xfc->context.gdi;
|
||||
xfc->image = XCreateImage(xfc->display, xfc->visual,
|
||||
xfc->depth,
|
||||
ZPixmap, 0, (char*) gdi->primary_buffer,
|
||||
xfc->sessionWidth, xfc->sessionHeight,
|
||||
xfc->scanline_pad, 0);
|
||||
xfc->depth,
|
||||
ZPixmap, 0, (char*) gdi->primary_buffer,
|
||||
xfc->sessionWidth, xfc->sessionHeight,
|
||||
xfc->scanline_pad, 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -726,7 +726,7 @@ void xf_toggle_control(xfContext* xfc)
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
UINT xf_encomsp_participant_created(EncomspClientContext* context,
|
||||
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
|
||||
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
@@ -815,14 +815,14 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
|
||||
template.screen = xfc->screen_number;
|
||||
|
||||
if (XGetWindowAttributes(xfc->display, RootWindowOfScreen(xfc->screen),
|
||||
&window_attributes) == 0)
|
||||
&window_attributes) == 0)
|
||||
{
|
||||
WLog_ERR(TAG, "XGetWindowAttributes failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
vis = XGetVisualInfo(xfc->display, VisualClassMask | VisualScreenMask,
|
||||
&template, &vi_count);
|
||||
&template, &vi_count);
|
||||
|
||||
if (!vis)
|
||||
{
|
||||
@@ -857,9 +857,9 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
|
||||
/* calculate color shifts required for rdp order color conversion */
|
||||
xf_calculate_color_shifts(vi->red_mask, &xfc->red_shift_r, &xfc->red_shift_l);
|
||||
xf_calculate_color_shifts(vi->green_mask, &xfc->green_shift_r,
|
||||
&xfc->green_shift_l);
|
||||
&xfc->green_shift_l);
|
||||
xf_calculate_color_shifts(vi->blue_mask, &xfc->blue_shift_r,
|
||||
&xfc->blue_shift_l);
|
||||
&xfc->blue_shift_l);
|
||||
}
|
||||
|
||||
XFree(vis);
|
||||
@@ -898,7 +898,7 @@ int _xf_error_handler(Display* d, XErrorEvent* ev)
|
||||
}
|
||||
|
||||
static BOOL xf_play_sound(rdpContext* context,
|
||||
const PLAY_SOUND_UPDATE* play_sound)
|
||||
const PLAY_SOUND_UPDATE* play_sound)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
XkbBell(xfc->display, None, 100, 0);
|
||||
@@ -913,7 +913,7 @@ void xf_check_extensions(xfContext* context)
|
||||
|
||||
if (XkbLibraryVersion(&xkb_major, &xkb_minor)
|
||||
&& XkbQueryExtension(context->display, &xkb_opcode, &xkb_event,
|
||||
&xkb_error, &xkb_major, &xkb_minor))
|
||||
&xkb_error, &xkb_major, &xkb_minor))
|
||||
{
|
||||
context->xkbAvailable = TRUE;
|
||||
}
|
||||
@@ -924,7 +924,7 @@ void xf_check_extensions(xfContext* context)
|
||||
int xrender_error_base;
|
||||
|
||||
if (XRenderQueryExtension(context->display, &xrender_event_base,
|
||||
&xrender_error_base))
|
||||
&xrender_error_base))
|
||||
{
|
||||
context->xrenderAvailable = TRUE;
|
||||
}
|
||||
@@ -1068,7 +1068,7 @@ static void xf_button_map_init(xfContext* xfc)
|
||||
else
|
||||
{
|
||||
WLog_ERR(TAG, "Mouse physical button %d is mapped to logical button %d",
|
||||
physical, logical);
|
||||
physical, logical);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1127,9 +1127,9 @@ BOOL xf_pre_connect(freerdp* instance)
|
||||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||
PubSub_SubscribeChannelConnected(instance->context->pubSub,
|
||||
(pChannelConnectedEventHandler) xf_OnChannelConnectedEventHandler);
|
||||
(pChannelConnectedEventHandler) xf_OnChannelConnectedEventHandler);
|
||||
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
|
||||
(pChannelDisconnectedEventHandler) xf_OnChannelDisconnectedEventHandler);
|
||||
(pChannelDisconnectedEventHandler) xf_OnChannelDisconnectedEventHandler);
|
||||
|
||||
if (!freerdp_client_load_addins(channels, instance->settings))
|
||||
return FALSE;
|
||||
@@ -1210,7 +1210,6 @@ BOOL xf_pre_connect(freerdp* instance)
|
||||
*/
|
||||
BOOL xf_post_connect(freerdp* instance)
|
||||
{
|
||||
rdpCache* cache;
|
||||
rdpUpdate* update;
|
||||
rdpContext* context;
|
||||
rdpChannels* channels;
|
||||
@@ -1218,7 +1217,6 @@ BOOL xf_post_connect(freerdp* instance)
|
||||
ResizeWindowEventArgs e;
|
||||
xfContext* xfc = (xfContext*) instance->context;
|
||||
context = instance->context;
|
||||
cache = context->cache;
|
||||
channels = context->channels;
|
||||
settings = instance->settings;
|
||||
update = context->update;
|
||||
@@ -1533,7 +1531,7 @@ void* xf_client_thread(void* param)
|
||||
else
|
||||
{
|
||||
if (!(inputEvent = freerdp_get_message_queue_event_handle(instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE)))
|
||||
FREERDP_INPUT_MESSAGE_QUEUE)))
|
||||
{
|
||||
WLog_ERR(TAG, "async input: failed to get input event handle");
|
||||
exit_code = XF_EXIT_UNKNOWN;
|
||||
@@ -1541,7 +1539,7 @@ void* xf_client_thread(void* param)
|
||||
}
|
||||
|
||||
if (!(inputThread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) xf_input_thread, instance, 0, NULL)))
|
||||
(LPTHREAD_START_ROUTINE) xf_input_thread, instance, 0, NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "async input: failed to create input thread");
|
||||
exit_code = XF_EXIT_UNKNOWN;
|
||||
@@ -1605,7 +1603,7 @@ void* xf_client_thread(void* param)
|
||||
if (WaitForSingleObject(inputEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
if (!freerdp_message_queue_process_pending_messages(instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE))
|
||||
FREERDP_INPUT_MESSAGE_QUEUE))
|
||||
{
|
||||
WLog_INFO(TAG, "User Disconnect");
|
||||
xfc->disconnect = TRUE;
|
||||
@@ -1618,7 +1616,7 @@ void* xf_client_thread(void* param)
|
||||
if (settings->AsyncInput)
|
||||
{
|
||||
wMessageQueue* inputQueue = freerdp_get_message_queue(instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
|
||||
if (MessageQueue_PostQuit(inputQueue, 0))
|
||||
WaitForSingleObject(inputThread, INFINITE);
|
||||
@@ -1638,17 +1636,17 @@ disconnect:
|
||||
DWORD xf_exit_code_from_disconnect_reason(DWORD reason)
|
||||
{
|
||||
if (reason == 0 || (reason >= XF_EXIT_PARSE_ARGUMENTS
|
||||
&& reason <= XF_EXIT_AUTH_FAILURE))
|
||||
&& reason <= XF_EXIT_AUTH_FAILURE))
|
||||
return reason;
|
||||
/* License error set */
|
||||
else if (reason >= 0x100 && reason <= 0x10A)
|
||||
reason -= 0x100 + XF_EXIT_LICENSE_INTERNAL;
|
||||
reason -= 0x100 + XF_EXIT_LICENSE_INTERNAL;
|
||||
/* RDP protocol error set */
|
||||
else if (reason >= 0x10c9 && reason <= 0x1193)
|
||||
reason = XF_EXIT_RDP;
|
||||
reason = XF_EXIT_RDP;
|
||||
/* There's no need to test protocol-independent codes: they match */
|
||||
else if (!(reason <= 0xC))
|
||||
reason = XF_EXIT_UNKNOWN;
|
||||
reason = XF_EXIT_UNKNOWN;
|
||||
|
||||
return reason;
|
||||
}
|
||||
@@ -1661,7 +1659,7 @@ void xf_TerminateEventHandler(rdpContext* context, TerminateEventArgs* e)
|
||||
if (context->settings->AsyncInput)
|
||||
{
|
||||
queue = freerdp_get_message_queue(context->instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
|
||||
if (queue)
|
||||
MessageQueue_PostQuit(queue, 0);
|
||||
@@ -1674,7 +1672,7 @@ void xf_TerminateEventHandler(rdpContext* context, TerminateEventArgs* e)
|
||||
|
||||
#ifdef WITH_XRENDER
|
||||
static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
||||
ZoomingChangeEventArgs* e)
|
||||
ZoomingChangeEventArgs* e)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
int w = xfc->scaledWidth + e->dx;
|
||||
@@ -1698,7 +1696,7 @@ static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
||||
}
|
||||
|
||||
static void xf_PanningChangeEventHandler(rdpContext* context,
|
||||
PanningChangeEventArgs* e)
|
||||
PanningChangeEventArgs* e)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
@@ -1737,15 +1735,15 @@ static int xfreerdp_client_start(rdpContext* context)
|
||||
if (!settings->ServerHostname)
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"error: server hostname was not specified with /v:<server>[:port]");
|
||||
"error: server hostname was not specified with /v:<server>[:port]");
|
||||
return -1;
|
||||
}
|
||||
|
||||
xfc->disconnect = FALSE;
|
||||
|
||||
if (!(xfc->thread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) xf_client_thread,
|
||||
context->instance, 0, NULL)))
|
||||
(LPTHREAD_START_ROUTINE) xf_client_thread,
|
||||
context->instance, 0, NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "failed to create client thread");
|
||||
return -1;
|
||||
@@ -1762,7 +1760,7 @@ static int xfreerdp_client_stop(rdpContext* context)
|
||||
{
|
||||
wMessageQueue* queue;
|
||||
queue = freerdp_get_message_queue(context->instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
|
||||
if (queue)
|
||||
MessageQueue_PostQuit(queue, 0);
|
||||
@@ -1807,12 +1805,12 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
||||
settings = instance->settings;
|
||||
xfc->settings = instance->context->settings;
|
||||
PubSub_SubscribeTerminate(context->pubSub,
|
||||
(pTerminateEventHandler) xf_TerminateEventHandler);
|
||||
(pTerminateEventHandler) xf_TerminateEventHandler);
|
||||
#ifdef WITH_XRENDER
|
||||
PubSub_SubscribeZoomingChange(context->pubSub,
|
||||
(pZoomingChangeEventHandler) xf_ZoomingChangeEventHandler);
|
||||
(pZoomingChangeEventHandler) xf_ZoomingChangeEventHandler);
|
||||
PubSub_SubscribePanningChange(context->pubSub,
|
||||
(pPanningChangeEventHandler) xf_PanningChangeEventHandler);
|
||||
(pPanningChangeEventHandler) xf_PanningChangeEventHandler);
|
||||
#endif
|
||||
xfc->UseXThreads = TRUE;
|
||||
//xfc->debug = TRUE;
|
||||
@@ -1832,7 +1830,7 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
||||
{
|
||||
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
|
||||
WLog_ERR(TAG,
|
||||
"Please check that the $DISPLAY environment variable is properly set.");
|
||||
"Please check that the $DISPLAY environment variable is properly set.");
|
||||
goto fail_open_display;
|
||||
}
|
||||
|
||||
@@ -1847,39 +1845,39 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
||||
xfc->_NET_WM_ICON = XInternAtom(xfc->display, "_NET_WM_ICON", False);
|
||||
xfc->_MOTIF_WM_HINTS = XInternAtom(xfc->display, "_MOTIF_WM_HINTS", False);
|
||||
xfc->_NET_CURRENT_DESKTOP = XInternAtom(xfc->display, "_NET_CURRENT_DESKTOP",
|
||||
False);
|
||||
False);
|
||||
xfc->_NET_WORKAREA = XInternAtom(xfc->display, "_NET_WORKAREA", False);
|
||||
xfc->_NET_WM_STATE = XInternAtom(xfc->display, "_NET_WM_STATE", False);
|
||||
xfc->_NET_WM_STATE_FULLSCREEN = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_FULLSCREEN", False);
|
||||
"_NET_WM_STATE_FULLSCREEN", False);
|
||||
xfc->_NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
"_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
xfc->_NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
"_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
xfc->_NET_WM_FULLSCREEN_MONITORS = XInternAtom(xfc->display,
|
||||
"_NET_WM_FULLSCREEN_MONITORS", False);
|
||||
"_NET_WM_FULLSCREEN_MONITORS", False);
|
||||
xfc->_NET_WM_NAME = XInternAtom(xfc->display, "_NET_WM_NAME", False);
|
||||
xfc->_NET_WM_PID = XInternAtom(xfc->display, "_NET_WM_PID", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE = XInternAtom(xfc->display, "_NET_WM_WINDOW_TYPE",
|
||||
False);
|
||||
False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_NORMAL = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_NORMAL", False);
|
||||
"_NET_WM_WINDOW_TYPE_NORMAL", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_DIALOG = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
"_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_POPUP = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_POPUP", False);
|
||||
"_NET_WM_WINDOW_TYPE_POPUP", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_UTILITY = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_UTILITY", False);
|
||||
"_NET_WM_WINDOW_TYPE_UTILITY", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", False);
|
||||
"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", False);
|
||||
xfc->_NET_WM_STATE_SKIP_TASKBAR = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_SKIP_TASKBAR", False);
|
||||
"_NET_WM_STATE_SKIP_TASKBAR", False);
|
||||
xfc->_NET_WM_STATE_SKIP_PAGER = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_SKIP_PAGER", False);
|
||||
"_NET_WM_STATE_SKIP_PAGER", False);
|
||||
xfc->_NET_WM_MOVERESIZE = XInternAtom(xfc->display, "_NET_WM_MOVERESIZE",
|
||||
False);
|
||||
False);
|
||||
xfc->_NET_MOVERESIZE_WINDOW = XInternAtom(xfc->display,
|
||||
"_NET_MOVERESIZE_WINDOW", False);
|
||||
"_NET_MOVERESIZE_WINDOW", False);
|
||||
xfc->UTF8_STRING = XInternAtom(xfc->display, "UTF8_STRING", FALSE);
|
||||
xfc->WM_PROTOCOLS = XInternAtom(xfc->display, "WM_PROTOCOLS", False);
|
||||
xfc->WM_DELETE_WINDOW = XInternAtom(xfc->display, "WM_DELETE_WINDOW", False);
|
||||
@@ -1892,7 +1890,7 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
||||
xfc->invert = (ImageByteOrder(xfc->display) == MSBFirst) ? TRUE : FALSE;
|
||||
xfc->complex_regions = TRUE;
|
||||
xfc->x11event = CreateFileDescriptorEvent(NULL, FALSE, FALSE, xfc->xfds,
|
||||
WINPR_FD_READ);
|
||||
WINPR_FD_READ);
|
||||
|
||||
if (!xfc->x11event)
|
||||
{
|
||||
|
||||
@@ -263,7 +263,7 @@ static const char* GetColorFormatName(UINT32 format)
|
||||
}
|
||||
|
||||
static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
|
||||
BYTE* _b, BYTE* _a, const UINT32* palette)
|
||||
BYTE* _b, BYTE* _a, const UINT32* palette)
|
||||
{
|
||||
UINT32 tmp;
|
||||
|
||||
@@ -519,11 +519,21 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
|
||||
SplitColor(tmp, PIXEL_FORMAT_ARGB32, _r, _g, _b, _a, NULL);
|
||||
break;
|
||||
|
||||
/* 1bpp formats */
|
||||
case PIXEL_FORMAT_MONO:
|
||||
if (_r)
|
||||
*_r = (color) ? 0xFF : 0x00;
|
||||
if (_g)
|
||||
*_g = (color) ? 0xFF : 0x00;
|
||||
if (_b)
|
||||
*_b = (color) ? 0xFF : 0x00;
|
||||
if (_a)
|
||||
*_a = (color) ? 0xFF : 0x00;
|
||||
break;
|
||||
/* 4 bpp formats */
|
||||
case PIXEL_FORMAT_A4:
|
||||
|
||||
/* 1bpp formats */
|
||||
case PIXEL_FORMAT_MONO:
|
||||
|
||||
default:
|
||||
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
|
||||
break;
|
||||
@@ -574,28 +584,28 @@ static INLINE UINT32 GetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
|
||||
/* 16bpp formats */
|
||||
case PIXEL_FORMAT_RGB16:
|
||||
return (((_r >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
|
||||
_b >> 3) & 0x1F);
|
||||
_b >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_BGR16:
|
||||
return (((_b >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
|
||||
_r >> 3) & 0x1F);
|
||||
_r >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_ARGB15:
|
||||
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_b >> 3) & 0x1F);
|
||||
_b >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_ABGR15:
|
||||
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_r >> 3) & 0x1F);
|
||||
_r >> 3) & 0x1F);
|
||||
|
||||
/* 15bpp formats */
|
||||
case PIXEL_FORMAT_RGB15:
|
||||
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_b >> 3) & 0x1F);
|
||||
_b >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_BGR15:
|
||||
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_r >> 3) & 0x1F);;
|
||||
_r >> 3) & 0x1F);;
|
||||
|
||||
/* 8bpp formats */
|
||||
case PIXEL_FORMAT_RGB8:
|
||||
@@ -634,7 +644,7 @@ static INLINE UINT32 ReadColor(const BYTE* src, UINT32 format)
|
||||
{
|
||||
case 32:
|
||||
color = ((UINT32)src[0] << 24) | ((UINT32)src[1] << 16) |
|
||||
((UINT32)src[2] << 8) | src[3];
|
||||
((UINT32)src[2] << 8) | src[3];
|
||||
break;
|
||||
|
||||
case 24:
|
||||
@@ -647,6 +657,8 @@ static INLINE UINT32 ReadColor(const BYTE* src, UINT32 format)
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case 4:
|
||||
case 1:
|
||||
color = *src;
|
||||
break;
|
||||
|
||||
@@ -683,6 +695,8 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case 4:
|
||||
case 1:
|
||||
dst[0] = color;
|
||||
break;
|
||||
|
||||
@@ -695,7 +709,7 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
|
||||
}
|
||||
|
||||
static INLINE UINT32 ConvertColor(UINT32 color, UINT32 srcFormat,
|
||||
UINT32 dstFormat, const UINT32* palette)
|
||||
UINT32 dstFormat, const UINT32* palette)
|
||||
{
|
||||
BYTE r = 0;
|
||||
BYTE g = 0;
|
||||
@@ -711,15 +725,15 @@ static INLINE UINT32 GetBytesPerPixel(UINT32 format)
|
||||
}
|
||||
|
||||
FREERDP_API BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height,
|
||||
const BYTE* data);
|
||||
const BYTE* data);
|
||||
|
||||
FREERDP_API int freerdp_image_copy_from_monochrome(BYTE* pDstData,
|
||||
UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor,
|
||||
const UINT32* palette);
|
||||
FREERDP_API BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData,
|
||||
UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor,
|
||||
const UINT32* palette);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
|
||||
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
|
||||
@@ -729,15 +743,15 @@ FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
|
||||
UINT32 xorBpp, const UINT32* palette);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat,
|
||||
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const UINT32* palette);
|
||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat,
|
||||
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const UINT32* palette);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color);
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -167,39 +167,37 @@ struct _RFX_CONTEXT
|
||||
};
|
||||
|
||||
FREERDP_API void rfx_context_set_pixel_format(RFX_CONTEXT* context,
|
||||
UINT32 pixel_format);
|
||||
UINT32 pixel_format);
|
||||
|
||||
FREERDP_API int rfx_rlgr_decode(const BYTE* pSrcData, UINT32 SrcSize,
|
||||
INT16* pDstData, UINT32 DstSize, int mode);
|
||||
INT16* pDstData, UINT32 DstSize, int mode);
|
||||
|
||||
FREERDP_API BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
UINT32 format, UINT32 length,
|
||||
UINT32 left, UINT32 top,
|
||||
BYTE* dst, UINT32 dstFormat,
|
||||
UINT32 dstStride, UINT32 dstHeight,
|
||||
REGION16* invalidRegion);
|
||||
UINT32 format, UINT32 length,
|
||||
UINT32 left, UINT32 top,
|
||||
BYTE* dst, UINT32 dstFormat,
|
||||
UINT32 dstStride, UINT32 dstHeight,
|
||||
REGION16* invalidRegion);
|
||||
FREERDP_API UINT16 rfx_message_get_tile_count(RFX_MESSAGE* message);
|
||||
FREERDP_API RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, int index);
|
||||
FREERDP_API UINT16 rfx_message_get_rect_count(RFX_MESSAGE* message);
|
||||
FREERDP_API RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, int index);
|
||||
FREERDP_API void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message);
|
||||
|
||||
FREERDP_API BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s,
|
||||
const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height,
|
||||
int rowstride);
|
||||
const RFX_RECT* rects, int num_rects, BYTE* image_data, int width, int height,
|
||||
int rowstride);
|
||||
|
||||
FREERDP_API RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context,
|
||||
const RFX_RECT* rects,
|
||||
int numRects, BYTE* data, int width, int height, int scanline);
|
||||
const RFX_RECT* rects,
|
||||
int numRects, BYTE* data, int width, int height, int scanline);
|
||||
FREERDP_API RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context,
|
||||
const RFX_RECT* rects, int numRects,
|
||||
BYTE* data, int width, int height, int scanline, int* numMessages,
|
||||
int maxDataSize);
|
||||
const RFX_RECT* rects, int numRects,
|
||||
BYTE* data, int width, int height, int scanline, int* numMessages,
|
||||
int maxDataSize);
|
||||
FREERDP_API BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message);
|
||||
RFX_MESSAGE* message);
|
||||
|
||||
FREERDP_API BOOL rfx_context_reset(RFX_CONTEXT* context, UINT32 width,
|
||||
UINT32 height);
|
||||
UINT32 height);
|
||||
|
||||
FREERDP_API RFX_CONTEXT* rfx_context_new(BOOL encoder);
|
||||
FREERDP_API void rfx_context_free(RFX_CONTEXT* context);
|
||||
|
||||
@@ -291,6 +291,7 @@ struct rdp_gdi
|
||||
gdiBitmap* primary;
|
||||
gdiBitmap* drawing;
|
||||
UINT32 bitmap_size;
|
||||
UINT32 bitmap_stride;
|
||||
BYTE* bitmap_buffer;
|
||||
BYTE* primary_buffer;
|
||||
UINT32 textColor;
|
||||
@@ -315,12 +316,12 @@ FREERDP_API BYTE* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y);
|
||||
FREERDP_API BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y);
|
||||
FREERDP_API BOOL gdi_resize(rdpGdi* gdi, UINT32 width, UINT32 height);
|
||||
FREERDP_API BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height,
|
||||
INT32 stride, INT32 format, BYTE* buffer,
|
||||
void (*pfree)(void*));
|
||||
INT32 stride, INT32 format, BYTE* buffer,
|
||||
void (*pfree)(void*));
|
||||
FREERDP_API BOOL gdi_init(freerdp* instance, UINT32 format);
|
||||
FREERDP_API BOOL gdi_init_ex(freerdp* instance, UINT32 format,
|
||||
UINT32 stride, BYTE* buffer,
|
||||
void (*pfree)(void*));
|
||||
UINT32 stride, BYTE* buffer,
|
||||
void (*pfree)(void*));
|
||||
FREERDP_API void gdi_free(freerdp* instance);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -75,12 +75,12 @@ BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data)
|
||||
return dstData;
|
||||
}
|
||||
|
||||
int freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor,
|
||||
const UINT32* palette)
|
||||
BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor,
|
||||
const UINT32* palette)
|
||||
{
|
||||
UINT32 x, y;
|
||||
BOOL vFlip;
|
||||
@@ -88,32 +88,25 @@ int freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 dstFlip;
|
||||
UINT32 nDstPad;
|
||||
UINT32 monoStep;
|
||||
UINT32 monoBit;
|
||||
const BYTE* monoBits;
|
||||
UINT32 monoPixel;
|
||||
UINT32 dstBitsPerPixel;
|
||||
UINT32 dstBytesPerPixel;
|
||||
dstBitsPerPixel = GetBitsPerPixel(DstFormat);
|
||||
dstBytesPerPixel = GetBytesPerPixel(DstFormat);
|
||||
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
|
||||
|
||||
if (nDstStep < 0)
|
||||
if (nDstStep == 0)
|
||||
nDstStep = dstBytesPerPixel * nWidth;
|
||||
|
||||
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
|
||||
srcFlip = FREERDP_PIXEL_FLIP_NONE;
|
||||
vFlip = (srcFlip != dstFlip) ? TRUE : FALSE;
|
||||
backColor |= 0xFF000000;
|
||||
foreColor |= 0xFF000000;
|
||||
backColor = ConvertColor(backColor, PIXEL_FORMAT_ARGB32, DstFormat, palette);
|
||||
foreColor = ConvertColor(foreColor, PIXEL_FORMAT_ARGB32, DstFormat, palette);
|
||||
monoStep = (nWidth + 7) / 8;
|
||||
UINT32* pDstPixel;
|
||||
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* monoBits;
|
||||
BYTE* pDstLine = &pDstData[((nYDst + y) * nDstStep)];
|
||||
monoBit = 0x80;
|
||||
UINT32 monoBit = 0x80;
|
||||
|
||||
if (!vFlip)
|
||||
monoBits = &pSrcData[monoStep * y];
|
||||
@@ -123,7 +116,7 @@ int freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
|
||||
for (x = 0; x < nWidth; x++)
|
||||
{
|
||||
BYTE* pDstPixel = &pDstLine[((nXDst + x) * GetBytesPerPixel(DstFormat))];
|
||||
monoPixel = (*monoBits & monoBit) ? 1 : 0;
|
||||
BOOL monoPixel = (*monoBits & monoBit) ? TRUE : FALSE;
|
||||
|
||||
if (!(monoBit >>= 1))
|
||||
{
|
||||
@@ -136,8 +129,6 @@ int freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
|
||||
else
|
||||
WriteColor(pDstPixel, DstFormat, foreColor);
|
||||
}
|
||||
|
||||
pDstPixel = (UINT32*) & ((BYTE*) pDstPixel)[nDstPad];
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -229,7 +220,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
xorBit = andBit = 0x80;
|
||||
|
||||
if (!vFlip)
|
||||
@@ -272,7 +263,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
color = freerdp_image_inverted_pointer_color(x, y); /* inverted */
|
||||
|
||||
color = ConvertColor(color, PIXEL_FORMAT_ABGR32,
|
||||
DstFormat, NULL);
|
||||
DstFormat, NULL);
|
||||
WriteColor(pDstPixel, DstFormat, color);
|
||||
pDstPixel += GetBytesPerPixel(DstFormat);
|
||||
}
|
||||
@@ -288,7 +279,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
if (xorBpp == 8 && !palette)
|
||||
{
|
||||
WLog_ERR(TAG, "null palette in convertion from %d bpp to %d bpp",
|
||||
xorBpp, dstBitsPerPixel);
|
||||
xorBpp, dstBitsPerPixel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -304,7 +295,7 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
(nXDst * GetBytesPerPixel(DstFormat))];
|
||||
andBit = 0x80;
|
||||
|
||||
if (!vFlip)
|
||||
@@ -337,9 +328,9 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
else if (xorBpp == 16)
|
||||
{
|
||||
xorPixel = ConvertColor(*(UINT16*)xorBits,
|
||||
PIXEL_FORMAT_RGB16,
|
||||
PIXEL_FORMAT_ABGR32,
|
||||
NULL);
|
||||
PIXEL_FORMAT_RGB16,
|
||||
PIXEL_FORMAT_ARGB32,
|
||||
NULL);
|
||||
}
|
||||
else if (xorBpp == 8)
|
||||
{
|
||||
@@ -376,12 +367,12 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
else
|
||||
color = xorPixel;
|
||||
|
||||
color = ConvertColor(color, PIXEL_FORMAT_ABGR32, DstFormat, NULL);
|
||||
color = ConvertColor(color, PIXEL_FORMAT_ARGB32, DstFormat, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = ConvertColor(xorPixel, PIXEL_FORMAT_ABGR32,
|
||||
DstFormat, NULL);
|
||||
color = ConvertColor(xorPixel, PIXEL_FORMAT_ARGB32,
|
||||
DstFormat, NULL);
|
||||
}
|
||||
|
||||
WriteColor(pDstPixel, DstFormat, color);
|
||||
@@ -393,17 +384,17 @@ BOOL freerdp_image_copy_from_pointer_data(
|
||||
}
|
||||
|
||||
WLog_ERR(TAG, "failed to convert from %d bpp to %d bpp",
|
||||
xorBpp, dstBitsPerPixel);
|
||||
xorBpp, dstBitsPerPixel);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat,
|
||||
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const UINT32* palette)
|
||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat,
|
||||
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const UINT32* palette)
|
||||
{
|
||||
const UINT32 dstByte = GetBytesPerPixel(DstFormat);
|
||||
const UINT32 srcByte = GetBytesPerPixel(SrcFormat);
|
||||
@@ -473,7 +464,7 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
if (vSrcHFlip || vDstHFlip)
|
||||
{
|
||||
WLog_ERR(TAG, "Horizontal flipping not supported! %s %s",
|
||||
GetColorFormatName(SrcFormat), GetColorFormatName(DstFormat));
|
||||
GetColorFormatName(SrcFormat), GetColorFormatName(DstFormat));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -485,7 +476,7 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) * nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) * nDstStep * dstVMultiplier + dstVOffset];
|
||||
memcpy(&dstLine[xDstOffset], &srcLine[xSrcOffset], copyDstWidth);
|
||||
}
|
||||
@@ -497,14 +488,14 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
const BYTE* srcLine = &pSrcData[(y + nYSrc) * nSrcStep * srcVMultiplier +
|
||||
srcVOffset];
|
||||
srcVOffset];
|
||||
BYTE* dstLine = &pDstData[(y + nYDst) * nDstStep * dstVMultiplier + dstVOffset];
|
||||
|
||||
for (x = 0; x < nWidth; x++)
|
||||
{
|
||||
UINT32 dstColor;
|
||||
UINT32 color = ReadColor(&srcLine[(x + nXSrc) * srcByte],
|
||||
SrcFormat);
|
||||
SrcFormat);
|
||||
dstColor = ConvertColor(color, SrcFormat, DstFormat, palette);
|
||||
WriteColor(&dstLine[(x + nXDst) * dstByte], DstFormat, dstColor);
|
||||
}
|
||||
@@ -515,8 +506,8 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
}
|
||||
|
||||
BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color)
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color)
|
||||
{
|
||||
UINT32 x, y;
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@ INT32 interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||
scanline = nWidth * 3;
|
||||
BufferSize = scanline * nHeight;
|
||||
|
||||
SrcFormat = PIXEL_FORMAT_RGB24_VF;
|
||||
SrcFormat = PIXEL_FORMAT_BGR24_VF;
|
||||
|
||||
if (BufferSize > interleaved->TempSize)
|
||||
{
|
||||
|
||||
@@ -83,28 +83,28 @@ static void rfx_profiler_create(RFX_CONTEXT* context)
|
||||
{
|
||||
PROFILER_CREATE(context->priv->prof_rfx_decode_rgb, "rfx_decode_rgb");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_decode_component,
|
||||
"rfx_decode_component");
|
||||
"rfx_decode_component");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_rlgr_decode, "rfx_rlgr_decode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_differential_decode,
|
||||
"rfx_differential_decode");
|
||||
"rfx_differential_decode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_quantization_decode,
|
||||
"rfx_quantization_decode");
|
||||
"rfx_quantization_decode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_dwt_2d_decode, "rfx_dwt_2d_decode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_ycbcr_to_rgb, "prims->yCbCrToRGB");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_decode_format_rgb,
|
||||
"rfx_decode_format_rgb");
|
||||
"rfx_decode_format_rgb");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_encode_rgb, "rfx_encode_rgb");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_encode_component,
|
||||
"rfx_encode_component");
|
||||
"rfx_encode_component");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_rlgr_encode, "rfx_rlgr_encode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_differential_encode,
|
||||
"rfx_differential_encode");
|
||||
"rfx_differential_encode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_quantization_encode,
|
||||
"rfx_quantization_encode");
|
||||
"rfx_quantization_encode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_dwt_2d_encode, "rfx_dwt_2d_encode");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_rgb_to_ycbcr, "prims->RGBToYCbCr");
|
||||
PROFILER_CREATE(context->priv->prof_rfx_encode_format_rgb,
|
||||
"rfx_encode_format_rgb");
|
||||
"rfx_encode_format_rgb");
|
||||
}
|
||||
|
||||
static void rfx_profiler_free(RFX_CONTEXT* context)
|
||||
@@ -275,7 +275,7 @@ RFX_CONTEXT* rfx_context_new(BOOL encoder)
|
||||
verinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
|
||||
GetVersionExA(&verinfo);
|
||||
isVistaOrLater = ((verinfo.dwMajorVersion >= 6)
|
||||
&& (verinfo.dwMinorVersion >= 0)) ? TRUE : FALSE;
|
||||
&& (verinfo.dwMinorVersion >= 0)) ? TRUE : FALSE;
|
||||
priv->UseThreads = isVistaOrLater;
|
||||
}
|
||||
#else
|
||||
@@ -285,22 +285,22 @@ RFX_CONTEXT* rfx_context_new(BOOL encoder)
|
||||
priv->MinThreadCount = sysinfo.dwNumberOfProcessors;
|
||||
priv->MaxThreadCount = 0;
|
||||
status = RegOpenKeyExA(HKEY_LOCAL_MACHINE, RFX_KEY, 0,
|
||||
KEY_READ | KEY_WOW64_64KEY, &hKey);
|
||||
KEY_READ | KEY_WOW64_64KEY, &hKey);
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(dwValue);
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("UseThreads"), NULL, &dwType, (BYTE*) &dwValue,
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
priv->UseThreads = dwValue ? 1 : 0;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("MinThreadCount"), NULL, &dwType, (BYTE*) &dwValue,
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
priv->MinThreadCount = dwValue;
|
||||
|
||||
if (RegQueryValueEx(hKey, _T("MaxThreadCount"), NULL, &dwType, (BYTE*) &dwValue,
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
&dwSize) == ERROR_SUCCESS)
|
||||
priv->MaxThreadCount = dwValue;
|
||||
|
||||
RegCloseKey(hKey);
|
||||
@@ -378,7 +378,7 @@ void rfx_context_free(RFX_CONTEXT* context)
|
||||
free(priv->tileWorkParams);
|
||||
#ifdef WITH_PROFILER
|
||||
WLog_VRB(TAG,
|
||||
"WARNING: Profiling results probably unusable with multithreaded RemoteFX codec!");
|
||||
"WARNING: Profiling results probably unusable with multithreaded RemoteFX codec!");
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -387,6 +387,16 @@ void rfx_context_free(RFX_CONTEXT* context)
|
||||
free(context);
|
||||
}
|
||||
|
||||
static RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, UINT32 index)
|
||||
{
|
||||
return message->tiles[index];
|
||||
}
|
||||
|
||||
static RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, UINT32 index)
|
||||
{
|
||||
return &message->rects[index];
|
||||
}
|
||||
|
||||
void rfx_context_set_pixel_format(RFX_CONTEXT* context, UINT32 pixel_format)
|
||||
{
|
||||
context->pixel_format = pixel_format;
|
||||
@@ -426,7 +436,7 @@ static BOOL rfx_process_message_sync(RFX_CONTEXT* context, wStream* s)
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s,
|
||||
context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */
|
||||
context->version); /* version (2 bytes), WF_VERSION_1_0 (0x0100) */
|
||||
|
||||
if (context->version != WF_VERSION_1_0)
|
||||
{
|
||||
@@ -452,9 +462,9 @@ static BOOL rfx_process_message_codec_versions(RFX_CONTEXT* context, wStream* s)
|
||||
|
||||
Stream_Read_UINT8(s, numCodecs); /* numCodecs (1 byte), must be set to 0x01 */
|
||||
Stream_Read_UINT8(s,
|
||||
context->codec_id); /* codecId (1 byte), must be set to 0x01 */
|
||||
context->codec_id); /* codecId (1 byte), must be set to 0x01 */
|
||||
Stream_Read_UINT16(s,
|
||||
context->codec_version); /* version (2 bytes), must be set to WF_VERSION_1_0 (0x0100) */
|
||||
context->codec_version); /* version (2 bytes), must be set to WF_VERSION_1_0 (0x0100) */
|
||||
|
||||
if (numCodecs != 1)
|
||||
{
|
||||
@@ -471,12 +481,12 @@ static BOOL rfx_process_message_codec_versions(RFX_CONTEXT* context, wStream* s)
|
||||
if (context->codec_version != WF_VERSION_1_0)
|
||||
{
|
||||
WLog_ERR(TAG, "%s: invalid codec version (0x%04X)", __FUNCTION__,
|
||||
context->codec_version);
|
||||
context->codec_version);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG, "id %d version 0x%X.",
|
||||
context->codec_id, context->codec_version);
|
||||
context->codec_id, context->codec_version);
|
||||
context->decodedHeaderBlocks |= _RFX_DECODED_VERSIONS;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -494,7 +504,7 @@ static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
|
||||
}
|
||||
|
||||
Stream_Read_UINT8(s,
|
||||
numChannels); /* numChannels (1 byte), must bet set to 0x01 */
|
||||
numChannels); /* numChannels (1 byte), must bet set to 0x01 */
|
||||
|
||||
/* In RDVH sessions, numChannels will represent the number of virtual monitors
|
||||
* configured and does not always be set to 0x01 as [MS-RDPRFX] said.
|
||||
@@ -508,7 +518,7 @@ static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
|
||||
if (Stream_GetRemainingLength(s) < (size_t)(numChannels * 5))
|
||||
{
|
||||
WLog_ERR(TAG, "RfxMessageChannels packet too small for numChannels=%d",
|
||||
numChannels);
|
||||
numChannels);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -527,14 +537,14 @@ static BOOL rfx_process_message_channels(RFX_CONTEXT* context, wStream* s)
|
||||
if (!context->width || !context->height)
|
||||
{
|
||||
WLog_ERR(TAG, "%s: invalid channel with/height: %ux%u", __FUNCTION__,
|
||||
context->width, context->height);
|
||||
context->width, context->height);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Now, only the first monitor can be used, therefore the other channels will be ignored. */
|
||||
Stream_Seek(s, 5 * (numChannels - 1));
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG, "numChannels %d id %d, %dx%d.",
|
||||
numChannels, channelId, context->width, context->height);
|
||||
numChannels, channelId, context->width, context->height);
|
||||
context->decodedHeaderBlocks |= _RFX_DECODED_CHANNELS;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -554,11 +564,11 @@ static BOOL rfx_process_message_context(RFX_CONTEXT* context, wStream* s)
|
||||
|
||||
Stream_Read_UINT8(s, ctxId); /* ctxId (1 byte), must be set to 0x00 */
|
||||
Stream_Read_UINT16(s,
|
||||
tileSize); /* tileSize (2 bytes), must be set to CT_TILE_64x64 (0x0040) */
|
||||
tileSize); /* tileSize (2 bytes), must be set to CT_TILE_64x64 (0x0040) */
|
||||
Stream_Read_UINT16(s, properties); /* properties (2 bytes) */
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG,
|
||||
"ctxId %d tileSize %d properties 0x%X.",
|
||||
ctxId, tileSize, properties);
|
||||
"ctxId %d tileSize %d properties 0x%X.",
|
||||
ctxId, tileSize, properties);
|
||||
context->properties = properties;
|
||||
context->flags = (properties & 0x0007);
|
||||
|
||||
@@ -593,7 +603,7 @@ static BOOL rfx_process_message_context(RFX_CONTEXT* context, wStream* s)
|
||||
}
|
||||
|
||||
static BOOL rfx_process_message_frame_begin(RFX_CONTEXT* context,
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpectedBlockType)
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpectedBlockType)
|
||||
{
|
||||
UINT32 frameIdx;
|
||||
UINT16 numRegions;
|
||||
@@ -613,15 +623,15 @@ static BOOL rfx_process_message_frame_begin(RFX_CONTEXT* context,
|
||||
}
|
||||
|
||||
Stream_Read_UINT32(s,
|
||||
frameIdx); /* frameIdx (4 bytes), if codec is in video mode, must be ignored */
|
||||
frameIdx); /* frameIdx (4 bytes), if codec is in video mode, must be ignored */
|
||||
Stream_Read_UINT16(s, numRegions); /* numRegions (2 bytes) */
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG,
|
||||
"RFX_FRAME_BEGIN: frameIdx: %d numRegions: %d", frameIdx, numRegions);
|
||||
"RFX_FRAME_BEGIN: frameIdx: %d numRegions: %d", frameIdx, numRegions);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL rfx_process_message_frame_end(RFX_CONTEXT* context,
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpectedBlockType)
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpectedBlockType)
|
||||
{
|
||||
if (*pExpectedBlockType != WBT_FRAME_END)
|
||||
{
|
||||
@@ -635,7 +645,7 @@ static BOOL rfx_process_message_frame_end(RFX_CONTEXT* context,
|
||||
}
|
||||
|
||||
static BOOL rfx_process_message_region(RFX_CONTEXT* context,
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpectedBlockType)
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpectedBlockType)
|
||||
{
|
||||
int i;
|
||||
UINT16 regionType;
|
||||
@@ -680,7 +690,7 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context,
|
||||
if (Stream_GetRemainingLength(s) < (size_t)(8 * message->numRects))
|
||||
{
|
||||
WLog_ERR(TAG, "%s: packet too small for num_rects=%d", __FUNCTION__,
|
||||
message->numRects);
|
||||
message->numRects);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -690,14 +700,16 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context,
|
||||
/* rects */
|
||||
for (i = 0; i < message->numRects; i++)
|
||||
{
|
||||
RFX_RECT* rect = rfx_message_get_rect(message, i);
|
||||
|
||||
/* RFX_RECT */
|
||||
Stream_Read_UINT16(s, message->rects[i].x); /* x (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].y); /* y (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].width); /* width (2 bytes) */
|
||||
Stream_Read_UINT16(s, message->rects[i].height); /* height (2 bytes) */
|
||||
Stream_Read_UINT16(s, rect->x); /* x (2 bytes) */
|
||||
Stream_Read_UINT16(s, rect->y); /* y (2 bytes) */
|
||||
Stream_Read_UINT16(s, rect->width); /* width (2 bytes) */
|
||||
Stream_Read_UINT16(s, rect->height); /* height (2 bytes) */
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG, "rect %d (x,y=%d,%d w,h=%d %d).", i,
|
||||
message->rects[i].x, message->rects[i].y,
|
||||
message->rects[i].width, message->rects[i].height);
|
||||
rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
@@ -707,9 +719,9 @@ static BOOL rfx_process_message_region(RFX_CONTEXT* context,
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s,
|
||||
regionType); /* regionType (2 bytes): MUST be set to CBT_REGION (0xCAC1) */
|
||||
regionType); /* regionType (2 bytes): MUST be set to CBT_REGION (0xCAC1) */
|
||||
Stream_Read_UINT16(s,
|
||||
numTileSets); /* numTilesets (2 bytes): MUST be set to 0x0001. */
|
||||
numTileSets); /* numTilesets (2 bytes): MUST be set to 0x0001. */
|
||||
|
||||
if (regionType != CBT_REGION)
|
||||
{
|
||||
@@ -742,7 +754,7 @@ static void CALLBACK rfx_process_message_tile_work_callback(
|
||||
}
|
||||
|
||||
static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpecedBlockType)
|
||||
RFX_MESSAGE* message, wStream* s, UINT16* pExpecedBlockType)
|
||||
{
|
||||
BOOL rc;
|
||||
int i, close_cnt;
|
||||
@@ -773,7 +785,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s,
|
||||
subtype); /* subtype (2 bytes) must be set to CBT_TILESET (0xCAC2) */
|
||||
subtype); /* subtype (2 bytes) must be set to CBT_TILESET (0xCAC2) */
|
||||
|
||||
if (subtype != CBT_TILESET)
|
||||
{
|
||||
@@ -803,7 +815,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
Stream_Read_UINT32(s, tilesDataSize); /* tilesDataSize (4 bytes) */
|
||||
|
||||
if (!(pmem = realloc((void*) context->quants,
|
||||
context->numQuant * 10 * sizeof(UINT32))))
|
||||
context->numQuant * 10 * sizeof(UINT32))))
|
||||
return FALSE;
|
||||
|
||||
quants = context->quants = (UINT32*) pmem;
|
||||
@@ -812,7 +824,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
if (Stream_GetRemainingLength(s) < (size_t)(context->numQuant * 5))
|
||||
{
|
||||
WLog_ERR(TAG, "RfxMessageTileSet packet too small for num_quants=%d",
|
||||
context->numQuant);
|
||||
context->numQuant);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -835,16 +847,16 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
*quants++ = (quant & 0x0F);
|
||||
*quants++ = (quant >> 4);
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG,
|
||||
"quant %d (%d %d %d %d %d %d %d %d %d %d).",
|
||||
i, context->quants[i * 10], context->quants[i * 10 + 1],
|
||||
context->quants[i * 10 + 2], context->quants[i * 10 + 3],
|
||||
context->quants[i * 10 + 4], context->quants[i * 10 + 5],
|
||||
context->quants[i * 10 + 6], context->quants[i * 10 + 7],
|
||||
context->quants[i * 10 + 8], context->quants[i * 10 + 9]);
|
||||
"quant %d (%d %d %d %d %d %d %d %d %d %d).",
|
||||
i, context->quants[i * 10], context->quants[i * 10 + 1],
|
||||
context->quants[i * 10 + 2], context->quants[i * 10 + 3],
|
||||
context->quants[i * 10 + 4], context->quants[i * 10 + 5],
|
||||
context->quants[i * 10 + 6], context->quants[i * 10 + 7],
|
||||
context->quants[i * 10 + 8], context->quants[i * 10 + 9]);
|
||||
}
|
||||
|
||||
if (!(message->tiles = (RFX_TILE**) calloc(message->numTiles,
|
||||
sizeof(RFX_TILE*))))
|
||||
sizeof(RFX_TILE*))))
|
||||
{
|
||||
message->numTiles = 0;
|
||||
return FALSE;
|
||||
@@ -854,7 +866,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
{
|
||||
work_objects = (PTP_WORK*) calloc(message->numTiles, sizeof(PTP_WORK));
|
||||
params = (RFX_TILE_PROCESS_WORK_PARAM*) calloc(message->numTiles,
|
||||
sizeof(RFX_TILE_PROCESS_WORK_PARAM));
|
||||
sizeof(RFX_TILE_PROCESS_WORK_PARAM));
|
||||
|
||||
if (!work_objects)
|
||||
{
|
||||
@@ -888,20 +900,20 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
if (Stream_GetRemainingLength(s) < 6)
|
||||
{
|
||||
WLog_ERR(TAG, "RfxMessageTileSet packet too small to read tile %d/%d", i,
|
||||
message->numTiles);
|
||||
message->numTiles);
|
||||
rc = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
Stream_Read_UINT16(s,
|
||||
blockType); /* blockType (2 bytes), must be set to CBT_TILE (0xCAC3) */
|
||||
blockType); /* blockType (2 bytes), must be set to CBT_TILE (0xCAC3) */
|
||||
Stream_Read_UINT32(s, blockLen); /* blockLen (4 bytes) */
|
||||
|
||||
if (Stream_GetRemainingLength(s) < blockLen - 6)
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"RfxMessageTileSet not enough bytes to read tile %d/%d with blocklen=%d",
|
||||
i, message->numTiles, blockLen);
|
||||
"RfxMessageTileSet not enough bytes to read tile %d/%d with blocklen=%d",
|
||||
i, message->numTiles, blockLen);
|
||||
rc = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -911,7 +923,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
if (blockType != CBT_TILE)
|
||||
{
|
||||
WLog_ERR(TAG, "unknown block type 0x%X, expected CBT_TILE (0xCAC3).",
|
||||
blockType);
|
||||
blockType);
|
||||
rc = FALSE;
|
||||
break;
|
||||
}
|
||||
@@ -940,8 +952,8 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
params[i].tile = message->tiles[i];
|
||||
|
||||
if (!(work_objects[i] = CreateThreadpoolWork((PTP_WORK_CALLBACK)
|
||||
rfx_process_message_tile_work_callback,
|
||||
(void*) ¶ms[i], &context->priv->ThreadPoolEnv)))
|
||||
rfx_process_message_tile_work_callback,
|
||||
(void*) ¶ms[i], &context->priv->ThreadPoolEnv)))
|
||||
{
|
||||
WLog_ERR(TAG, "CreateThreadpoolWork failed.");
|
||||
rc = FALSE;
|
||||
@@ -984,13 +996,14 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context,
|
||||
}
|
||||
|
||||
BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
UINT32 format, UINT32 length,
|
||||
UINT32 left, UINT32 top,
|
||||
BYTE* dst, UINT32 dstFormat,
|
||||
UINT32 dstStride, UINT32 dstHeight,
|
||||
REGION16* invalidRegion)
|
||||
UINT32 format, UINT32 length,
|
||||
UINT32 left, UINT32 top,
|
||||
BYTE* dst, UINT32 dstFormat,
|
||||
UINT32 dstStride, UINT32 dstHeight,
|
||||
REGION16* invalidRegion)
|
||||
{
|
||||
int pos;
|
||||
REGION16 updateRegion;
|
||||
UINT32 blockLen;
|
||||
UINT32 blockType;
|
||||
RFX_MESSAGE* message = NULL;
|
||||
@@ -1015,7 +1028,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
Stream_Read_UINT16(s, blockType); /* blockType (2 bytes) */
|
||||
Stream_Read_UINT32(s, blockLen); /* blockLen (4 bytes) */
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG, "blockType 0x%X blockLen %d",
|
||||
blockType, blockLen);
|
||||
blockType, blockLen);
|
||||
|
||||
if (blockLen == 0)
|
||||
{
|
||||
@@ -1049,7 +1062,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
|
||||
Stream_Read_UINT8(s, codecId); /* codecId (1 byte) must be set to 0x01 */
|
||||
Stream_Read_UINT8(s,
|
||||
channelId); /* channelId (1 byte) 0xFF or 0x00, see below */
|
||||
channelId); /* channelId (1 byte) 0xFF or 0x00, see below */
|
||||
|
||||
if (codecId != 0x01)
|
||||
{
|
||||
@@ -1063,7 +1076,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
if (channelId != 0xFF)
|
||||
{
|
||||
WLog_ERR(TAG, "%s: invalid channelId 0x%02X for blockType 0x%04X", __FUNCTION__,
|
||||
channelId, blockType);
|
||||
channelId, blockType);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@@ -1073,7 +1086,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
if (channelId != 0x00)
|
||||
{
|
||||
WLog_ERR(TAG, "%s: invalid channelId 0x%02X for blockType WBT_CONTEXT",
|
||||
__FUNCTION__, channelId);
|
||||
__FUNCTION__, channelId);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
@@ -1110,7 +1123,7 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
|
||||
case WBT_FRAME_BEGIN:
|
||||
ok = rfx_process_message_frame_begin(context, message, s,
|
||||
&expectedDataBlockType);
|
||||
&expectedDataBlockType);
|
||||
break;
|
||||
|
||||
case WBT_REGION:
|
||||
@@ -1137,10 +1150,9 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
{
|
||||
UINT32 i, j;
|
||||
UINT32 nbUpdateRects;
|
||||
REGION16 updateRegion;
|
||||
REGION16 clippingRects;
|
||||
const RECTANGLE_16* updateRects;
|
||||
Stream_Free(s, FALSE);
|
||||
|
||||
region16_init(&clippingRects);
|
||||
|
||||
for (i = 0; i < message->numRects; i++)
|
||||
@@ -1157,7 +1169,8 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
for (i = 0; i < message->numTiles; i++)
|
||||
{
|
||||
RECTANGLE_16 updateRect;
|
||||
const RFX_TILE* tile = message->tiles[i];
|
||||
const RFX_TILE* tile = rfx_message_get_tile(message, i);
|
||||
|
||||
updateRect.left = left + tile->x;
|
||||
updateRect.top = top + tile->y;
|
||||
updateRect.right = updateRect.left + 64;
|
||||
@@ -1172,9 +1185,10 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
UINT32 nYDst = updateRects[j].top;
|
||||
UINT32 nWidth = updateRects[j].right - updateRects[j].left;
|
||||
UINT32 nHeight = updateRects[j].bottom - updateRects[j].top;
|
||||
freerdp_image_copy(dst, dstFormat, dstStride,
|
||||
nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, format, 64 * 4, 0, 0, NULL);
|
||||
if (!freerdp_image_copy(dst, dstFormat, dstStride,
|
||||
nXDst, nYDst, nWidth, nHeight,
|
||||
tile->data, format, 64 * GetBytesPerPixel(format), 0, 0, NULL))
|
||||
goto fail;
|
||||
|
||||
if (invalidRegion)
|
||||
region16_union_rect(invalidRegion, invalidRegion, &updateRects[j]);
|
||||
@@ -1184,11 +1198,13 @@ BOOL rfx_process_message(RFX_CONTEXT* context, const BYTE* data,
|
||||
}
|
||||
|
||||
region16_uninit(&clippingRects);
|
||||
Stream_Free(s, FALSE);
|
||||
rfx_message_free(context, message);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
fail:
|
||||
region16_uninit(&updateRegion);
|
||||
Stream_Free(s, FALSE);
|
||||
rfx_message_free(context, message);
|
||||
return FALSE;
|
||||
@@ -1199,21 +1215,11 @@ UINT16 rfx_message_get_tile_count(RFX_MESSAGE* message)
|
||||
return message->numTiles;
|
||||
}
|
||||
|
||||
RFX_TILE* rfx_message_get_tile(RFX_MESSAGE* message, int index)
|
||||
{
|
||||
return message->tiles[index];
|
||||
}
|
||||
|
||||
UINT16 rfx_message_get_rect_count(RFX_MESSAGE* message)
|
||||
{
|
||||
return message->numRects;
|
||||
}
|
||||
|
||||
RFX_RECT* rfx_message_get_rect(RFX_MESSAGE* message, int index)
|
||||
{
|
||||
return &message->rects[index];
|
||||
}
|
||||
|
||||
void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message)
|
||||
{
|
||||
int i;
|
||||
@@ -1259,7 +1265,7 @@ static void rfx_update_context_properties(RFX_CONTEXT* context)
|
||||
properties |= (COL_CONV_ICT << 4); /* cct */
|
||||
properties |= (CLW_XFORM_DWT_53_A << 6); /* xft */
|
||||
properties |= ((context->mode == RLGR1 ? CLW_ENTROPY_RLGR1 : CLW_ENTROPY_RLGR3)
|
||||
<< 10); /* et */
|
||||
<< 10); /* et */
|
||||
properties |= (SCALAR_QUANTIZATION << 14); /* qt */
|
||||
context->properties = properties;
|
||||
}
|
||||
@@ -1305,7 +1311,7 @@ static void rfx_write_message_context(RFX_CONTEXT* context, wStream* s)
|
||||
properties |= (COL_CONV_ICT << 3); /* cct */
|
||||
properties |= (CLW_XFORM_DWT_53_A << 5); /* xft */
|
||||
properties |= ((context->mode == RLGR1 ? CLW_ENTROPY_RLGR1 : CLW_ENTROPY_RLGR3)
|
||||
<< 9); /* et */
|
||||
<< 9); /* et */
|
||||
properties |= (SCALAR_QUANTIZATION << 13); /* qt */
|
||||
Stream_Write_UINT16(s, properties); /* properties (2 bytes) */
|
||||
rfx_update_context_properties(context);
|
||||
@@ -1359,7 +1365,7 @@ struct _RFX_TILE_COMPOSE_WORK_PARAM
|
||||
};
|
||||
|
||||
void CALLBACK rfx_compose_message_tile_work_callback(PTP_CALLBACK_INSTANCE
|
||||
instance, void* context, PTP_WORK work)
|
||||
instance, void* context, PTP_WORK work)
|
||||
{
|
||||
RFX_TILE_COMPOSE_WORK_PARAM* param = (RFX_TILE_COMPOSE_WORK_PARAM*) context;
|
||||
rfx_encode_rgb(param->context, param->tile);
|
||||
@@ -1367,7 +1373,7 @@ void CALLBACK rfx_compose_message_tile_work_callback(PTP_CALLBACK_INSTANCE
|
||||
|
||||
|
||||
static BOOL computeRegion(const RFX_RECT* rects, int numRects, REGION16* region,
|
||||
int width, int height)
|
||||
int width, int height)
|
||||
{
|
||||
int i;
|
||||
const RFX_RECT* rect = rects;
|
||||
@@ -1404,7 +1410,7 @@ BOOL setupWorkers(RFX_CONTEXT* context, int nbTiles)
|
||||
priv->workObjects = (PTP_WORK*) pmem;
|
||||
|
||||
if (!(pmem = realloc((void*) priv->tileWorkParams,
|
||||
sizeof(RFX_TILE_COMPOSE_WORK_PARAM) * nbTiles)))
|
||||
sizeof(RFX_TILE_COMPOSE_WORK_PARAM) * nbTiles)))
|
||||
return FALSE;
|
||||
|
||||
priv->tileWorkParams = (RFX_TILE_COMPOSE_WORK_PARAM*) pmem;
|
||||
@@ -1412,8 +1418,8 @@ BOOL setupWorkers(RFX_CONTEXT* context, int nbTiles)
|
||||
}
|
||||
|
||||
RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||
int numRects,
|
||||
BYTE* data, int width, int height, int scanline)
|
||||
int numRects,
|
||||
BYTE* data, int width, int height, int scanline)
|
||||
{
|
||||
UINT32 i, maxNbTiles, maxTilesX, maxTilesY;
|
||||
UINT32 xIdx, yIdx, regionNbRects;
|
||||
@@ -1449,11 +1455,11 @@ RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||
if (!context->numQuant)
|
||||
{
|
||||
if (!(context->quants = (UINT32*) malloc(sizeof(
|
||||
rfx_default_quantization_values))))
|
||||
rfx_default_quantization_values))))
|
||||
goto skip_encoding_loop;
|
||||
|
||||
CopyMemory(context->quants, &rfx_default_quantization_values,
|
||||
sizeof(rfx_default_quantization_values));
|
||||
sizeof(rfx_default_quantization_values));
|
||||
context->numQuant = 1;
|
||||
context->quantIdxY = 0;
|
||||
context->quantIdxCb = 0;
|
||||
@@ -1571,9 +1577,9 @@ RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||
workParam->tile = tile;
|
||||
|
||||
if (!(*workObject = CreateThreadpoolWork(
|
||||
(PTP_WORK_CALLBACK)rfx_compose_message_tile_work_callback,
|
||||
(void*) workParam,
|
||||
&context->priv->ThreadPoolEnv)))
|
||||
(PTP_WORK_CALLBACK)rfx_compose_message_tile_work_callback,
|
||||
(void*) workParam,
|
||||
&context->priv->ThreadPoolEnv)))
|
||||
{
|
||||
goto skip_encoding_loop;
|
||||
}
|
||||
@@ -1601,7 +1607,7 @@ skip_encoding_loop:
|
||||
if (message->numTiles > 0)
|
||||
{
|
||||
void* pmem = realloc((void*) message->tiles,
|
||||
sizeof(RFX_TILE*) * message->numTiles);
|
||||
sizeof(RFX_TILE*) * message->numTiles);
|
||||
|
||||
if (pmem)
|
||||
message->tiles = (RFX_TILE**) pmem;
|
||||
@@ -1650,7 +1656,7 @@ skip_encoding_loop:
|
||||
}
|
||||
|
||||
RFX_MESSAGE* rfx_split_message(RFX_CONTEXT* context, RFX_MESSAGE* message,
|
||||
int* numMessages, int maxDataSize)
|
||||
int* numMessages, int maxDataSize)
|
||||
{
|
||||
int i, j;
|
||||
UINT32 tileDataSize;
|
||||
@@ -1681,7 +1687,7 @@ RFX_MESSAGE* rfx_split_message(RFX_CONTEXT* context, RFX_MESSAGE* message,
|
||||
messages[j].freeArray = TRUE;
|
||||
|
||||
if (!(messages[j].tiles = (RFX_TILE**) calloc(message->numTiles,
|
||||
sizeof(RFX_TILE*))))
|
||||
sizeof(RFX_TILE*))))
|
||||
goto free_messages;
|
||||
}
|
||||
|
||||
@@ -1704,19 +1710,19 @@ free_messages:
|
||||
}
|
||||
|
||||
RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||
int numRects,
|
||||
BYTE* data, int width, int height, int scanline, int* numMessages,
|
||||
int maxDataSize)
|
||||
int numRects,
|
||||
BYTE* data, int width, int height, int scanline, int* numMessages,
|
||||
int maxDataSize)
|
||||
{
|
||||
RFX_MESSAGE* message;
|
||||
RFX_MESSAGE* messageList;
|
||||
|
||||
if (!(message = rfx_encode_message(context, rects, numRects, data, width,
|
||||
height, scanline)))
|
||||
height, scanline)))
|
||||
return NULL;
|
||||
|
||||
if (!(messageList = rfx_split_message(context, message, numMessages,
|
||||
maxDataSize)))
|
||||
maxDataSize)))
|
||||
{
|
||||
message->freeRects = TRUE;
|
||||
rfx_message_free(context, message);
|
||||
@@ -1728,7 +1734,7 @@ RFX_MESSAGE* rfx_encode_messages(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||
}
|
||||
|
||||
static BOOL rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message)
|
||||
RFX_MESSAGE* message)
|
||||
{
|
||||
int i;
|
||||
RFX_TILE* tile;
|
||||
@@ -1769,14 +1775,14 @@ static BOOL rfx_write_message_tileset(RFX_CONTEXT* context, wStream* s,
|
||||
|
||||
#ifdef WITH_DEBUG_RFX
|
||||
WLog_Print(context->priv->log, WLOG_DEBUG,
|
||||
"numQuant: %d numTiles: %d tilesDataSize: %d",
|
||||
message->numQuant, message->numTiles, message->tilesDataSize);
|
||||
"numQuant: %d numTiles: %d tilesDataSize: %d",
|
||||
message->numQuant, message->numTiles, message->tilesDataSize);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message)
|
||||
static BOOL rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message)
|
||||
{
|
||||
if (!Stream_EnsureRemainingCapacity(s, 14))
|
||||
return FALSE;
|
||||
@@ -1790,8 +1796,8 @@ BOOL rfx_write_message_frame_begin(RFX_CONTEXT* context, wStream* s,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message)
|
||||
static BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message)
|
||||
{
|
||||
int i;
|
||||
UINT32 blockLen;
|
||||
@@ -1809,11 +1815,13 @@ BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s,
|
||||
|
||||
for (i = 0; i < message->numRects; i++)
|
||||
{
|
||||
const RFX_RECT* rect = rfx_message_get_rect(message, i);
|
||||
|
||||
/* Clipping rectangles are relative to destLeft, destTop */
|
||||
Stream_Write_UINT16(s, message->rects[i].x); /* x (2 bytes) */
|
||||
Stream_Write_UINT16(s, message->rects[i].y); /* y (2 bytes) */
|
||||
Stream_Write_UINT16(s, message->rects[i].width); /* width (2 bytes) */
|
||||
Stream_Write_UINT16(s, message->rects[i].height); /* height (2 bytes) */
|
||||
Stream_Write_UINT16(s, rect->x); /* x (2 bytes) */
|
||||
Stream_Write_UINT16(s, rect->y); /* y (2 bytes) */
|
||||
Stream_Write_UINT16(s, rect->width); /* width (2 bytes) */
|
||||
Stream_Write_UINT16(s, rect->height); /* height (2 bytes) */
|
||||
}
|
||||
|
||||
Stream_Write_UINT16(s, CBT_REGION); /* regionType (2 bytes) */
|
||||
@@ -1822,7 +1830,7 @@ BOOL rfx_write_message_region(RFX_CONTEXT* context, wStream* s,
|
||||
}
|
||||
|
||||
BOOL rfx_write_message_frame_end(RFX_CONTEXT* context, wStream* s,
|
||||
RFX_MESSAGE* message)
|
||||
RFX_MESSAGE* message)
|
||||
{
|
||||
if (!Stream_EnsureRemainingCapacity(s, 8))
|
||||
return FALSE;
|
||||
@@ -1856,14 +1864,14 @@ BOOL rfx_write_message(RFX_CONTEXT* context, wStream* s, RFX_MESSAGE* message)
|
||||
}
|
||||
|
||||
BOOL rfx_compose_message(RFX_CONTEXT* context, wStream* s,
|
||||
const RFX_RECT* rects, int numRects, BYTE* data, int width, int height,
|
||||
int scanline)
|
||||
const RFX_RECT* rects, int numRects, BYTE* data, int width, int height,
|
||||
int scanline)
|
||||
{
|
||||
RFX_MESSAGE* message;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
if (!(message = rfx_encode_message(context, rects, numRects, data, width,
|
||||
height, scanline)))
|
||||
height, scanline)))
|
||||
return FALSE;
|
||||
|
||||
ret = rfx_write_message(context, s, message);
|
||||
|
||||
@@ -57,12 +57,13 @@ void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
|
||||
if (bitmap->data)
|
||||
_aligned_free(bitmap->data);
|
||||
|
||||
memset(bitmap, 0, sizeof(rdpBitmap));
|
||||
free(bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap, UINT16 left,
|
||||
UINT16 top, UINT16 right, UINT16 bottom)
|
||||
UINT16 top, UINT16 right, UINT16 bottom)
|
||||
{
|
||||
bitmap->left = left;
|
||||
bitmap->top = top;
|
||||
@@ -71,7 +72,7 @@ void Bitmap_SetRectangle(rdpContext* context, rdpBitmap* bitmap, UINT16 left,
|
||||
}
|
||||
|
||||
void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, UINT16 width,
|
||||
UINT16 height)
|
||||
UINT16 height)
|
||||
{
|
||||
bitmap->width = width;
|
||||
bitmap->height = height;
|
||||
@@ -81,7 +82,7 @@ void Bitmap_SetDimensions(rdpContext* context, rdpBitmap* bitmap, UINT16 width,
|
||||
BOOL Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
|
||||
{
|
||||
return context->graphics->Bitmap_Prototype->SetSurface(context, bitmap,
|
||||
primary);
|
||||
primary);
|
||||
}
|
||||
|
||||
void graphics_register_bitmap(rdpGraphics* graphics, rdpBitmap* bitmap)
|
||||
@@ -151,7 +152,7 @@ BOOL Pointer_SetDefault(rdpContext* context)
|
||||
BOOL Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
|
||||
{
|
||||
return IFCALLRESULT(TRUE, context->graphics->Pointer_Prototype->SetPosition,
|
||||
context, x, y);
|
||||
context, x, y);
|
||||
}
|
||||
|
||||
void graphics_register_pointer(rdpGraphics* graphics, rdpPointer* pointer)
|
||||
@@ -192,17 +193,17 @@ BOOL Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
|
||||
}
|
||||
|
||||
BOOL Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height,
|
||||
UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
|
||||
UINT32 bgcolor, UINT32 fgcolor, BOOL fOpRedundant)
|
||||
{
|
||||
return context->graphics->Glyph_Prototype->BeginDraw(context, x, y, width,
|
||||
height, bgcolor, fgcolor, fOpRedundant);
|
||||
height, bgcolor, fgcolor, fOpRedundant);
|
||||
}
|
||||
|
||||
BOOL Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height,
|
||||
UINT32 bgcolor, UINT32 fgcolor)
|
||||
UINT32 bgcolor, UINT32 fgcolor)
|
||||
{
|
||||
return context->graphics->Glyph_Prototype->EndDraw(context, x, y, width, height,
|
||||
bgcolor, fgcolor);
|
||||
bgcolor, fgcolor);
|
||||
}
|
||||
|
||||
void graphics_register_glyph(rdpGraphics* graphics, rdpGlyph* glyph)
|
||||
|
||||
@@ -62,11 +62,6 @@ static int update_recv_surfcmd_surface_bits(rdpUpdate* update, wStream* s, UINT3
|
||||
Stream_SetPosition(s, pos);
|
||||
*length = 20 + cmd->bitmapDataLength;
|
||||
|
||||
WLog_Print(update->log, WLOG_DEBUG,
|
||||
"SurfaceBits: destLeft: %d destTop: %d destRight: %d destBottom: %d "
|
||||
"bpp: %d codecId: %d width: %d height: %d bitmapDataLength: %d",
|
||||
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
||||
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
|
||||
IFCALL(update->SurfaceBits, update->context, cmd);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -168,7 +168,7 @@ static BOOL BitBlt_SRCCOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
||||
UINT32 nWidth, UINT32 nHeight, HGDI_DC hdcSrc,
|
||||
UINT32 nXSrc, UINT32 nYSrc)
|
||||
{
|
||||
UINT32 y;
|
||||
INT32 y;
|
||||
BYTE* srcp;
|
||||
BYTE* dstp;
|
||||
|
||||
@@ -211,18 +211,6 @@ static BOOL BitBlt_SRCCOPY(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
||||
memmove(dstp, srcp, nWidth * GetBytesPerPixel(hdcDest->format));
|
||||
}
|
||||
}
|
||||
else if (nYSrc > nYDest || nXSrc > nXDest)
|
||||
{
|
||||
/* copy up or left (top top bottom) */
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
|
||||
dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
|
||||
|
||||
if (srcp != 0 && dstp != 0)
|
||||
memmove(dstp, srcp, nWidth * GetBytesPerPixel(hdcDest->format));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* copy straight right */
|
||||
|
||||
@@ -332,7 +332,7 @@ UINT32 gdi_get_pixel_format(UINT32 bitsPerPixel, BOOL vFlip)
|
||||
switch (bitsPerPixel)
|
||||
{
|
||||
case 32:
|
||||
format = vFlip ? PIXEL_FORMAT_XBGR32_VF : PIXEL_FORMAT_XBGR32;
|
||||
format = vFlip ? PIXEL_FORMAT_XRGB32_VF : PIXEL_FORMAT_XRGB32;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
@@ -368,8 +368,8 @@ INLINE BYTE* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y)
|
||||
else
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"gdi_get_bitmap_pointer: requesting invalid pointer: (%d,%d) in %dx%d",
|
||||
x, y, hBmp->width, hBmp->height);
|
||||
"gdi_get_bitmap_pointer: requesting invalid pointer: (%d,%d) in %dx%d",
|
||||
x, y, hBmp->width, hBmp->height);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -403,7 +403,7 @@ INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
|
||||
y = (y + hBmpBrush->height - (hdcBrush->brush->nYOrg % hBmpBrush->height)) %
|
||||
hBmpBrush->height;
|
||||
p = hBmpBrush->data + (y * hBmpBrush->scanline) + (x * GetBytesPerPixel(
|
||||
hBmpBrush->format));
|
||||
hBmpBrush->format));
|
||||
return p;
|
||||
}
|
||||
}
|
||||
@@ -414,7 +414,7 @@ INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
|
||||
}
|
||||
|
||||
gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp,
|
||||
BYTE* data)
|
||||
BYTE* data)
|
||||
{
|
||||
gdiBitmap* bitmap;
|
||||
bitmap = (gdiBitmap*) calloc(1, sizeof(gdiBitmap));
|
||||
@@ -458,7 +458,7 @@ void gdi_bitmap_free_ex(gdiBitmap* bitmap)
|
||||
}
|
||||
|
||||
static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
const BITMAP_UPDATE* bitmapUpdate)
|
||||
const BITMAP_UPDATE* bitmapUpdate)
|
||||
{
|
||||
int status;
|
||||
UINT32 nXDst;
|
||||
@@ -495,9 +495,11 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
|
||||
if (gdi->bitmap_size < (UINT32)(nWidth * nHeight * 4))
|
||||
{
|
||||
gdi->bitmap_stride = nWidth * 4;
|
||||
gdi->bitmap_stride += 64 - gdi->bitmap_stride % 64;
|
||||
gdi->bitmap_size = nWidth * nHeight * 4;
|
||||
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer,
|
||||
gdi->bitmap_size, 16);
|
||||
gdi->bitmap_size, 16);
|
||||
|
||||
if (!gdi->bitmap_buffer)
|
||||
return FALSE;
|
||||
@@ -505,8 +507,6 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
|
||||
if (bitsPerPixel < 32)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED,
|
||||
@@ -514,13 +514,13 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
return FALSE;
|
||||
|
||||
status = interleaved_decompress(codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bitsPerPixel,
|
||||
pDstData,
|
||||
gdi->dstFormat,
|
||||
-1, 0, 0,
|
||||
nWidth, nHeight,
|
||||
gdi->palette);
|
||||
pSrcData, SrcSize,
|
||||
bitsPerPixel,
|
||||
gdi->bitmap_buffer,
|
||||
gdi->dstFormat,
|
||||
gdi->bitmap_stride, 0, 0,
|
||||
nWidth, nHeight,
|
||||
gdi->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -528,8 +528,8 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
gdi->dstFormat, -1, 0, 0, nWidth, nHeight, TRUE);
|
||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, &gdi->bitmap_buffer,
|
||||
gdi->dstFormat, gdi->bitmap_stride, 0, 0, nWidth, nHeight, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@@ -545,9 +545,9 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
pDstData = gdi->primary_buffer;
|
||||
nDstStep = gdi->stride;
|
||||
nWidth = MIN(bitmap->destRight,
|
||||
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
|
||||
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
|
||||
nHeight = MIN(bitmap->destBottom,
|
||||
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
|
||||
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
|
||||
|
||||
if (nWidth <= 0 || nHeight <= 0)
|
||||
{
|
||||
@@ -556,8 +556,8 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
}
|
||||
|
||||
status = freerdp_image_copy(pDstData, gdi->dstFormat, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, pSrcData, gdi->dstFormat, nSrcStep, nXSrc, nYSrc,
|
||||
gdi->palette);
|
||||
nWidth, nHeight, pSrcData, gdi->dstFormat, nSrcStep, nXSrc, nYSrc,
|
||||
gdi->palette);
|
||||
|
||||
if (!gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight))
|
||||
return FALSE;
|
||||
@@ -567,7 +567,7 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
||||
}
|
||||
|
||||
static BOOL gdi_palette_update(rdpContext* context,
|
||||
const PALETTE_UPDATE* palette)
|
||||
const PALETTE_UPDATE* palette)
|
||||
{
|
||||
int index;
|
||||
const PALETTE_ENTRY* pe;
|
||||
@@ -579,7 +579,7 @@ static BOOL gdi_palette_update(rdpContext* context,
|
||||
{
|
||||
pe = &(palette->entries[index]);
|
||||
palette32[index] = GetColor(gdi->dstFormat, pe->red, pe->green, pe->blue,
|
||||
0xFF);
|
||||
0xFF);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -592,7 +592,7 @@ static BOOL gdi_set_bounds(rdpContext* context, const rdpBounds* bounds)
|
||||
if (bounds)
|
||||
{
|
||||
gdi_SetClipRgn(gdi->drawing->hdc, bounds->left, bounds->top,
|
||||
bounds->right - bounds->left + 1, bounds->bottom - bounds->top + 1);
|
||||
bounds->right - bounds->left + 1, bounds->bottom - bounds->top + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -606,8 +606,8 @@ static BOOL gdi_dstblt(rdpContext* context, const DSTBLT_ORDER* dstblt)
|
||||
{
|
||||
rdpGdi* gdi = context->gdi;
|
||||
return gdi_BitBlt(gdi->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect,
|
||||
dstblt->nWidth, dstblt->nHeight, NULL, 0, 0,
|
||||
gdi_rop3_code(dstblt->bRop));
|
||||
dstblt->nWidth, dstblt->nHeight, NULL, 0, 0,
|
||||
gdi_rop3_code(dstblt->bRop));
|
||||
}
|
||||
|
||||
static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
@@ -623,9 +623,9 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
|
||||
brush = &patblt->brush;
|
||||
foreColor = ConvertColor(patblt->foreColor, SrcFormat,
|
||||
gdi->dstFormat, gdi->palette);
|
||||
gdi->dstFormat, gdi->palette);
|
||||
backColor = ConvertColor(patblt->backColor, SrcFormat,
|
||||
gdi->dstFormat, gdi->palette);
|
||||
gdi->dstFormat, gdi->palette);
|
||||
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
|
||||
|
||||
if (brush->style == GDI_BS_SOLID)
|
||||
@@ -640,7 +640,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
}
|
||||
|
||||
if (!gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
|
||||
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)))
|
||||
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)))
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -661,8 +661,8 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
}
|
||||
|
||||
hatched = GDI_BS_HATCHED_PATTERNS + (8 * brush->hatch);
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, -1, 0, 0, 8, 8,
|
||||
hatched, backColor, foreColor, gdi->palette);
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, 0, 0, 0, 8, 8,
|
||||
hatched, backColor, foreColor, gdi->palette);
|
||||
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->format, data);
|
||||
|
||||
if (!hBmp)
|
||||
@@ -686,7 +686,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
gdi->drawing->hdc->brush->nYOrg = brush->y;
|
||||
|
||||
if (!gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
|
||||
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)))
|
||||
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)))
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -711,7 +711,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
}
|
||||
|
||||
freerdp_image_copy(data, gdi->dstFormat, -1, 0, 0,
|
||||
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
|
||||
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -723,8 +723,8 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, -1, 0, 0, 8, 8,
|
||||
brush->data, backColor, foreColor, gdi->palette);
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, 0, 0, 0, 8, 8,
|
||||
brush->data, backColor, foreColor, gdi->palette);
|
||||
}
|
||||
|
||||
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->format, data);
|
||||
@@ -750,7 +750,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
gdi->drawing->hdc->brush->nYOrg = brush->y;
|
||||
|
||||
if (!gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
|
||||
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)))
|
||||
patblt->nWidth, patblt->nHeight, gdi_rop3_code(patblt->bRop)))
|
||||
{
|
||||
ret = FALSE;
|
||||
}
|
||||
@@ -772,12 +772,12 @@ static BOOL gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt)
|
||||
{
|
||||
rdpGdi* gdi = context->gdi;
|
||||
return gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect,
|
||||
scrblt->nWidth, scrblt->nHeight, gdi->primary->hdc,
|
||||
scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop));
|
||||
scrblt->nWidth, scrblt->nHeight, gdi->primary->hdc,
|
||||
scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop));
|
||||
}
|
||||
|
||||
static BOOL gdi_opaque_rect(rdpContext* context,
|
||||
const OPAQUE_RECT_ORDER* opaque_rect)
|
||||
const OPAQUE_RECT_ORDER* opaque_rect)
|
||||
{
|
||||
GDI_RECT rect;
|
||||
HGDI_BRUSH hBrush;
|
||||
@@ -786,9 +786,9 @@ static BOOL gdi_opaque_rect(rdpContext* context,
|
||||
BOOL ret;
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
|
||||
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
|
||||
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
|
||||
brush_color = ConvertColor(opaque_rect->color, SrcFormat,
|
||||
gdi->dstFormat, gdi->palette);
|
||||
gdi->dstFormat, gdi->palette);
|
||||
|
||||
if (!(hBrush = gdi_CreateSolidBrush(brush_color)))
|
||||
return FALSE;
|
||||
@@ -799,7 +799,7 @@ static BOOL gdi_opaque_rect(rdpContext* context,
|
||||
}
|
||||
|
||||
static BOOL gdi_multi_opaque_rect(rdpContext* context,
|
||||
const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
||||
const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
||||
{
|
||||
UINT32 i;
|
||||
GDI_RECT rect;
|
||||
@@ -814,9 +814,9 @@ static BOOL gdi_multi_opaque_rect(rdpContext* context,
|
||||
{
|
||||
rectangle = &multi_opaque_rect->rectangles[i];
|
||||
gdi_CRgnToRect(rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height, &rect);
|
||||
rectangle->width, rectangle->height, &rect);
|
||||
brush_color = ConvertColor(multi_opaque_rect->color, SrcFormat,
|
||||
gdi->dstFormat, gdi->palette);
|
||||
gdi->dstFormat, gdi->palette);
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
|
||||
if (!hBrush)
|
||||
@@ -841,7 +841,7 @@ static BOOL gdi_line_to(rdpContext* context, const LINE_TO_ORDER* lineTo)
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
|
||||
|
||||
if (!(hPen = gdi_CreatePen(lineTo->penStyle, lineTo->penWidth, color,
|
||||
SrcFormat)))
|
||||
SrcFormat)))
|
||||
return FALSE;
|
||||
|
||||
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
|
||||
@@ -892,8 +892,8 @@ static BOOL gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
||||
rdpGdi* gdi = context->gdi;
|
||||
bitmap = (gdiBitmap*) memblt->bitmap;
|
||||
return gdi_BitBlt(gdi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
|
||||
memblt->nWidth, memblt->nHeight, bitmap->hdc,
|
||||
memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop));
|
||||
memblt->nWidth, memblt->nHeight, bitmap->hdc,
|
||||
memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop));
|
||||
}
|
||||
|
||||
static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
@@ -911,9 +911,9 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
brush = &mem3blt->brush;
|
||||
bitmap = (gdiBitmap*) mem3blt->bitmap;
|
||||
foreColor = ConvertColor(mem3blt->foreColor, SrcFormat,
|
||||
gdi->dstFormat, gdi->palette);
|
||||
gdi->dstFormat, gdi->palette);
|
||||
backColor = ConvertColor(mem3blt->backColor, SrcFormat,
|
||||
gdi->dstFormat, gdi->palette);
|
||||
gdi->dstFormat, gdi->palette);
|
||||
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
|
||||
|
||||
if (brush->style == GDI_BS_SOLID)
|
||||
@@ -928,8 +928,8 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
}
|
||||
|
||||
gdi_BitBlt(gdi->drawing->hdc, mem3blt->nLeftRect, mem3blt->nTopRect,
|
||||
mem3blt->nWidth, mem3blt->nHeight, bitmap->hdc,
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, gdi_rop3_code(mem3blt->bRop));
|
||||
mem3blt->nWidth, mem3blt->nHeight, bitmap->hdc,
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, gdi_rop3_code(mem3blt->bRop));
|
||||
gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush);
|
||||
gdi->drawing->hdc->brush = originalBrush;
|
||||
}
|
||||
@@ -950,7 +950,7 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
}
|
||||
|
||||
freerdp_image_copy(data, gdi->dstFormat, -1, 0, 0,
|
||||
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
|
||||
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -962,8 +962,8 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, -1, 0, 0, 8, 8,
|
||||
brush->data, backColor, foreColor, gdi->palette);
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, 0, 0, 0, 8, 8,
|
||||
brush->data, backColor, foreColor, gdi->palette);
|
||||
}
|
||||
|
||||
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->format, data);
|
||||
@@ -987,8 +987,8 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
gdi->drawing->hdc->brush->nXOrg = brush->x;
|
||||
gdi->drawing->hdc->brush->nYOrg = brush->y;
|
||||
gdi_BitBlt(gdi->drawing->hdc, mem3blt->nLeftRect, mem3blt->nTopRect,
|
||||
mem3blt->nWidth, mem3blt->nHeight, bitmap->hdc,
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, gdi_rop3_code(mem3blt->bRop));
|
||||
mem3blt->nWidth, mem3blt->nHeight, bitmap->hdc,
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, gdi_rop3_code(mem3blt->bRop));
|
||||
gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush);
|
||||
gdi->drawing->hdc->brush = originalBrush;
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ out_fail:
|
||||
}
|
||||
|
||||
static BOOL gdi_polygon_sc(rdpContext* context,
|
||||
const POLYGON_SC_ORDER* polygon_sc)
|
||||
const POLYGON_SC_ORDER* polygon_sc)
|
||||
{
|
||||
WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
|
||||
return TRUE;
|
||||
@@ -1016,31 +1016,31 @@ static BOOL gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
|
||||
}
|
||||
|
||||
static BOOL gdi_ellipse_sc(rdpContext* context,
|
||||
const ELLIPSE_SC_ORDER* ellipse_sc)
|
||||
const ELLIPSE_SC_ORDER* ellipse_sc)
|
||||
{
|
||||
WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL gdi_ellipse_cb(rdpContext* context,
|
||||
const ELLIPSE_CB_ORDER* ellipse_cb)
|
||||
const ELLIPSE_CB_ORDER* ellipse_cb)
|
||||
{
|
||||
WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL gdi_frame_marker(rdpContext* context,
|
||||
const FRAME_MARKER_ORDER* frameMarker)
|
||||
const FRAME_MARKER_ORDER* frameMarker)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL gdi_surface_frame_marker(rdpContext* context,
|
||||
const SURFACE_FRAME_MARKER* surfaceFrameMarker)
|
||||
const SURFACE_FRAME_MARKER* surfaceFrameMarker)
|
||||
{
|
||||
DEBUG_GDI("frameId %d frameAction %d",
|
||||
surfaceFrameMarker->frameId,
|
||||
surfaceFrameMarker->frameAction);
|
||||
surfaceFrameMarker->frameId,
|
||||
surfaceFrameMarker->frameAction);
|
||||
|
||||
switch (surfaceFrameMarker->frameAction)
|
||||
{
|
||||
@@ -1061,86 +1061,94 @@ BOOL gdi_surface_frame_marker(rdpContext* context,
|
||||
}
|
||||
|
||||
static BOOL gdi_surface_bits(rdpContext* context,
|
||||
const SURFACE_BITS_COMMAND* cmd)
|
||||
const SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
|
||||
"bpp %d codecID %d width %d height %d length %d",
|
||||
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
||||
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
|
||||
"bpp %d codecID %d width %d height %d length %d",
|
||||
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
|
||||
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
|
||||
|
||||
if (gdi->bitmap_size < (cmd->width * cmd->height * 4))
|
||||
{
|
||||
gdi->bitmap_size = cmd->width * cmd->height * 4;
|
||||
gdi->bitmap_stride = (cmd->width + 64 - cmd->width) * 4;
|
||||
gdi->bitmap_size = gdi->bitmap_stride * cmd->height;
|
||||
|
||||
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer,
|
||||
gdi->bitmap_size, 16);
|
||||
gdi->bitmap_size, 16);
|
||||
|
||||
if (!gdi->bitmap_buffer)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (cmd->codecID == RDP_CODEC_ID_REMOTEFX)
|
||||
switch(cmd->codecID)
|
||||
{
|
||||
case RDP_CODEC_ID_REMOTEFX:
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_REMOTEFX,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
|
||||
if (!rfx_process_message(gdi->codecs->rfx, cmd->bitmapData,
|
||||
PIXEL_FORMAT_BGRX32,
|
||||
cmd->bitmapDataLength,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
pDstData, gdi->dstFormat,
|
||||
cmd->width, cmd->height, NULL))
|
||||
PIXEL_FORMAT_BGRX32,
|
||||
cmd->bitmapDataLength,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
pDstData, gdi->dstFormat,
|
||||
gdi->stride, cmd->height, NULL))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else if (cmd->codecID == RDP_CODEC_ID_NSCODEC)
|
||||
break;
|
||||
case RDP_CODEC_ID_NSCODEC:
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_NSCODEC,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
if (!nsc_process_message(gdi->codecs->nsc, cmd->bpp, cmd->width,
|
||||
cmd->height, cmd->bitmapData,
|
||||
cmd->bitmapDataLength, gdi->bitmap_buffer,
|
||||
gdi->dstFormat,
|
||||
0, 0, 0, cmd->width, cmd->height))
|
||||
cmd->height, cmd->bitmapData,
|
||||
cmd->bitmapDataLength, gdi->bitmap_buffer,
|
||||
gdi->dstFormat,
|
||||
0, 0, 0, cmd->width, cmd->height))
|
||||
return FALSE;
|
||||
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap);
|
||||
gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height,
|
||||
gdi->dstFormat, 0,
|
||||
pDstData, NULL);
|
||||
gdi->dstFormat, 0,
|
||||
pDstData, NULL);
|
||||
gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap);
|
||||
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
}
|
||||
else if (cmd->codecID == RDP_CODEC_ID_NONE)
|
||||
break;
|
||||
case RDP_CODEC_ID_NONE:
|
||||
{
|
||||
pDstData = gdi->bitmap_buffer;
|
||||
pSrcData = cmd->bitmapData;
|
||||
freerdp_image_copy(pDstData, gdi->dstFormat, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData,
|
||||
PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette);
|
||||
if (!freerdp_image_copy(pDstData, gdi->dstFormat, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData,
|
||||
PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette))
|
||||
return FALSE;
|
||||
|
||||
gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap);
|
||||
gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height,
|
||||
gdi->dstFormat,
|
||||
0,
|
||||
pDstData, NULL);
|
||||
gdi->dstFormat,
|
||||
0,
|
||||
pDstData, NULL);
|
||||
gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap);
|
||||
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
default:
|
||||
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@@ -1185,7 +1193,7 @@ void gdi_register_update_callbacks(rdpUpdate* update)
|
||||
}
|
||||
|
||||
static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, BYTE* buffer,
|
||||
void (*pfree)(void*))
|
||||
void (*pfree)(void*))
|
||||
{
|
||||
gdi->primary = (gdiBitmap*) calloc(1, sizeof(gdiBitmap));
|
||||
|
||||
@@ -1198,14 +1206,14 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, BYTE* buffer,
|
||||
if (!buffer)
|
||||
{
|
||||
gdi->primary->bitmap = gdi_CreateCompatibleBitmap(
|
||||
gdi->hdc, gdi->width, gdi->height);
|
||||
gdi->hdc, gdi->width, gdi->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdi->primary->bitmap = gdi_CreateBitmapEx(gdi->width, gdi->height,
|
||||
gdi->dstFormat,
|
||||
gdi->stride,
|
||||
gdi->primary_buffer, pfree);
|
||||
gdi->dstFormat,
|
||||
gdi->stride,
|
||||
gdi->primary_buffer, pfree);
|
||||
}
|
||||
|
||||
gdi->stride = gdi->primary->bitmap->scanline;
|
||||
@@ -1227,7 +1235,7 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, BYTE* buffer,
|
||||
gdi->primary->hdc->hwnd->count = 32;
|
||||
|
||||
if (!(gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) calloc(
|
||||
gdi->primary->hdc->hwnd->count, sizeof(GDI_RGN))))
|
||||
gdi->primary->hdc->hwnd->count, sizeof(GDI_RGN))))
|
||||
goto fail_hwnd;
|
||||
|
||||
gdi->primary->hdc->hwnd->ninvalid = 0;
|
||||
@@ -1253,8 +1261,8 @@ BOOL gdi_resize(rdpGdi* gdi, UINT32 width, UINT32 height)
|
||||
}
|
||||
|
||||
BOOL gdi_resize_ex(rdpGdi* gdi, UINT32 width, UINT32 height,
|
||||
INT32 stride, INT32 format, BYTE* buffer,
|
||||
void (*pfree)(void*))
|
||||
INT32 stride, INT32 format, BYTE* buffer,
|
||||
void (*pfree)(void*))
|
||||
{
|
||||
if (!gdi || !gdi->primary)
|
||||
return FALSE;
|
||||
@@ -1284,7 +1292,7 @@ BOOL gdi_init(freerdp* instance, UINT32 format)
|
||||
}
|
||||
|
||||
BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
|
||||
void (*pfree)(void*))
|
||||
void (*pfree)(void*))
|
||||
{
|
||||
rdpGdi* gdi;
|
||||
rdpCache* cache = NULL;
|
||||
@@ -1302,9 +1310,9 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
|
||||
gdi->dstFormat = format;
|
||||
/* default internal buffer format */
|
||||
WLog_INFO(TAG, "Local framebuffer format %s",
|
||||
GetColorFormatName(gdi->dstFormat));
|
||||
GetColorFormatName(gdi->dstFormat));
|
||||
WLog_INFO(TAG, "Remote framebuffer format %s",
|
||||
GetColorFormatName(SrcFormat));
|
||||
GetColorFormatName(SrcFormat));
|
||||
|
||||
if (!(gdi->hdc = gdi_GetDC()))
|
||||
goto fail_get_hdc;
|
||||
|
||||
@@ -113,7 +113,7 @@ BOOL gdi_LineTo(HGDI_DC hdc, UINT32 nXEnd, UINT32 nYEnd)
|
||||
UINT32 x, y;
|
||||
UINT32 x1, y1;
|
||||
UINT32 x2, y2;
|
||||
UINT32 e, e2;
|
||||
INT32 e, e2;
|
||||
INT32 dx, dy;
|
||||
INT32 sx, sy;
|
||||
INT32 bx1, by1;
|
||||
|
||||
@@ -138,7 +138,7 @@ BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr)
|
||||
if (!gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL))
|
||||
return TRUE;
|
||||
|
||||
color = ConvertColor(hbr->color, hbr->pattern->format, hdc->format, NULL);
|
||||
color = hbr->color;
|
||||
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user