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

oldstable
Alexandre Julliard 2011-07-11 13:40:45 +02:00
parent 662d332246
commit 2ff31091ed
2 changed files with 23 additions and 9 deletions

View File

@ -52,6 +52,27 @@ static inline RECT get_clip_rect( DC * dc, int left, int top, int right, int bot
return rect;
}
/***********************************************************************
* 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
*
@ -379,19 +400,11 @@ BOOL WINAPI RectVisible( HDC hdc, const RECT* rect )
INT WINAPI GetClipBox( HDC hdc, LPRECT rect )
{
INT ret;
HRGN clip;
DC *dc = get_dc_ptr( hdc );
if (!dc) return ERROR;
update_dc( dc );
if ((clip = get_clip_region(dc)))
{
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 );
ret = get_clip_box( dc, rect );
if (dc->layout & LAYOUT_RTL)
{
int tmp = rect->left;

View File

@ -439,6 +439,7 @@ extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, PHYSDEV physdev ) DECLSPEC_HIDDE
extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN;
/* clipping.c */
extern int get_clip_box( DC *dc, RECT *rect ) DECLSPEC_HIDDEN;
extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN;
/* Return the total clip region (if any) */