mirror of https://github.com/FreeRDP/FreeRDP
xfreerdp-client: fixes to xrender operations
This commit is contained in:
parent
41a7d33891
commit
0db2e9cbf4
|
@ -101,7 +101,7 @@ static BOOL xf_event_Expose(xfInfo* xfi, XEvent* event, BOOL app)
|
|||
|
||||
if (xfi->scale != 1.0)
|
||||
{
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -212,8 +212,8 @@ void xf_input_detect_pinch(xfInfo* xfi)
|
|||
{
|
||||
xfi->scale += 0.05;
|
||||
|
||||
if (xfi->scale > 1.2)
|
||||
xfi->scale = 1.2;
|
||||
if (xfi->scale > 1.5)
|
||||
xfi->scale = 1.5;
|
||||
|
||||
XResizeWindow(xfi->display, xfi->window->handle, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
|
||||
IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
|
||||
|
|
|
@ -132,13 +132,14 @@ void xf_transform_window(xfInfo* xfi)
|
|||
}
|
||||
}
|
||||
|
||||
void xf_draw_screen_scaled(xfInfo* xfi)
|
||||
void xf_draw_screen_scaled(xfInfo* xfi, int x, int y, int w, int h)
|
||||
{
|
||||
XTransform transform;
|
||||
Picture windowPicture;
|
||||
Picture primaryPicture;
|
||||
XRenderPictureAttributes pa;
|
||||
XRenderPictFormat* picFormat;
|
||||
XRectangle xr;
|
||||
|
||||
picFormat = XRenderFindStandardFormat(xfi->display, PictStandardRGB24);
|
||||
pa.subwindow_mode = IncludeInferiors;
|
||||
|
@ -157,10 +158,23 @@ void xf_draw_screen_scaled(xfInfo* xfi)
|
|||
transform.matrix[2][1] = XDoubleToFixed(0);
|
||||
transform.matrix[2][2] = XDoubleToFixed(xfi->scale);
|
||||
|
||||
if( (w != 0) && (h != 0) )
|
||||
{
|
||||
xr.x = x * xfi->scale;
|
||||
xr.y = y * xfi->scale;
|
||||
xr.width = (w+1) * xfi->scale;
|
||||
xr.height = (h+1) * xfi->scale;
|
||||
|
||||
XRenderSetPictureClipRectangles(xfi->display, primaryPicture, 0, 0, &xr, 1);
|
||||
}
|
||||
|
||||
XRenderSetPictureTransform(xfi->display, primaryPicture, &transform);
|
||||
//XRenderComposite(xfi->display, PictOpSrc, primaryPicture, 0, windowPicture, 0, 0, 0, 0, 0, 0, xfi->currentWidth, xfi->currentHeight);
|
||||
XRenderComposite(xfi->display, PictOpSrc, primaryPicture, 0, windowPicture, 0, 0, 0, 0, xfi->offset_x, xfi->offset_y, xfi->currentWidth, xfi->currentHeight);
|
||||
|
||||
XRenderFreePicture(xfi->display, primaryPicture);
|
||||
XRenderFreePicture(xfi->display, windowPicture);
|
||||
|
||||
}
|
||||
|
||||
void xf_context_new(freerdp* instance, rdpContext* context)
|
||||
|
@ -208,7 +222,7 @@ void xf_sw_end_paint(rdpContext* context)
|
|||
|
||||
if (xfi->scale != 1.0)
|
||||
{
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -243,7 +257,7 @@ void xf_sw_end_paint(rdpContext* context)
|
|||
|
||||
if (xfi->scale != 1.0)
|
||||
{
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -334,7 +348,7 @@ void xf_hw_end_paint(rdpContext* context)
|
|||
|
||||
if (xfi->scale != 1.0)
|
||||
{
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -366,16 +380,7 @@ void xf_hw_end_paint(rdpContext* context)
|
|||
|
||||
if(xfi->scale != 1.0)
|
||||
{
|
||||
xf_draw_screen_scaled(xfi);
|
||||
}
|
||||
else
|
||||
{
|
||||
XCopyArea(xfi->display, xfi->primary, xfi->drawable, xfi->gc, x, y, w, h, x, y);
|
||||
}
|
||||
|
||||
if (xfi->scale != 1.0)
|
||||
{
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1656,7 +1661,7 @@ void freerdp_client_reset_scale(xfInfo* xfi)
|
|||
|
||||
XResizeWindow(xfi->display, xfi->window->handle, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
|
||||
IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
xfInfo* freerdp_client_new(int argc, char** argv)
|
||||
|
|
|
@ -225,8 +225,8 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
//Zoom in (scale larger)
|
||||
double s = xfi->scale;
|
||||
s += 0.1;
|
||||
if(s > 1.2)
|
||||
s = 1.2;
|
||||
if(s > 2.0)
|
||||
s = 2.0;
|
||||
|
||||
xfi->scale = s;
|
||||
|
||||
|
@ -236,7 +236,7 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
xf_transform_window(xfi);
|
||||
|
||||
IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->currentWidth, xfi->currentHeight);
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
xf_transform_window(xfi);
|
||||
|
||||
IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->currentWidth, xfi->currentHeight);
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
|
||||
xf_transform_window(xfi);
|
||||
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
printf("pan left : %d\n", xfi->offset_x);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -293,7 +293,7 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
|
||||
xf_transform_window(xfi);
|
||||
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
printf("pan right : %d\n", xfi->offset_x);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
|
||||
xf_transform_window(xfi);
|
||||
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
printf("pan up : %d\n", xfi->offset_y);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
|
|||
|
||||
xf_transform_window(xfi);
|
||||
|
||||
xf_draw_screen_scaled(xfi);
|
||||
xf_draw_screen_scaled(xfi, 0, 0, 0, 0);
|
||||
printf("pan down : %d\n", xfi->offset_y);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ enum XF_EXIT_CODE
|
|||
void xf_lock_x11(xfInfo* xfi, BOOL display);
|
||||
void xf_unlock_x11(xfInfo* xfi, BOOL display);
|
||||
|
||||
void xf_draw_screen_scaled(xfInfo* xfi);
|
||||
void xf_draw_screen_scaled(xfInfo* xfi, int x, int y, int w, int h);
|
||||
void xf_transform_window(xfInfo* xfi);
|
||||
|
||||
DWORD xf_exit_code_from_disconnect_reason(DWORD reason);
|
||||
|
|
Loading…
Reference in New Issue