wfreerdp: fixed upscaling

This commit is contained in:
Benoit LeBlanc 2013-04-30 12:56:16 -04:00
parent 0b9112b091
commit 3f12dc351b
3 changed files with 9 additions and 8 deletions

View File

@ -543,7 +543,7 @@ BOOL wf_scale_blt(wfInfo* wfi, HDC hdc, int x, int y, int w, int h, HDC hdcSrc,
if (!wh)
wh = dh;
if (wfi->fullscreen || !wfi->instance->settings->SmartSizing || (ww >= dw && wh >= dh))
if (wfi->fullscreen || !wfi->instance->settings->SmartSizing || (ww == dw && wh == dh))
{
return BitBlt(hdc, x, y, w, h, wfi->primary->hdc, x1, y1, SRCCOPY);
}
@ -552,7 +552,7 @@ BOOL wf_scale_blt(wfInfo* wfi, HDC hdc, int x, int y, int w, int h, HDC hdcSrc,
SetStretchBltMode(hdc, HALFTONE);
SetBrushOrgEx(hdc, 0, 0, NULL);
return StretchBlt(hdc, MIN(x, x * ww / dw), MIN(y, y * wh / dh), MIN(dw, ww), MIN(dh, wh), wfi->primary->hdc, x1, y1, dw, dh, SRCCOPY);
return StretchBlt(hdc, 0, 0, ww, wh, wfi->primary->hdc, 0, 0, dw, dh, SRCCOPY);
}
return TRUE;
@ -573,8 +573,8 @@ void wf_scale_mouse_event(wfInfo* wfi, rdpInput* input, UINT16 flags, UINT16 x,
dw = wfi->instance->settings->DesktopWidth;
dh = wfi->instance->settings->DesktopHeight;
if (!wfi->instance->settings->SmartSizing || (ww >= dw) && (wh >= dh))
if (!wfi->instance->settings->SmartSizing || (ww == dw) && (wh == dh))
input->MouseEvent(input, flags, x + wfi->xCurrentScroll, y + wfi->yCurrentScroll);
else
input->MouseEvent(input, flags, MAX(x, x * dw / ww) + wfi->xCurrentScroll, MAX(y, y * dh / wh) + wfi->yCurrentScroll);
input->MouseEvent(input, flags, x * dw / ww + wfi->xCurrentScroll, y * dh / wh + wfi->yCurrentScroll);
}

View File

@ -190,10 +190,10 @@ void wf_scale_rect(wfInfo* wfi, RECT* source)
if (wfi->instance->settings->SmartSizing && (ww != dw || wh != dh))
{
source->bottom = MIN(source->bottom + 2, MAX(0, source->bottom * wh / dh + 2));
source->top = MIN(source->top - 2, MAX(0, source->top * wh / dh - 2));
source->left = MIN(source->left - 2, MAX(0, source->left * ww / dw - 2));
source->right = MIN(source->right + 2, MAX(0, source->right * ww / dw + 2));
source->bottom = source->bottom * wh / dh + 20;
source->top = source->top * wh / dh - 20;
source->left = source->left * ww / dw - 20;
source->right = source->right * ww / dw + 20;
}
source->bottom -= wfi->yCurrentScroll;

View File

@ -782,6 +782,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co
freerdp_bitmap_write(tile_bitmap, gdi->tile->bitmap->data, 64, 64, 32);
#endif
for (j = 0; j < message->num_rects; j++)
{
gdi_SetClipRgn(gdi->primary->hdc,