From 443ee42db58fae66eb880d2f814175f1f8e0e451 Mon Sep 17 00:00:00 2001 From: Norbert Federa Date: Fri, 5 Dec 2014 19:40:40 +0100 Subject: [PATCH] gdi: don't pollute invalid region with empty rects --- client/X11/xf_client.c | 12 ++++++------ libfreerdp/gdi/region.c | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index 63e02eed8..fe2fd03a8 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -128,12 +128,6 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h) return; } - if (!w || !h) - { - WLog_ERR(TAG, "invalid width and/or height specified"); - return; - } - xScalingFactor = xfc->width / (double)xfc->scaledWidth; yScalingFactor = xfc->height / (double)xfc->scaledHeight; @@ -207,6 +201,12 @@ BOOL xf_picture_transform_required(xfContext* xfc) void xf_draw_screen(xfContext* xfc, int x, int y, int w, int h) { + if (w == 0 || h == 0) + { + WLog_WARN(TAG, "invalid width and/or height specified: w=%d h=%d", w, h); + return; + } + #ifdef WITH_XRENDER if (xf_picture_transform_required(xfc)) { xf_draw_screen_scaled(xfc, x, y, w, h); diff --git a/libfreerdp/gdi/region.c b/libfreerdp/gdi/region.c index ec7345cc0..6584d435f 100644 --- a/libfreerdp/gdi/region.c +++ b/libfreerdp/gdi/region.c @@ -377,6 +377,9 @@ INLINE int gdi_InvalidateRegion(HGDI_DC hdc, int x, int y, int w, int h) if (!hdc->hwnd->invalid) return 0; + if (w == 0 || h == 0) + return 0; + cinvalid = hdc->hwnd->cinvalid; if ((hdc->hwnd->ninvalid + 1) > hdc->hwnd->count)