From 69c8f0b67d445493a83dc932aaacefc26bb42c09 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 26 Jul 2010 15:30:26 +0200 Subject: [PATCH] gdi32: Store the total visible rectangle in the DC. --- dlls/gdi32/bitmap.c | 4 ++++ dlls/gdi32/clipping.c | 1 + dlls/gdi32/dc.c | 19 +++++++++++++++---- dlls/gdi32/gdi_private.h | 1 + 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index 937a67d32ac..e5a02be7350 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -611,6 +611,10 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc ) dc->hBitmap = handle; GDI_inc_ref_count( handle ); dc->dirty = 0; + dc->vis_rect.left = 0; + dc->vis_rect.top = 0; + dc->vis_rect.right = bitmap->bitmap.bmWidth; + dc->vis_rect.bottom = bitmap->bitmap.bmHeight; SetRectRgn( dc->hVisRgn, 0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight); GDI_ReleaseObj( handle ); DC_InitDC( dc ); diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c index e8656564525..142c520a1d2 100644 --- a/dlls/gdi32/clipping.c +++ b/dlls/gdi32/clipping.c @@ -171,6 +171,7 @@ void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect ) DeleteObject( dc->hVisRgn ); dc->dirty = 0; + dc->vis_rect = *vis_rect; dc->hVisRgn = hrgn; CLIPPING_UpdateGCRegion( dc ); release_dc_ptr( dc ); diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 7c86d3486ae..738e42efb0e 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -666,8 +666,11 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output, goto error; } - SetRectRgn( dc->hVisRgn, 0, 0, - GetDeviceCaps( hdc, DESKTOPHORZRES ), GetDeviceCaps( hdc, DESKTOPVERTRES ) ); + dc->vis_rect.left = 0; + dc->vis_rect.top = 0; + dc->vis_rect.right = GetDeviceCaps( hdc, DESKTOPHORZRES ); + dc->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES ); + SetRectRgn(dc->hVisRgn, dc->vis_rect.left, dc->vis_rect.top, dc->vis_rect.right, dc->vis_rect.bottom); DC_InitDC( dc ); release_dc_ptr( dc ); @@ -768,6 +771,10 @@ HDC WINAPI CreateCompatibleDC( HDC hdc ) TRACE("(%p): returning %p\n", hdc, dc->hSelf ); dc->hBitmap = GDI_inc_ref_count( GetStockObject( DEFAULT_BITMAP )); + dc->vis_rect.left = 0; + dc->vis_rect.top = 0; + dc->vis_rect.right = 1; + dc->vis_rect.bottom = 1; if (!(dc->hVisRgn = CreateRectRgn( 0, 0, 1, 1 ))) goto error; /* default bitmap is 1x1 */ /* Copy the driver-specific physical device info into @@ -860,8 +867,12 @@ HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode ) if (ret) /* reset the visible region */ { dc->dirty = 0; - SetRectRgn( dc->hVisRgn, 0, 0, GetDeviceCaps( hdc, DESKTOPHORZRES ), - GetDeviceCaps( hdc, DESKTOPVERTRES ) ); + dc->vis_rect.left = 0; + dc->vis_rect.top = 0; + dc->vis_rect.right = GetDeviceCaps( hdc, DESKTOPHORZRES ); + dc->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES ); + SetRectRgn( dc->hVisRgn, dc->vis_rect.left, dc->vis_rect.top, + dc->vis_rect.right, dc->vis_rect.bottom ); CLIPPING_UpdateGCRegion( dc ); } } diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index d1cb66bf3b9..8ac78ef25d9 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -261,6 +261,7 @@ typedef struct tagDC INT vportExtY; SIZE virtual_res; /* Initially HORZRES,VERTRES. Changed by SetVirtualResolution */ SIZE virtual_size; /* Initially HORZSIZE,VERTSIZE. Changed by SetVirtualResolution */ + RECT vis_rect; /* visible rectangle in screen coords */ FLOAT miterLimit; int flags; -- 2.11.4.GIT