From c07763b4194c3dc81391c8d74d0552f5140b18ef Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 4 Jun 2012 22:22:29 +0200 Subject: [PATCH] gdi32: Clip output to both the DIB visible rectangle and the total DIB extents. --- dlls/gdi32/dibdrv/dc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 798a9cd5444..df513327584 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -263,10 +263,11 @@ int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct cl init_clipped_rects( clip_rects ); - rect.left = 0; - rect.top = 0; - rect.right = dib->rect.right - dib->rect.left; - rect.bottom = dib->rect.bottom - dib->rect.top; + rect.left = max( 0, -dib->rect.left ); + rect.top = max( 0, -dib->rect.top ); + rect.right = min( dib->rect.right, dib->width ) - dib->rect.left; + rect.bottom = min( dib->rect.bottom, dib->height ) - dib->rect.top; + if (is_rect_empty( &rect )) return 0; if (rc && !intersect_rect( &rect, &rect, rc )) return 0; if (!clip)