mirror of https://github.com/FreeRDP/FreeRDP
API refactoring.
This commit is contained in:
parent
f680b62d03
commit
85bbe2a908
|
@ -122,6 +122,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
double yScalingFactor;
|
||||
int x2;
|
||||
int y2;
|
||||
rdpSettings* settings = xfc->context.settings;
|
||||
|
||||
if (xfc->scaledWidth <= 0 || xfc->scaledHeight <= 0)
|
||||
{
|
||||
|
@ -129,14 +130,14 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
return;
|
||||
}
|
||||
|
||||
if (xfc->sessionWidth <= 0 || xfc->sessionHeight <= 0)
|
||||
if (settings->DesktopWidth <= 0 || settings->DesktopHeight <= 0)
|
||||
{
|
||||
WLog_ERR(TAG, "the window dimensions are invalid");
|
||||
return;
|
||||
}
|
||||
|
||||
xScalingFactor = xfc->sessionWidth / (double)xfc->scaledWidth;
|
||||
yScalingFactor = xfc->sessionHeight / (double)xfc->scaledHeight;
|
||||
xScalingFactor = settings->DesktopWidth / (double)xfc->scaledWidth;
|
||||
yScalingFactor = settings->DesktopHeight / (double)xfc->scaledHeight;
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, 0);
|
||||
/* Black out possible space between desktop and window borders */
|
||||
|
@ -191,9 +192,11 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
|
||||
BOOL xf_picture_transform_required(xfContext* xfc)
|
||||
{
|
||||
rdpSettings* settings = xfc->context.settings;
|
||||
|
||||
if (xfc->offset_x || xfc->offset_y ||
|
||||
xfc->scaledWidth != xfc->sessionWidth ||
|
||||
xfc->scaledHeight != xfc->sessionHeight)
|
||||
xfc->scaledWidth != settings->DesktopWidth ||
|
||||
xfc->scaledHeight != settings->DesktopHeight)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -236,7 +239,8 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
|||
|
||||
if (!(xfc->primary = XCreatePixmap(
|
||||
xfc->display, xfc->drawable,
|
||||
xfc->sessionWidth, xfc->sessionHeight, xfc->depth)))
|
||||
settings->DesktopWidth,
|
||||
settings->DesktopHeight, xfc->depth)))
|
||||
return FALSE;
|
||||
|
||||
if (same)
|
||||
|
@ -247,8 +251,8 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
|||
|
||||
if (!xfc->settings->SmartSizing)
|
||||
{
|
||||
xfc->scaledWidth = xfc->sessionWidth;
|
||||
xfc->scaledHeight = xfc->sessionHeight;
|
||||
xfc->scaledWidth = settings->DesktopWidth;
|
||||
xfc->scaledHeight = settings->DesktopHeight;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -267,8 +271,8 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
|||
{
|
||||
/* Update the saved width and height values the window will be
|
||||
* resized to when toggling out of fullscreen */
|
||||
xfc->savedWidth = xfc->sessionWidth;
|
||||
xfc->savedHeight = xfc->sessionHeight;
|
||||
xfc->savedWidth = settings->DesktopWidth;
|
||||
xfc->savedHeight = settings->DesktopHeight;
|
||||
}
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
|
@ -357,12 +361,11 @@ static BOOL xf_sw_desktop_resize(rdpContext* context)
|
|||
{
|
||||
rdpGdi* gdi = context->gdi;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
rdpSettings* settings = context->settings;
|
||||
BOOL ret = FALSE;
|
||||
xf_lock_x11(xfc, TRUE);
|
||||
xfc->sessionWidth = context->settings->DesktopWidth;
|
||||
xfc->sessionHeight = context->settings->DesktopHeight;
|
||||
|
||||
if (!gdi_resize(gdi, xfc->sessionWidth, xfc->sessionHeight))
|
||||
if (!gdi_resize(gdi, settings->DesktopWidth, settings->DesktopHeight))
|
||||
goto out;
|
||||
|
||||
if (xfc->image)
|
||||
|
@ -459,11 +462,8 @@ static BOOL xf_hw_end_paint(rdpContext* context)
|
|||
static BOOL xf_hw_desktop_resize(rdpContext* context)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
rdpSettings* settings = xfc->settings;
|
||||
BOOL ret;
|
||||
xf_lock_x11(xfc, TRUE);
|
||||
xfc->sessionWidth = settings->DesktopWidth;
|
||||
xfc->sessionHeight = settings->DesktopHeight;
|
||||
ret = xf_desktop_resize(context);
|
||||
xf_unlock_x11(xfc, TRUE);
|
||||
return ret;
|
||||
|
@ -506,8 +506,8 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
char* windowTitle;
|
||||
rdpSettings* settings = xfc->settings;
|
||||
ZeroMemory(&xevent, sizeof(xevent));
|
||||
width = xfc->sessionWidth;
|
||||
height = xfc->sessionHeight;
|
||||
width = settings->DesktopWidth;
|
||||
height = settings->DesktopHeight;
|
||||
|
||||
if (!xfc->hdc)
|
||||
if (!(xfc->hdc = gdi_CreateDC(xfc->format)))
|
||||
|
@ -589,8 +589,9 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
xfc->gc = XCreateGC(xfc->display, xfc->drawable, GCGraphicsExposures, &gcv);
|
||||
|
||||
if (!xfc->primary)
|
||||
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->sessionWidth,
|
||||
xfc->sessionHeight, xfc->depth);
|
||||
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable,
|
||||
settings->DesktopWidth,
|
||||
settings->DesktopHeight, xfc->depth);
|
||||
|
||||
xfc->drawing = xfc->primary;
|
||||
|
||||
|
@ -604,8 +605,9 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
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);
|
||||
XFillRectangle(xfc->display, xfc->primary, xfc->gc, 0, 0,
|
||||
settings->DesktopWidth,
|
||||
settings->DesktopHeight);
|
||||
XFlush(xfc->display);
|
||||
|
||||
if (!xfc->image)
|
||||
|
@ -614,7 +616,7 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
xfc->image = XCreateImage(xfc->display, xfc->visual,
|
||||
xfc->depth,
|
||||
ZPixmap, 0, (char*) gdi->primary_buffer,
|
||||
xfc->sessionWidth, xfc->sessionHeight,
|
||||
settings->DesktopWidth, settings->DesktopHeight,
|
||||
xfc->scanline_pad, 0);
|
||||
}
|
||||
|
||||
|
@ -1222,12 +1224,9 @@ static BOOL xf_post_connect(freerdp* instance)
|
|||
xf_gdi_register_update_callbacks(update);
|
||||
}
|
||||
|
||||
xfc->srcBpp = settings->ColorDepth;
|
||||
xfc->sessionWidth = settings->DesktopWidth;
|
||||
xfc->sessionHeight = settings->DesktopHeight;
|
||||
#ifdef WITH_XRENDER
|
||||
xfc->scaledWidth = xfc->sessionWidth;
|
||||
xfc->scaledHeight = xfc->sessionHeight;
|
||||
xfc->scaledWidth = settings->DesktopWidth;
|
||||
xfc->scaledHeight = settings->DesktopHeight;
|
||||
xfc->offset_x = 0;
|
||||
xfc->offset_y = 0;
|
||||
#endif
|
||||
|
@ -1649,6 +1648,7 @@ static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
|||
ZoomingChangeEventArgs* e)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
rdpSettings* settings = context->settings;
|
||||
int w = xfc->scaledWidth + e->dx;
|
||||
int h = xfc->scaledHeight + e->dy;
|
||||
|
||||
|
@ -1666,20 +1666,21 @@ static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
|||
|
||||
xfc->scaledWidth = w;
|
||||
xfc->scaledHeight = h;
|
||||
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
|
||||
xf_draw_screen(xfc, 0, 0, settings->DesktopWidth, settings->DesktopHeight);
|
||||
}
|
||||
|
||||
static void xf_PanningChangeEventHandler(rdpContext* context,
|
||||
PanningChangeEventArgs* e)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
rdpSettings* settings = context->settings;
|
||||
|
||||
if (e->dx == 0 && e->dy == 0)
|
||||
return;
|
||||
|
||||
xfc->offset_x += e->dx;
|
||||
xfc->offset_y += e->dy;
|
||||
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
|
||||
xf_draw_screen(xfc, 0, 0, settings->DesktopWidth, settings->DesktopHeight);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -91,14 +91,13 @@ BOOL xf_event_action_script_init(xfContext* xfc)
|
|||
FILE* actionScript;
|
||||
char buffer[1024] = { 0 };
|
||||
char command[1024] = { 0 };
|
||||
|
||||
xfc->xevents = ArrayList_New(TRUE);
|
||||
|
||||
if (!xfc->xevents)
|
||||
return FALSE;
|
||||
|
||||
ArrayList_Object(xfc->xevents)->fnObjectFree = free;
|
||||
|
||||
sprintf_s(command, sizeof(command), "%s xevent", xfc->actionScript);
|
||||
|
||||
actionScript = popen(command, "r");
|
||||
|
||||
if (!actionScript)
|
||||
|
@ -108,6 +107,7 @@ BOOL xf_event_action_script_init(xfContext* xfc)
|
|||
{
|
||||
strtok(buffer, "\n");
|
||||
xevent = _strdup(buffer);
|
||||
|
||||
if (!xevent || ArrayList_Add(xfc->xevents, xevent) < 0)
|
||||
{
|
||||
ArrayList_Free(xfc->xevents);
|
||||
|
@ -117,7 +117,6 @@ BOOL xf_event_action_script_init(xfContext* xfc)
|
|||
}
|
||||
|
||||
pclose(actionScript);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -148,7 +147,6 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, XEvent* event)
|
|||
return FALSE;
|
||||
|
||||
xeventName = X11_EVENT_STRINGS[event->type];
|
||||
|
||||
count = ArrayList_Count(xfc->xevents);
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
|
@ -166,8 +164,7 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, XEvent* event)
|
|||
return FALSE;
|
||||
|
||||
sprintf_s(command, sizeof(command), "%s xevent %s %d",
|
||||
xfc->actionScript, xeventName, (int) xfc->window->handle);
|
||||
|
||||
xfc->actionScript, xeventName, (int) xfc->window->handle);
|
||||
actionScript = popen(command, "r");
|
||||
|
||||
if (!actionScript)
|
||||
|
@ -179,24 +176,33 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, XEvent* event)
|
|||
}
|
||||
|
||||
pclose(actionScript);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int *y)
|
||||
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y)
|
||||
{
|
||||
rdpSettings* settings;
|
||||
|
||||
if (!xfc || !xfc->context.settings || !y || !x)
|
||||
return;
|
||||
|
||||
settings = xfc->context.settings;
|
||||
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
#ifdef WITH_XRENDER
|
||||
|
||||
if (xf_picture_transform_required(xfc))
|
||||
{
|
||||
double xScalingFactor = xfc->sessionWidth / (double)xfc->scaledWidth;
|
||||
double yScalingFactor = xfc->sessionHeight / (double)xfc->scaledHeight;
|
||||
double xScalingFactor = settings->DesktopWidth / (double)xfc->scaledWidth;
|
||||
double yScalingFactor = settings->DesktopHeight / (double)xfc->scaledHeight;
|
||||
*x = (int)((*x - xfc->offset_x) * xScalingFactor);
|
||||
*y = (int)((*y - xfc->offset_y) * yScalingFactor);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
CLAMP_COORDINATES(*x, *y);
|
||||
}
|
||||
|
||||
|
@ -204,13 +210,14 @@ static BOOL xf_event_Expose(xfContext* xfc, XEvent* event, BOOL app)
|
|||
{
|
||||
int x, y;
|
||||
int w, h;
|
||||
rdpSettings* settings = xfc->context.settings;
|
||||
|
||||
if (!app && (xfc->settings->SmartSizing || xfc->settings->MultiTouchGestures))
|
||||
if (!app && (settings->SmartSizing || settings->MultiTouchGestures))
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
w = xfc->sessionWidth;
|
||||
h = xfc->sessionHeight;
|
||||
w = settings->DesktopWidth;
|
||||
h = settings->DesktopHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -233,7 +240,6 @@ static BOOL xf_event_Expose(xfContext* xfc, XEvent* event, BOOL app)
|
|||
else
|
||||
{
|
||||
xfAppWindow* appWindow;
|
||||
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
|
||||
|
||||
if (appWindow)
|
||||
|
@ -251,11 +257,11 @@ static BOOL xf_event_VisibilityNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window window, BOOL app)
|
||||
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state,
|
||||
Window window, BOOL app)
|
||||
{
|
||||
rdpInput* input;
|
||||
Window childWindow;
|
||||
|
||||
input = xfc->instance->input;
|
||||
|
||||
if (!xfc->settings->MouseMotion)
|
||||
|
@ -272,17 +278,17 @@ BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window win
|
|||
|
||||
/* Translate to desktop coordinates */
|
||||
XTranslateCoordinates(xfc->display, window,
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
}
|
||||
|
||||
xf_event_adjust_coordinates(xfc, &x, &y);
|
||||
|
||||
input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
|
||||
|
||||
if (xfc->fullscreen && !app)
|
||||
{
|
||||
XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
|
||||
XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot,
|
||||
CurrentTime);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -294,17 +300,17 @@ static BOOL xf_event_MotionNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
return TRUE;
|
||||
|
||||
return xf_generic_MotionNotify(xfc, event->xmotion.x, event->xmotion.y,
|
||||
event->xmotion.state, event->xmotion.window, app);
|
||||
event->xmotion.state, event->xmotion.window, app);
|
||||
}
|
||||
|
||||
BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window window, BOOL app)
|
||||
BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button,
|
||||
Window window, BOOL app)
|
||||
{
|
||||
int flags;
|
||||
BOOL wheel;
|
||||
BOOL extended;
|
||||
rdpInput* input;
|
||||
Window childWindow;
|
||||
|
||||
flags = 0;
|
||||
wheel = FALSE;
|
||||
extended = FALSE;
|
||||
|
@ -315,7 +321,7 @@ BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window win
|
|||
case Button1:
|
||||
case Button2:
|
||||
case Button3:
|
||||
flags = PTR_FLAGS_DOWN | xfc->button_map[button-BUTTON_BASE];
|
||||
flags = PTR_FLAGS_DOWN | xfc->button_map[button - BUTTON_BASE];
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
@ -342,14 +348,18 @@ BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window win
|
|||
|
||||
case 6: /* wheel left */
|
||||
wheel = TRUE;
|
||||
|
||||
if (xfc->settings->HasHorizontalWheel)
|
||||
flags = PTR_FLAGS_HWHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0078;
|
||||
|
||||
break;
|
||||
|
||||
case 7: /* wheel right */
|
||||
wheel = TRUE;
|
||||
|
||||
if (xfc->settings->HasHorizontalWheel)
|
||||
flags = PTR_FLAGS_HWHEEL | 0x0078;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -375,9 +385,8 @@ BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window win
|
|||
|
||||
/* Translate to desktop coordinates */
|
||||
XTranslateCoordinates(xfc->display, window,
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
}
|
||||
|
||||
xf_event_adjust_coordinates(xfc, &x, &y);
|
||||
|
@ -398,17 +407,17 @@ static BOOL xf_event_ButtonPress(xfContext* xfc, XEvent* event, BOOL app)
|
|||
return TRUE;
|
||||
|
||||
return xf_generic_ButtonPress(xfc, event->xbutton.x, event->xbutton.y,
|
||||
event->xbutton.button, event->xbutton.window, app);
|
||||
event->xbutton.button, event->xbutton.window, app);
|
||||
}
|
||||
|
||||
BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window window, BOOL app)
|
||||
BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button,
|
||||
Window window, BOOL app)
|
||||
{
|
||||
int flags;
|
||||
BOOL wheel;
|
||||
BOOL extended;
|
||||
rdpInput* input;
|
||||
Window childWindow;
|
||||
|
||||
flags = 0;
|
||||
wheel = FALSE;
|
||||
extended = FALSE;
|
||||
|
@ -419,7 +428,7 @@ BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window w
|
|||
case Button1:
|
||||
case Button2:
|
||||
case Button3:
|
||||
flags = xfc->button_map[button-BUTTON_BASE];
|
||||
flags = xfc->button_map[button - BUTTON_BASE];
|
||||
break;
|
||||
|
||||
case 6:
|
||||
|
@ -451,8 +460,8 @@ BOOL xf_generic_ButtonRelease(xfContext* xfc, int x, int y, int button, Window w
|
|||
|
||||
/* Translate to desktop coordinates */
|
||||
XTranslateCoordinates(xfc->display, window,
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
x, y, &x, &y, &childWindow);
|
||||
}
|
||||
|
||||
xf_event_adjust_coordinates(xfc, &x, &y);
|
||||
|
@ -472,18 +481,15 @@ static BOOL xf_event_ButtonRelease(xfContext* xfc, XEvent* event, BOOL app)
|
|||
return TRUE;
|
||||
|
||||
return xf_generic_ButtonRelease(xfc, event->xbutton.x, event->xbutton.y,
|
||||
event->xbutton.button, event->xbutton.window, app);
|
||||
event->xbutton.button, event->xbutton.window, app);
|
||||
}
|
||||
|
||||
static BOOL xf_event_KeyPress(xfContext* xfc, XEvent* event, BOOL app)
|
||||
{
|
||||
KeySym keysym;
|
||||
char str[256];
|
||||
|
||||
XLookupString((XKeyEvent*) event, str, sizeof(str), &keysym, NULL);
|
||||
|
||||
xf_keyboard_key_press(xfc, event->xkey.keycode, keysym);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -504,7 +510,6 @@ static BOOL xf_event_KeyRelease(xfContext* xfc, XEvent* event, BOOL app)
|
|||
}
|
||||
|
||||
xf_keyboard_key_release(xfc, event->xkey.keycode);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -516,14 +521,13 @@ static BOOL xf_event_FocusIn(xfContext* xfc, XEvent* event, BOOL app)
|
|||
xfc->focused = TRUE;
|
||||
|
||||
if (xfc->mouse_active && !app)
|
||||
XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||
XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
|
||||
if (app)
|
||||
{
|
||||
xfAppWindow* appWindow;
|
||||
|
||||
xf_rail_send_activate(xfc, event->xany.window, TRUE);
|
||||
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
|
||||
|
||||
/* Update the server with any window changes that occurred while the window was not focused. */
|
||||
|
@ -534,7 +538,6 @@ static BOOL xf_event_FocusIn(xfContext* xfc, XEvent* event, BOOL app)
|
|||
}
|
||||
|
||||
xf_keyboard_focus_in(xfc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -578,7 +581,6 @@ static BOOL xf_event_ClientMessage(xfContext* xfc, XEvent* event, BOOL app)
|
|||
if (app)
|
||||
{
|
||||
xfAppWindow* appWindow;
|
||||
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
|
||||
|
||||
if (appWindow)
|
||||
|
@ -605,15 +607,16 @@ static BOOL xf_event_EnterNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
xfc->mouse_active = TRUE;
|
||||
|
||||
if (xfc->fullscreen)
|
||||
XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
|
||||
XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot,
|
||||
CurrentTime);
|
||||
|
||||
if (xfc->focused)
|
||||
XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||
XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
xfAppWindow* appWindow;
|
||||
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
|
||||
|
||||
/* keep track of which window has focus so that we can apply pointer updates */
|
||||
|
@ -642,6 +645,7 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
{
|
||||
Window childWindow;
|
||||
xfAppWindow* appWindow;
|
||||
rdpSettings* settings = xfc->context.settings;
|
||||
|
||||
if (!app)
|
||||
{
|
||||
|
@ -652,26 +656,29 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
xfc->window->top = event->xconfigure.y;
|
||||
|
||||
if (xfc->window->width != event->xconfigure.width ||
|
||||
xfc->window->height != event->xconfigure.height)
|
||||
xfc->window->height != event->xconfigure.height)
|
||||
{
|
||||
xfc->window->width = event->xconfigure.width;
|
||||
xfc->window->height = event->xconfigure.height;
|
||||
#ifdef WITH_XRENDER
|
||||
xfc->offset_x = 0;
|
||||
xfc->offset_y = 0;
|
||||
|
||||
if (xfc->settings->SmartSizing || xfc->settings->MultiTouchGestures)
|
||||
{
|
||||
xfc->scaledWidth = xfc->window->width;
|
||||
xfc->scaledHeight = xfc->window->height;
|
||||
xf_draw_screen(xfc, 0, 0, xfc->sessionWidth, xfc->sessionHeight);
|
||||
xf_draw_screen(xfc, 0, 0, settings->DesktopWidth, settings->DesktopHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
xfc->scaledWidth = xfc->sessionWidth;
|
||||
xfc->scaledHeight = xfc->sessionHeight;
|
||||
xfc->scaledWidth = settings->DesktopWidth;
|
||||
xfc->scaledHeight = settings->DesktopHeight;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -683,11 +690,9 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
* ConfigureNotify coordinates are expressed relative to the window parent.
|
||||
* Translate these to root window coordinates.
|
||||
*/
|
||||
|
||||
XTranslateCoordinates(xfc->display, appWindow->handle,
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
0, 0, &appWindow->x, &appWindow->y, &childWindow);
|
||||
|
||||
RootWindowOfScreen(xfc->screen),
|
||||
0, 0, &appWindow->x, &appWindow->y, &childWindow);
|
||||
appWindow->width = event->xconfigure.width;
|
||||
appWindow->height = event->xconfigure.height;
|
||||
|
||||
|
@ -704,11 +709,11 @@ static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((!event->xconfigure.send_event || appWindow->local_move.state == LMS_NOT_ACTIVE)
|
||||
&& !appWindow->rail_ignore_configure && xfc->focused)
|
||||
if ((!event->xconfigure.send_event
|
||||
|| appWindow->local_move.state == LMS_NOT_ACTIVE)
|
||||
&& !appWindow->rail_ignore_configure && xfc->focused)
|
||||
xf_rail_adjust_position(xfc, appWindow);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -719,14 +724,14 @@ static BOOL xf_event_MapNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
RECTANGLE_16 rect;
|
||||
xfAppWindow* appWindow;
|
||||
rdpUpdate* update = xfc->instance->update;
|
||||
rdpSettings* settings = xfc->context.settings;
|
||||
|
||||
if (!app)
|
||||
{
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = xfc->sessionWidth;
|
||||
rect.bottom = xfc->sessionHeight;
|
||||
|
||||
rect.right = settings->DesktopWidth;
|
||||
rect.bottom = settings->DesktopHeight;
|
||||
update->SuppressOutput((rdpContext*) xfc, 1, &rect);
|
||||
}
|
||||
else
|
||||
|
@ -736,12 +741,10 @@ static BOOL xf_event_MapNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
if (appWindow)
|
||||
{
|
||||
/* local restore event */
|
||||
|
||||
/* This is now handled as part of the PropertyNotify
|
||||
* Doing this here would inhibit the ability to restore a maximized window
|
||||
* that is minimized back to the maximized state
|
||||
*/
|
||||
|
||||
//xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
appWindow->is_mapped = TRUE;
|
||||
}
|
||||
|
@ -754,7 +757,6 @@ static BOOL xf_event_UnmapNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
{
|
||||
xfAppWindow* appWindow;
|
||||
rdpUpdate* update = xfc->instance->update;
|
||||
|
||||
xf_keyboard_release_all_keypress(xfc);
|
||||
|
||||
if (!app)
|
||||
|
@ -781,43 +783,45 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
* when the window has been minimized, maximized, restored locally
|
||||
* ie. not using the buttons on the rail window itself
|
||||
*/
|
||||
|
||||
if (app)
|
||||
{
|
||||
xfAppWindow* appWindow;
|
||||
|
||||
xfAppWindow* appWindow;
|
||||
appWindow = xf_AppWindowFromX11Window(xfc, event->xany.window);
|
||||
|
||||
if (!appWindow)
|
||||
return TRUE;
|
||||
|
||||
if ((((Atom) event->xproperty.atom == xfc->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) ||
|
||||
(((Atom) event->xproperty.atom == xfc->WM_STATE) && (event->xproperty.state != PropertyDelete)))
|
||||
{
|
||||
int i;
|
||||
BOOL status;
|
||||
BOOL maxVert = FALSE;
|
||||
BOOL maxHorz = FALSE;
|
||||
BOOL minimized = FALSE;
|
||||
unsigned long nitems;
|
||||
unsigned long bytes;
|
||||
unsigned char* prop;
|
||||
if ((((Atom) event->xproperty.atom == xfc->_NET_WM_STATE)
|
||||
&& (event->xproperty.state != PropertyDelete)) ||
|
||||
(((Atom) event->xproperty.atom == xfc->WM_STATE)
|
||||
&& (event->xproperty.state != PropertyDelete)))
|
||||
{
|
||||
int i;
|
||||
BOOL status;
|
||||
BOOL maxVert = FALSE;
|
||||
BOOL maxHorz = FALSE;
|
||||
BOOL minimized = FALSE;
|
||||
unsigned long nitems;
|
||||
unsigned long bytes;
|
||||
unsigned char* prop;
|
||||
|
||||
if ((Atom) event->xproperty.atom == xfc->_NET_WM_STATE)
|
||||
{
|
||||
if ((Atom) event->xproperty.atom == xfc->_NET_WM_STATE)
|
||||
{
|
||||
status = xf_GetWindowProperty(xfc, event->xproperty.window,
|
||||
xfc->_NET_WM_STATE, 12, &nitems, &bytes, &prop);
|
||||
xfc->_NET_WM_STATE, 12, &nitems, &bytes, &prop);
|
||||
|
||||
if (status)
|
||||
{
|
||||
for (i = 0; i < nitems; i++)
|
||||
{
|
||||
if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
|
||||
if ((Atom)((UINT16**) prop)[i] == XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_MAXIMIZED_VERT", False))
|
||||
{
|
||||
maxVert = TRUE;
|
||||
}
|
||||
|
||||
if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False))
|
||||
if ((Atom)((UINT16**) prop)[i] == XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_MAXIMIZED_HORZ", False))
|
||||
{
|
||||
maxHorz = TRUE;
|
||||
}
|
||||
|
@ -825,12 +829,12 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
|
||||
XFree(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((Atom) event->xproperty.atom == xfc->WM_STATE)
|
||||
{
|
||||
if ((Atom) event->xproperty.atom == xfc->WM_STATE)
|
||||
{
|
||||
status = xf_GetWindowProperty(xfc, event->xproperty.window,
|
||||
xfc->WM_STATE, 1, &nitems, &bytes, &prop);
|
||||
xfc->WM_STATE, 1, &nitems, &bytes, &prop);
|
||||
|
||||
if (status)
|
||||
{
|
||||
|
@ -842,30 +846,33 @@ static BOOL xf_event_PropertyNotify(xfContext* xfc, XEvent* event, BOOL app)
|
|||
|
||||
XFree(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (maxVert && maxHorz && !minimized && (appWindow->rail_state != WINDOW_SHOW_MAXIMIZED))
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MAXIMIZE);
|
||||
}
|
||||
else if (minimized && (appWindow->rail_state != WINDOW_SHOW_MINIMIZED))
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MINIMIZE);
|
||||
}
|
||||
else if (!minimized && !maxVert && !maxHorz && (appWindow->rail_state != WINDOW_SHOW))
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (maxVert && maxHorz && !minimized
|
||||
&& (appWindow->rail_state != WINDOW_SHOW_MAXIMIZED))
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MAXIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MAXIMIZE);
|
||||
}
|
||||
else if (minimized && (appWindow->rail_state != WINDOW_SHOW_MINIMIZED))
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW_MINIMIZED;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_MINIMIZE);
|
||||
}
|
||||
else if (!minimized && !maxVert && !maxHorz
|
||||
&& (appWindow->rail_state != WINDOW_SHOW))
|
||||
{
|
||||
appWindow->rail_state = WINDOW_SHOW;
|
||||
xf_rail_send_client_system_command(xfc, appWindow->windowId, SC_RESTORE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow, XEvent* event)
|
||||
static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow,
|
||||
XEvent* event)
|
||||
{
|
||||
if (!xfc->remote_app)
|
||||
return FALSE;
|
||||
|
@ -873,51 +880,56 @@ static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow, XEv
|
|||
switch (appWindow->local_move.state)
|
||||
{
|
||||
case LMS_NOT_ACTIVE:
|
||||
|
||||
/* No local move in progress, nothing to do */
|
||||
|
||||
/* Prevent Configure from happening during indeterminant state of Horz or Vert Max only */
|
||||
|
||||
if ((event->type == ConfigureNotify) && appWindow->rail_ignore_configure)
|
||||
{
|
||||
appWindow->rail_ignore_configure = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
if ((event->type == ConfigureNotify) && appWindow->rail_ignore_configure)
|
||||
{
|
||||
appWindow->rail_ignore_configure = FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LMS_STARTING:
|
||||
|
||||
/* Local move initiated by RDP server, but we have not yet seen any updates from the X server */
|
||||
switch (event->type)
|
||||
{
|
||||
case ConfigureNotify:
|
||||
/* Starting to see move events from the X server. Local move is now in progress. */
|
||||
appWindow->local_move.state = LMS_ACTIVE;
|
||||
|
||||
/* Allow these events to be processed during move to keep our state up to date. */
|
||||
break;
|
||||
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
case UnmapNotify:
|
||||
/*
|
||||
* A button release event means the X window server did not grab the
|
||||
* mouse before the user released it. In this case we must cancel the
|
||||
* local move. The event will be processed below as normal, below.
|
||||
*/
|
||||
break;
|
||||
/*
|
||||
* A button release event means the X window server did not grab the
|
||||
* mouse before the user released it. In this case we must cancel the
|
||||
* local move. The event will be processed below as normal, below.
|
||||
*/
|
||||
break;
|
||||
|
||||
case VisibilityNotify:
|
||||
case PropertyNotify:
|
||||
case Expose:
|
||||
/* Allow these events to pass */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Eat any other events */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LMS_ACTIVE:
|
||||
|
||||
/* Local move is in progress */
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -928,11 +940,13 @@ static BOOL xf_event_suppress_events(xfContext* xfc, xfAppWindow* appWindow, XEv
|
|||
case GravityNotify:
|
||||
/* Keep us up to date on position */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Any other event terminates move */
|
||||
xf_rail_end_local_move(xfc, appWindow);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LMS_TERMINATING:
|
||||
|
@ -967,7 +981,8 @@ BOOL xf_event_process(freerdp* instance, XEvent* event)
|
|||
xf_event_execute_action_script(xfc, event);
|
||||
|
||||
if (event->type != MotionNotify)
|
||||
DEBUG_X11("%s Event(%d): wnd=0x%04X", X11_EVENT_STRINGS[event->type], event->type, (UINT32) event->xany.window);
|
||||
DEBUG_X11("%s Event(%d): wnd=0x%04X", X11_EVENT_STRINGS[event->type],
|
||||
event->type, (UINT32) event->xany.window);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -1047,7 +1062,6 @@ BOOL xf_event_process(freerdp* instance, XEvent* event)
|
|||
case PropertyNotify:
|
||||
status = xf_event_PropertyNotify(xfc, event, xfc->remote_app);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (!xfc->remote_app)
|
||||
|
@ -1056,8 +1070,6 @@ BOOL xf_event_process(freerdp* instance, XEvent* event)
|
|||
}
|
||||
|
||||
xf_input_handle_event(xfc, event);
|
||||
|
||||
XSync(xfc->display, FALSE);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -268,39 +268,28 @@ static Pixmap xf_mono_bitmap_new(xfContext* xfc, int width, int height,
|
|||
BOOL xf_gdi_bitmap_update(rdpContext* context,
|
||||
const BITMAP_UPDATE* bitmapUpdate)
|
||||
{
|
||||
int nXDst;
|
||||
int nYDst;
|
||||
int nXSrc;
|
||||
int nYSrc;
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
UINT32 index;
|
||||
XImage* image;
|
||||
BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
UINT32 SrcSize;
|
||||
BOOL compressed;
|
||||
UINT32 SrcFormat;
|
||||
BITMAP_DATA* bitmap;
|
||||
rdpCodecs* codecs = context->codecs;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
rdpSettings* settings = context->settings;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
for (index = 0; index < bitmapUpdate->number; index++)
|
||||
{
|
||||
UINT32 bitsPerPixel;
|
||||
bitmap = &(bitmapUpdate->rectangles[index]);
|
||||
nXSrc = 0;
|
||||
nYSrc = 0;
|
||||
nXDst = bitmap->destLeft;
|
||||
nYDst = bitmap->destTop;
|
||||
nWidth = bitmap->width;
|
||||
nHeight = bitmap->height;
|
||||
pSrcData = bitmap->bitmapDataStream;
|
||||
SrcSize = bitmap->bitmapLength;
|
||||
compressed = bitmap->compressed;
|
||||
bitsPerPixel = bitmap->bitsPerPixel;
|
||||
SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
||||
BYTE* pDstData;
|
||||
XImage* image;
|
||||
BITMAP_DATA* bitmap = &(bitmapUpdate->rectangles[index]);
|
||||
UINT32 bitsPerPixel = bitmap->bitsPerPixel;
|
||||
UINT32 nXDst = bitmap->destLeft;
|
||||
UINT32 nYDst = bitmap->destTop;
|
||||
UINT32 nWidth = MIN(bitmap->destRight,
|
||||
settings->DesktopWidth - 1) - bitmap->destLeft + 1; /* clip width */
|
||||
UINT32 nHeight = MIN(bitmap->destBottom,
|
||||
settings->DesktopHeight - 1) - bitmap->destTop + 1; /* clip height */
|
||||
const BYTE* pSrcData = bitmap->bitmapDataStream;
|
||||
UINT32 SrcSize = bitmap->bitmapLength;
|
||||
BOOL compressed = bitmap->compressed;
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
|
@ -310,6 +299,7 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
|
|||
{
|
||||
if (!interleaved_decompress(codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bitmap->width, bitmap->height,
|
||||
bitsPerPixel,
|
||||
pDstData,
|
||||
xfc->format, 0,
|
||||
|
@ -320,7 +310,8 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!planar_decompress(codecs->planar, pSrcData, SrcSize, pDstData,
|
||||
if (!planar_decompress(codecs->planar, pSrcData, SrcSize,
|
||||
bitmap->width, bitmap->height, pDstData,
|
||||
xfc->format, 0, 0, 0, nWidth, nHeight, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
if (bpp < 32)
|
||||
{
|
||||
if (!interleaved_decompress(context->codecs->interleaved,
|
||||
pSrcData, SrcSize, bpp,
|
||||
pSrcData, SrcSize, width, height, bpp,
|
||||
pDstData, xfc->format,
|
||||
0, 0, 0, width, height,
|
||||
&context->gdi->palette))
|
||||
|
@ -160,6 +160,7 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
else
|
||||
{
|
||||
if (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,
|
||||
width, height,
|
||||
pDstData, xfc->format, 0, 0, 0, width, height, TRUE))
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -100,9 +100,7 @@ struct xf_context
|
|||
GC gc;
|
||||
int xfds;
|
||||
int depth;
|
||||
int sessionWidth;
|
||||
int sessionHeight;
|
||||
int srcBpp;
|
||||
|
||||
GC gc_mono;
|
||||
BOOL invert;
|
||||
UINT32 format;
|
||||
|
|
|
@ -44,10 +44,11 @@ extern "C" {
|
|||
|
||||
FREERDP_API BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
UINT32 bpp,
|
||||
BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
UINT32 nDstWidth, UINT32 nDstHeight,
|
||||
const gdiPalette* palette);
|
||||
|
||||
FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||
|
@ -57,8 +58,8 @@ FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const gdiPalette* palette, UINT32 bpp);
|
||||
|
||||
FREERDP_API BOOL bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT*
|
||||
interleaved);
|
||||
FREERDP_API BOOL bitmap_interleaved_context_reset(
|
||||
BITMAP_INTERLEAVED_CONTEXT* interleaved);
|
||||
|
||||
FREERDP_API BITMAP_INTERLEAVED_CONTEXT* bitmap_interleaved_context_new(
|
||||
BOOL Compressor);
|
||||
|
|
|
@ -119,9 +119,10 @@ FREERDP_API void freerdp_bitmap_planar_context_free(
|
|||
|
||||
FREERDP_API BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, BOOL vFlip);
|
||||
UINT32 nDstWidth, UINT32 nDstHeight, BOOL vFlip);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -294,7 +294,6 @@ struct rdp_gdi
|
|||
gdiBitmap* drawing;
|
||||
UINT32 bitmap_size;
|
||||
UINT32 bitmap_stride;
|
||||
BYTE* bitmap_buffer;
|
||||
BYTE* primary_buffer;
|
||||
gdiPalette palette;
|
||||
gdiBitmap* image;
|
||||
|
|
|
@ -24,19 +24,21 @@
|
|||
#include <freerdp/gdi/gdi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
FREERDP_API BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
|
||||
FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr);
|
||||
FREERDP_API BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount);
|
||||
FREERDP_API BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount);
|
||||
FREERDP_API BOOL gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
|
||||
|
||||
typedef BOOL (*p_FillRect)(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr);
|
||||
FREERDP_API BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect,
|
||||
int nRightRect, int nBottomRect);
|
||||
FREERDP_API BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect,
|
||||
HGDI_BRUSH hbr);
|
||||
FREERDP_API BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT* lpPoints, int nCount);
|
||||
FREERDP_API BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT* lpPoints,
|
||||
int* lpPolyCounts, int nCount);
|
||||
FREERDP_API BOOL gdi_Rectangle(HGDI_DC hdc, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_GDI_SHAPE_H */
|
||||
|
|
|
@ -265,10 +265,11 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, const BYTE* pbOrderHdr,
|
|||
|
||||
BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
UINT32 bpp,
|
||||
BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
UINT32 nDstWidth, UINT32 nDstHeight,
|
||||
const gdiPalette* palette)
|
||||
{
|
||||
UINT32 scanline;
|
||||
|
@ -283,27 +284,27 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||
return FALSE;
|
||||
|
||||
if (nDstStep <= 0)
|
||||
nDstStep = nWidth * dstBytesPerPixel;
|
||||
nDstStep = nDstWidth * dstBytesPerPixel;
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 24:
|
||||
scanline = nWidth * 3;
|
||||
scanline = nSrcWidth * 3;
|
||||
SrcFormat = PIXEL_FORMAT_BGR24_VF;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
scanline = nWidth * 2;
|
||||
scanline = nSrcWidth * 2;
|
||||
SrcFormat = PIXEL_FORMAT_RGB16_VF;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
scanline = nWidth * 2;
|
||||
scanline = nSrcWidth * 2;
|
||||
SrcFormat = PIXEL_FORMAT_RGB15_VF;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
scanline = nWidth;
|
||||
scanline = nSrcWidth;
|
||||
SrcFormat = PIXEL_FORMAT_RGB8_VF;
|
||||
break;
|
||||
|
||||
|
@ -312,7 +313,7 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BufferSize = scanline * nHeight;
|
||||
BufferSize = scanline * nSrcHeight;
|
||||
|
||||
if (BufferSize > interleaved->TempSize)
|
||||
{
|
||||
|
@ -329,18 +330,18 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||
{
|
||||
case 24:
|
||||
RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nWidth, nHeight);
|
||||
scanline, nSrcWidth, nSrcHeight);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
case 15:
|
||||
RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nWidth, nHeight);
|
||||
scanline, nSrcWidth, nSrcHeight);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer,
|
||||
scanline, nWidth, nHeight);
|
||||
scanline, nSrcWidth, nSrcHeight);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -348,7 +349,7 @@ BOOL interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
|
|||
}
|
||||
|
||||
return freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
|
||||
nWidth, nHeight, interleaved->TempBuffer,
|
||||
nDstWidth, nDstHeight, interleaved->TempBuffer,
|
||||
SrcFormat, scanline, 0, 0, palette);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,9 +43,9 @@ static BOOL freerdp_bitmap_planar_delta_encode_planes(
|
|||
BYTE* outPlanes[4]);
|
||||
|
||||
static INT32 planar_skip_plane_rle(const BYTE* pSrcData, UINT32 SrcSize,
|
||||
int nWidth, int nHeight)
|
||||
UINT32 nDstWidth, UINT32 nDstHeight)
|
||||
{
|
||||
int x, y;
|
||||
UINT32 x, y;
|
||||
int cRawBytes;
|
||||
int nRunLength;
|
||||
BYTE controlByte;
|
||||
|
@ -287,9 +287,10 @@ static BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4],
|
|||
|
||||
BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
BYTE* pDstData, UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, BOOL vFlip)
|
||||
UINT32 nDstWidth, UINT32 nDstHeight, BOOL vFlip)
|
||||
{
|
||||
BOOL cs;
|
||||
BOOL rle;
|
||||
|
@ -310,19 +311,21 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
UINT32 dstBytesPerPixel;
|
||||
const BYTE* planes[4];
|
||||
UINT32 UncompressedSize;
|
||||
const UINT32 w = MIN(nSrcWidth, nDstWidth);
|
||||
const UINT32 h = MIN(nSrcHeight, nDstHeight);
|
||||
const primitives_t* prims = primitives_get();
|
||||
|
||||
if ((nWidth < 0) || (nHeight < 0))
|
||||
if ((nSrcWidth < 0) || (nSrcHeight < 0))
|
||||
return FALSE;
|
||||
|
||||
dstBitsPerPixel = GetBitsPerPixel(DstFormat);
|
||||
dstBytesPerPixel = GetBytesPerPixel(DstFormat);
|
||||
|
||||
if (nDstStep <= 0)
|
||||
nDstStep = nWidth * GetBytesPerPixel(DstFormat);
|
||||
nDstStep = nDstWidth * GetBytesPerPixel(DstFormat);
|
||||
|
||||
srcp = pSrcData;
|
||||
UncompressedSize = nWidth * nHeight * GetBytesPerPixel(DstFormat);
|
||||
UncompressedSize = nSrcWidth * nSrcHeight * GetBytesPerPixel(DstFormat);
|
||||
|
||||
if (!pDstData)
|
||||
{
|
||||
|
@ -341,31 +344,31 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
if (!cll && cs)
|
||||
return FALSE; /* Chroma subsampling requires YCoCg */
|
||||
|
||||
subWidth = (nWidth / 2) + (nWidth % 2);
|
||||
subHeight = (nHeight / 2) + (nHeight % 2);
|
||||
planeSize = nWidth * nHeight;
|
||||
subWidth = (nSrcWidth / 2) + (nSrcWidth % 2);
|
||||
subHeight = (nSrcHeight / 2) + (nSrcHeight % 2);
|
||||
planeSize = nSrcWidth * nSrcHeight;
|
||||
subSize = subWidth * subHeight;
|
||||
|
||||
if (!cs)
|
||||
{
|
||||
rawSizes[0] = planeSize; /* LumaOrRedPlane */
|
||||
rawWidths[0] = nWidth;
|
||||
rawHeights[0] = nHeight;
|
||||
rawWidths[0] = nSrcWidth;
|
||||
rawHeights[0] = nSrcHeight;
|
||||
rawSizes[1] = planeSize; /* OrangeChromaOrGreenPlane */
|
||||
rawWidths[1] = nWidth;
|
||||
rawHeights[1] = nHeight;
|
||||
rawWidths[1] = nSrcWidth;
|
||||
rawHeights[1] = nSrcHeight;
|
||||
rawSizes[2] = planeSize; /* GreenChromaOrBluePlane */
|
||||
rawWidths[2] = nWidth;
|
||||
rawHeights[2] = nHeight;
|
||||
rawWidths[2] = nSrcWidth;
|
||||
rawHeights[2] = nSrcHeight;
|
||||
rawSizes[3] = planeSize; /* AlphaPlane */
|
||||
rawWidths[3] = nWidth;
|
||||
rawHeights[3] = nHeight;
|
||||
rawWidths[3] = nSrcWidth;
|
||||
rawHeights[3] = nSrcHeight;
|
||||
}
|
||||
else /* Chroma Subsampling */
|
||||
{
|
||||
rawSizes[0] = planeSize; /* LumaOrRedPlane */
|
||||
rawWidths[0] = nWidth;
|
||||
rawHeights[0] = nHeight;
|
||||
rawWidths[0] = nSrcWidth;
|
||||
rawHeights[0] = nSrcHeight;
|
||||
rawSizes[1] = subSize; /* OrangeChromaOrGreenPlane */
|
||||
rawWidths[1] = subWidth;
|
||||
rawHeights[1] = subHeight;
|
||||
|
@ -373,8 +376,8 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
rawWidths[2] = subWidth;
|
||||
rawHeights[2] = subHeight;
|
||||
rawSizes[3] = planeSize; /* AlphaPlane */
|
||||
rawWidths[3] = nWidth;
|
||||
rawHeights[3] = nHeight;
|
||||
rawWidths[3] = nSrcWidth;
|
||||
rawHeights[3] = nSrcHeight;
|
||||
}
|
||||
|
||||
if (!rle) /* RAW */
|
||||
|
@ -461,20 +464,35 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
|
||||
if (!cll) /* RGB */
|
||||
{
|
||||
UINT32 TempFormat;
|
||||
BYTE* pTempData = pDstData;
|
||||
UINT32 nTempStep = nDstStep;
|
||||
|
||||
if (alpha)
|
||||
TempFormat = PIXEL_FORMAT_BGRA32;
|
||||
else
|
||||
TempFormat = PIXEL_FORMAT_BGRX32;
|
||||
|
||||
if ((DstFormat != TempFormat) || (nSrcWidth != nDstWidth)
|
||||
|| (nSrcHeight != nDstHeight))
|
||||
{
|
||||
pTempData = planar->pTempData;
|
||||
}
|
||||
|
||||
if (!rle) /* RAW */
|
||||
{
|
||||
if (alpha)
|
||||
{
|
||||
if (!planar_decompress_planes_raw(planes, pDstData, DstFormat, nDstStep,
|
||||
nXDst, nYDst, nWidth, nHeight, alpha, vFlip))
|
||||
if (!planar_decompress_planes_raw(planes, pTempData, DstFormat, nDstStep,
|
||||
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
|
||||
return FALSE;
|
||||
|
||||
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3];
|
||||
}
|
||||
else /* NoAlpha */
|
||||
{
|
||||
if (!planar_decompress_planes_raw(planes, pDstData, DstFormat, nDstStep,
|
||||
nXDst, nYDst, nWidth, nHeight, alpha, vFlip))
|
||||
if (!planar_decompress_planes_raw(planes, pTempData, DstFormat, nDstStep,
|
||||
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
|
||||
return FALSE;
|
||||
|
||||
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2];
|
||||
|
@ -485,45 +503,31 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
}
|
||||
else /* RLE */
|
||||
{
|
||||
UINT32 TempFormat;
|
||||
BYTE* pTempData = pDstData;
|
||||
UINT32 nTempStep = nDstStep;
|
||||
|
||||
if (alpha)
|
||||
TempFormat = PIXEL_FORMAT_BGRA32;
|
||||
else
|
||||
TempFormat = PIXEL_FORMAT_BGRX32;
|
||||
|
||||
if (DstFormat != TempFormat)
|
||||
{
|
||||
pTempData = planar->pTempData;
|
||||
}
|
||||
|
||||
if (alpha)
|
||||
{
|
||||
status = planar_decompress_plane_rle(planes[3], rleSizes[3],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 3,
|
||||
vFlip); /* AlphaPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
|
||||
vFlip); /* RedPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
|
||||
vFlip); /* GreenPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
|
||||
vFlip); /* BluePlane */
|
||||
|
||||
if (status < 0)
|
||||
|
@ -534,21 +538,21 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
else /* NoAlpha */
|
||||
{
|
||||
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
|
||||
vFlip); /* RedPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
|
||||
vFlip); /* GreenPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
|
||||
vFlip); /* BluePlane */
|
||||
|
||||
if (status < 0)
|
||||
|
@ -556,15 +560,14 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
|
||||
srcp += rleSizes[0] + rleSizes[1] + rleSizes[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (pTempData != pDstData)
|
||||
{
|
||||
if (!freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, nWidth,
|
||||
nHeight,
|
||||
pTempData,
|
||||
TempFormat, nTempStep, nXDst, nYDst, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
if (pTempData != pDstData)
|
||||
{
|
||||
if (!freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst, w,
|
||||
h, pTempData,
|
||||
TempFormat, nTempStep, nXDst, nYDst, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else /* YCoCg */
|
||||
|
@ -587,7 +590,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
if (alpha)
|
||||
{
|
||||
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep,
|
||||
nXDst, nYDst, nWidth, nHeight, alpha, vFlip))
|
||||
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
|
||||
return FALSE;
|
||||
|
||||
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2] + rawSizes[3];
|
||||
|
@ -595,7 +598,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
else /* NoAlpha */
|
||||
{
|
||||
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep,
|
||||
nXDst, nYDst, nWidth, nHeight, alpha, vFlip))
|
||||
nXDst, nYDst, nSrcWidth, nSrcHeight, alpha, vFlip))
|
||||
return FALSE;
|
||||
|
||||
srcp += rawSizes[0] + rawSizes[1] + rawSizes[2];
|
||||
|
@ -609,28 +612,28 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
if (alpha)
|
||||
{
|
||||
status = planar_decompress_plane_rle(planes[3], rleSizes[3],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 3,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 3,
|
||||
vFlip); /* AlphaPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
|
||||
vFlip); /* LumaPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
|
||||
vFlip); /* OrangeChromaPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
|
||||
vFlip); /* GreenChromaPlane */
|
||||
|
||||
if (status < 0)
|
||||
|
@ -641,21 +644,21 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
else /* NoAlpha */
|
||||
{
|
||||
status = planar_decompress_plane_rle(planes[0], rleSizes[0],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 2,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 2,
|
||||
vFlip); /* LumaPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[1], rleSizes[1],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 1,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 1,
|
||||
vFlip); /* OrangeChromaPlane */
|
||||
|
||||
if (status < 0)
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress_plane_rle(planes[2], rleSizes[2],
|
||||
pTempData, nTempStep, nXDst, nYDst, nWidth, nHeight, 0,
|
||||
pTempData, nTempStep, nXDst, nYDst, nSrcWidth, nSrcHeight, 0,
|
||||
vFlip); /* GreenChromaPlane */
|
||||
|
||||
if (status < 0)
|
||||
|
@ -665,8 +668,10 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar,
|
|||
}
|
||||
}
|
||||
|
||||
prims->YCoCgToRGB_8u_AC4R(pTempData, nTempStep, pDstData, DstFormat, nDstStep,
|
||||
nWidth, nHeight, cll, alpha);
|
||||
if (prims->YCoCgToRGB_8u_AC4R(pTempData, nTempStep, pDstData, DstFormat,
|
||||
nDstStep,
|
||||
w, h, cll, alpha) != PRIMITIVES_SUCCESS)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return (SrcSize == (srcp - pSrcData)) ? TRUE : FALSE;
|
||||
|
|
|
@ -3007,7 +3007,8 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
|||
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, pDstData,
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize,
|
||||
width, height, pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE))
|
||||
{
|
||||
printf("failed to decompress white bitmap: width: %d height: %d\n", width,
|
||||
|
@ -3054,7 +3055,8 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
|||
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, pDstData,
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize,
|
||||
width, height, pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE))
|
||||
{
|
||||
printf("failed to decompress black bitmap: width: %d height: %d\n", width,
|
||||
|
@ -3096,7 +3098,8 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
|||
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, pDstData,
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, width, height,
|
||||
pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE))
|
||||
{
|
||||
printf("failed to decompress experimental bitmap 01: width: %d height: %d\n",
|
||||
|
@ -3142,7 +3145,8 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
|||
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, pDstData,
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, width, height,
|
||||
pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE))
|
||||
{
|
||||
printf("failed to decompress experimental bitmap 02: width: %d height: %d\n",
|
||||
|
@ -3189,7 +3193,8 @@ int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
|||
|
||||
pDstData = decompressedBitmap;
|
||||
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, pDstData,
|
||||
if (!planar_decompress(planar, compressedBitmap, dstSize, width, height,
|
||||
pDstData,
|
||||
PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, FALSE))
|
||||
{
|
||||
printf("failed to decompress experimental bitmap 03: width: %d height: %d\n",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -491,8 +491,10 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
|||
UINT32 nYSrc = 0;
|
||||
UINT32 nXDst = bitmap->destLeft;
|
||||
UINT32 nYDst = bitmap->destTop;
|
||||
UINT32 nWidth = bitmap->width;
|
||||
UINT32 nHeight = bitmap->height;
|
||||
UINT32 nWidth = MIN(bitmap->destRight,
|
||||
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
|
||||
UINT32 nHeight = MIN(bitmap->destBottom,
|
||||
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
|
||||
const BYTE* pSrcData = bitmap->bitmapDataStream;
|
||||
UINT32 SrcSize = bitmap->bitmapLength;
|
||||
BOOL compressed = bitmap->compressed;
|
||||
|
@ -504,6 +506,7 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
|||
{
|
||||
if (!interleaved_decompress(codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bitmap->width, bitmap->height,
|
||||
bitsPerPixel,
|
||||
gdi->primary_buffer,
|
||||
gdi->primary->hdc->format,
|
||||
|
@ -515,7 +518,8 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
|||
else
|
||||
{
|
||||
if (!planar_decompress(codecs->planar, pSrcData,
|
||||
SrcSize, gdi->primary_buffer,
|
||||
SrcSize, bitmap->width, bitmap->height,
|
||||
gdi->primary_buffer,
|
||||
gdi->primary->hdc->format,
|
||||
gdi->stride,
|
||||
nXDst, nYDst, nWidth, nHeight, TRUE))
|
||||
|
@ -526,10 +530,6 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
|||
{
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
|
||||
UINT32 nSrcStep = nWidth * GetBytesPerPixel(SrcFormat);
|
||||
nWidth = MIN(bitmap->destRight,
|
||||
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
|
||||
nHeight = MIN(bitmap->destBottom,
|
||||
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
|
||||
|
||||
if (!freerdp_image_copy(gdi->primary_buffer, gdi->primary->hdc->format,
|
||||
gdi->stride,
|
||||
|
@ -1117,7 +1117,7 @@ static BOOL gdi_surface_bits(rdpContext* context,
|
|||
PIXEL_FORMAT_BGRX32,
|
||||
cmd->bitmapDataLength,
|
||||
0, 0,
|
||||
gdi->bitmap_buffer, gdi->dstFormat,
|
||||
gdi->primary_buffer, gdi->dstFormat,
|
||||
cmd->width * GetBytesPerPixel(gdi->dstFormat),
|
||||
cmd->height, NULL))
|
||||
{
|
||||
|
|
|
@ -330,6 +330,7 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
DstData = surface->data;
|
||||
|
||||
if (!planar_decompress(surface->codecs->planar, cmd->data, cmd->length,
|
||||
cmd->width, cmd->height,
|
||||
DstData, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, FALSE))
|
||||
|
|
|
@ -138,6 +138,8 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
UINT32 SrcSize = length;
|
||||
UINT32 SrcFormat;
|
||||
UINT32 bytesPerPixel;
|
||||
UINT32 DstWidth = MIN(width, bitmap->width);
|
||||
UINT32 DstHeight = MIN(height, bitmap->height);
|
||||
rdpGdi* gdi = context->gdi;
|
||||
bytesPerPixel = (bpp + 7) / 8;
|
||||
size = width * height * GetBytesPerPixel(gdi->dstFormat);
|
||||
|
@ -156,15 +158,17 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
{
|
||||
if (!interleaved_decompress(context->codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
width, height,
|
||||
bpp,
|
||||
bitmap->data, bitmap->format,
|
||||
0, 0, 0, width, height,
|
||||
0, 0, 0, DstWidth, DstHeight,
|
||||
&gdi->palette))
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,
|
||||
width, height,
|
||||
bitmap->data, bitmap->format, 0, 0, 0,
|
||||
width, height, TRUE))
|
||||
return FALSE;
|
||||
|
@ -175,7 +179,7 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
||||
|
||||
if (!freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,
|
||||
width, height, pSrcData, SrcFormat,
|
||||
DstWidth, DstHeight, pSrcData, SrcFormat,
|
||||
0, 0, 0, &gdi->palette))
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -47,101 +47,106 @@
|
|||
*/
|
||||
static BOOL gdi_rop_color(UINT32 rop, BYTE* pixelPtr, UINT32 pen, UINT32 format)
|
||||
{
|
||||
UINT32 dstPixel;
|
||||
const UINT32 srcPixel = ReadColor(pixelPtr, format);
|
||||
UINT32 pixel = ReadColor(pixelPtr, format);
|
||||
|
||||
switch (rop)
|
||||
{
|
||||
case GDI_R2_BLACK: /* LineTo_BLACK */
|
||||
dstPixel = GetColor(format, 0, 0, 0, 0xFF);
|
||||
pixel = GetColor(format, 0, 0, 0, 0xFF);
|
||||
break;
|
||||
|
||||
case GDI_R2_NOTMERGEPEN: /* LineTo_NOTMERGEPEN */
|
||||
dstPixel = ~(srcPixel | pen);
|
||||
pixel = ~(pixel | pen);
|
||||
break;
|
||||
|
||||
case GDI_R2_MASKNOTPEN: /* LineTo_MASKNOTPEN */
|
||||
dstPixel = srcPixel & ~pen;
|
||||
pixel &= ~pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_NOTCOPYPEN: /* LineTo_NOTCOPYPEN */
|
||||
dstPixel = ~pen;
|
||||
pixel = ~pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_MASKPENNOT: /* LineTo_MASKPENNOT */
|
||||
dstPixel = pen & ~srcPixel;
|
||||
pixel = pen & ~pixel;
|
||||
break;
|
||||
|
||||
case GDI_R2_NOT: /* LineTo_NOT */
|
||||
dstPixel = ~srcPixel;
|
||||
pixel = ~pixel;
|
||||
break;
|
||||
|
||||
case GDI_R2_XORPEN: /* LineTo_XORPEN */
|
||||
dstPixel = srcPixel ^ pen;
|
||||
pixel = pixel ^ pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_NOTMASKPEN: /* LineTo_NOTMASKPEN */
|
||||
dstPixel = ~(srcPixel & pen);
|
||||
pixel = ~(pixel & pen);
|
||||
break;
|
||||
|
||||
case GDI_R2_MASKPEN: /* LineTo_MASKPEN */
|
||||
dstPixel = srcPixel & pen;
|
||||
pixel &= pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_NOTXORPEN: /* LineTo_NOTXORPEN */
|
||||
dstPixel = ~(srcPixel ^ pen);
|
||||
pixel = ~(pixel ^ pen);
|
||||
break;
|
||||
|
||||
case GDI_R2_NOP: /* LineTo_NOP */
|
||||
break;
|
||||
|
||||
case GDI_R2_MERGENOTPEN: /* LineTo_MERGENOTPEN */
|
||||
dstPixel = srcPixel | ~pen;
|
||||
pixel |= ~pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_COPYPEN: /* LineTo_COPYPEN */
|
||||
dstPixel = pen;
|
||||
pixel = pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_MERGEPENNOT: /* LineTo_MERGEPENNOT */
|
||||
dstPixel = srcPixel | ~pen;
|
||||
pixel = pixel | ~pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_MERGEPEN: /* LineTo_MERGEPEN */
|
||||
dstPixel = srcPixel | pen;
|
||||
pixel = pixel | pen;
|
||||
break;
|
||||
|
||||
case GDI_R2_WHITE: /* LineTo_WHITE */
|
||||
dstPixel = GetColor(format, 0, 0, 0, 0xFF);
|
||||
pixel = GetColor(format, 0, 0, 0, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WriteColor(pixelPtr, format, dstPixel);
|
||||
WriteColor(pixelPtr, format, pixel);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL gdi_LineTo(HGDI_DC hdc, UINT32 nXEnd, UINT32 nYEnd)
|
||||
{
|
||||
INT64 e2;
|
||||
INT64 bx1, by1;
|
||||
INT64 bx2, by2;
|
||||
HGDI_BITMAP bmp = (HGDI_BITMAP) hdc->selectedObject;
|
||||
UINT32 x, y;
|
||||
UINT32 x1, y1;
|
||||
UINT32 x2, y2;
|
||||
INT32 e, e2;
|
||||
INT32 dx, dy;
|
||||
INT32 sx, sy;
|
||||
INT32 bx1, by1;
|
||||
INT32 bx2, by2;
|
||||
HGDI_BITMAP bmp;
|
||||
UINT32 pen;
|
||||
UINT32 rop2 = gdi_GetROP2(hdc);
|
||||
UINT32 x1 = hdc->pen->posX;
|
||||
UINT32 y1 = hdc->pen->posY;
|
||||
UINT32 x2 = nXEnd;
|
||||
UINT32 y2 = nYEnd;
|
||||
INT64 dx = (x1 > x2) ? x1 - x2 : x2 - x1;
|
||||
INT64 dy = (y1 > y2) ? y1 - y2 : y2 - y1;
|
||||
INT64 sx = (x1 < x2) ? 1 : -1;
|
||||
INT64 sy = (y1 < y2) ? 1 : -1;
|
||||
INT64 e = dx - dy;
|
||||
UINT32 x = x1;
|
||||
UINT32 y = y1;
|
||||
x1 = hdc->pen->posX;
|
||||
y1 = hdc->pen->posY;
|
||||
x2 = nXEnd;
|
||||
y2 = nYEnd;
|
||||
dx = (x1 > x2) ? x1 - x2 : x2 - x1;
|
||||
dy = (y1 > y2) ? y1 - y2 : y2 - y1;
|
||||
sx = (x1 < x2) ? 1 : -1;
|
||||
sy = (y1 < y2) ? 1 : -1;
|
||||
e = dx - dy;
|
||||
x = x1;
|
||||
y = y1;
|
||||
bmp = (HGDI_BITMAP) hdc->selectedObject;
|
||||
|
||||
if (hdc->clip->null)
|
||||
{
|
||||
|
|
|
@ -45,11 +45,9 @@ static void Ellipse_Bresenham(HGDI_DC hdc, int x1, int y1, int x2, int y2)
|
|||
INT32 e, e2;
|
||||
INT32 dx, dy;
|
||||
INT32 a, b, c;
|
||||
|
||||
a = (x1 < x2) ? x2 - x1 : x1 - x2;
|
||||
b = (y1 < y2) ? y2 - y1 : y1 - y2;
|
||||
c = b & 1;
|
||||
|
||||
dx = 4 * (1 - a) * b * b;
|
||||
dy = 4 * (c + 1) * a * a;
|
||||
e = dx + dy + c * a * a;
|
||||
|
@ -65,7 +63,6 @@ static void Ellipse_Bresenham(HGDI_DC hdc, int x1, int y1, int x2, int y2)
|
|||
|
||||
y1 += (b + 1) / 2;
|
||||
y2 = y1 - c;
|
||||
|
||||
a *= 8 * a;
|
||||
c = 8 * b * b;
|
||||
|
||||
|
@ -75,7 +72,6 @@ static void Ellipse_Bresenham(HGDI_DC hdc, int x1, int y1, int x2, int y2)
|
|||
gdi_SetPixel(hdc, x1, y1, 0);
|
||||
gdi_SetPixel(hdc, x1, y2, 0);
|
||||
gdi_SetPixel(hdc, x2, y2, 0);
|
||||
|
||||
e2 = 2 * e;
|
||||
|
||||
if (e2 >= dx)
|
||||
|
@ -111,7 +107,8 @@ static void Ellipse_Bresenham(HGDI_DC hdc, int x1, int y1, int x2, int y2)
|
|||
* @param nBottomRect y2
|
||||
* @return nonzero if successful, 0 otherwise
|
||||
*/
|
||||
BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
BOOL gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect,
|
||||
int nBottomRect)
|
||||
{
|
||||
Ellipse_Bresenham(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect);
|
||||
return TRUE;
|
||||
|
@ -132,7 +129,6 @@ BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr)
|
|||
UINT32 color;
|
||||
UINT32 nXDest, nYDest;
|
||||
UINT32 nWidth, nHeight;
|
||||
|
||||
gdi_RectToCRgn(rect, &nXDest, &nYDest, &nWidth, &nHeight);
|
||||
|
||||
if (!gdi_ClipCoords(hdc, &nXDest, &nYDest, &nWidth, &nHeight, NULL, NULL))
|
||||
|
@ -145,7 +141,8 @@ BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr)
|
|||
for (x = 0; x < nWidth; x++)
|
||||
{
|
||||
BYTE* dstp = gdi_get_bitmap_pointer(hdc, nXDest + x,
|
||||
nYDest + y);
|
||||
nYDest + y);
|
||||
|
||||
if (dstp)
|
||||
WriteColor(dstp, hdc->format, color);
|
||||
}
|
||||
|
@ -166,7 +163,7 @@ BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr)
|
|||
* @param nCount number of points
|
||||
* @return nonzero if successful, 0 otherwise
|
||||
*/
|
||||
BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount)
|
||||
BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT* lpPoints, int nCount)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented!");
|
||||
return FALSE;
|
||||
|
@ -181,24 +178,52 @@ BOOL gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount)
|
|||
* @param nCount count of number of points in lpPolyCounts
|
||||
* @return nonzero if successful, 0 otherwise
|
||||
*/
|
||||
BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount)
|
||||
BOOL gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT* lpPoints, int* lpPolyCounts,
|
||||
int nCount)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
* @msdn{dd162898}
|
||||
* @param hdc device context
|
||||
* @param nLeftRect x1
|
||||
* @param nTopRect y1
|
||||
* @param nRightRect x2
|
||||
* @param nBottomRect y2
|
||||
* @return nonzero if successful, 0 otherwise
|
||||
*/
|
||||
BOOL gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect)
|
||||
BOOL gdi_Rectangle(HGDI_DC hdc, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth,
|
||||
UINT32 nHeight)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented!");
|
||||
UINT32 x, y;
|
||||
UINT32 color;
|
||||
|
||||
if (!gdi_ClipCoords(hdc, &nXDst, &nYDst, &nWidth, &nHeight, NULL, NULL))
|
||||
return TRUE;
|
||||
|
||||
color = hdc->textColor;
|
||||
color = GetColor(hdc->format, 0, 0xFF, 0, 0xFF);
|
||||
|
||||
for (y = 0; y < nHeight; y++)
|
||||
{
|
||||
BYTE* dstLeft = gdi_get_bitmap_pointer(hdc, nXDst,
|
||||
nYDst + y);
|
||||
BYTE* dstRight = gdi_get_bitmap_pointer(hdc, nXDst + nWidth - 1,
|
||||
nYDst + y);
|
||||
|
||||
if (dstLeft)
|
||||
WriteColor(dstLeft, hdc->format, color);
|
||||
|
||||
if (dstRight)
|
||||
WriteColor(dstRight, hdc->format, color);
|
||||
}
|
||||
|
||||
for (x = 0; x < nWidth; x++)
|
||||
{
|
||||
BYTE* dstTop = gdi_get_bitmap_pointer(hdc, nXDst + x,
|
||||
nYDst);
|
||||
BYTE* dstBottom = gdi_get_bitmap_pointer(hdc, nXDst + x,
|
||||
nYDst + nHeight - 1);
|
||||
|
||||
if (dstTop)
|
||||
WriteColor(dstTop, hdc->format, color);
|
||||
|
||||
if (dstBottom)
|
||||
WriteColor(dstBottom, hdc->format, color);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue