Commit 2ff31091 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Export a function to compute the DC clip box.

parent 662d3322
...@@ -53,6 +53,27 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot ...@@ -53,6 +53,27 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot
} }
/*********************************************************************** /***********************************************************************
* get_clip_box
*
* Get the clipping rectangle in device coordinates.
*/
int get_clip_box( DC *dc, RECT *rect )
{
int ret = ERROR;
HRGN rgn, clip = get_clip_region( dc );
if (!clip) return GetRgnBox( dc->hVisRgn, rect );
if ((rgn = CreateRectRgn( 0, 0, 0, 0 )))
{
CombineRgn( rgn, dc->hVisRgn, clip, RGN_AND );
ret = GetRgnBox( rgn, rect );
DeleteObject( rgn );
}
return ret;
}
/***********************************************************************
* CLIPPING_UpdateGCRegion * CLIPPING_UpdateGCRegion
* *
* Update the GC clip region when the ClipRgn or VisRgn have changed. * Update the GC clip region when the ClipRgn or VisRgn have changed.
...@@ -379,19 +400,11 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect ) ...@@ -379,19 +400,11 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
INT WINAPI GetClipBox( HDC hdc, LPRECT rect ) INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
{ {
INT ret; INT ret;
HRGN clip;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
if (!dc) return ERROR; if (!dc) return ERROR;
update_dc( dc ); update_dc( dc );
if ((clip = get_clip_region(dc))) ret = get_clip_box( dc, rect );
{
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( hrgn, dc->hVisRgn, clip, RGN_AND );
ret = GetRgnBox( hrgn, rect );
DeleteObject( hrgn );
}
else ret = GetRgnBox( dc->hVisRgn, rect );
if (dc->layout & LAYOUT_RTL) if (dc->layout & LAYOUT_RTL)
{ {
int tmp = rect->left; int tmp = rect->left;
......
...@@ -439,6 +439,7 @@ extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) DECLSPEC_HIDDE ...@@ -439,6 +439,7 @@ extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) DECLSPEC_HIDDE
extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN; extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN;
/* clipping.c */ /* clipping.c */
extern int get_clip_box( DC *dc, RECT *rect ) DECLSPEC_HIDDEN;
extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN; extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN;
/* Return the total clip region (if any) */ /* Return the total clip region (if any) */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment