gdi32: Don't store the metaclip region, recompute it as needed.
This commit is contained in:
parent
fb37752f53
commit
b9f09abdcc
|
@ -85,27 +85,21 @@ BOOL clip_visrect( DC *dc, RECT *dst, const RECT *src )
|
|||
*/
|
||||
void CLIPPING_UpdateGCRegion( DC * dc )
|
||||
{
|
||||
HRGN clip_rgn;
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDeviceClipping );
|
||||
HRGN regions[3];
|
||||
int count = 0;
|
||||
|
||||
/* update the intersection of meta and clip regions */
|
||||
if (dc->hMetaRgn && dc->hClipRgn)
|
||||
{
|
||||
if (!dc->hMetaClipRgn) dc->hMetaClipRgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||
CombineRgn( dc->hMetaClipRgn, dc->hClipRgn, dc->hMetaRgn, RGN_AND );
|
||||
}
|
||||
else /* only one is set, no need for an intersection */
|
||||
{
|
||||
if (dc->hMetaClipRgn) DeleteObject( dc->hMetaClipRgn );
|
||||
dc->hMetaClipRgn = 0;
|
||||
}
|
||||
clip_rgn = get_clip_region( dc );
|
||||
if (clip_rgn && dc->hVisRgn)
|
||||
if (dc->hVisRgn) regions[count++] = dc->hVisRgn;
|
||||
if (dc->hClipRgn) regions[count++] = dc->hClipRgn;
|
||||
if (dc->hMetaRgn) regions[count++] = dc->hMetaRgn;
|
||||
|
||||
if (count > 1)
|
||||
{
|
||||
if (!dc->region) dc->region = CreateRectRgn( 0, 0, 0, 0 );
|
||||
CombineRgn( dc->region, dc->hVisRgn, clip_rgn, clip_rgn ? RGN_AND : RGN_COPY );
|
||||
CombineRgn( dc->region, regions[0], regions[1], RGN_AND );
|
||||
if (count > 2) CombineRgn( dc->region, dc->region, regions[2], RGN_AND );
|
||||
}
|
||||
else
|
||||
else /* only one region, we don't need the total region */
|
||||
{
|
||||
if (dc->region) DeleteObject( dc->region );
|
||||
dc->region = 0;
|
||||
|
@ -512,7 +506,7 @@ INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, INT iCode)
|
|||
else ret = 0;
|
||||
break;
|
||||
case 3:
|
||||
if (dc->hMetaClipRgn) CombineRgn( hRgn, dc->hMetaClipRgn, 0, RGN_COPY );
|
||||
if (dc->hClipRgn && dc->hMetaRgn) CombineRgn( hRgn, dc->hClipRgn, dc->hMetaRgn, RGN_AND );
|
||||
else if (dc->hClipRgn) CombineRgn( hRgn, dc->hClipRgn, 0, RGN_COPY );
|
||||
else if (dc->hMetaRgn) CombineRgn( hRgn, dc->hMetaRgn, 0, RGN_COPY );
|
||||
else ret = 0;
|
||||
|
@ -549,19 +543,20 @@ INT WINAPI SetMetaRgn( HDC hdc )
|
|||
|
||||
if (!dc) return ERROR;
|
||||
|
||||
if (dc->hMetaClipRgn)
|
||||
if (dc->hClipRgn)
|
||||
{
|
||||
/* the intersection becomes the new meta region */
|
||||
DeleteObject( dc->hMetaRgn );
|
||||
DeleteObject( dc->hClipRgn );
|
||||
dc->hMetaRgn = dc->hMetaClipRgn;
|
||||
dc->hClipRgn = 0;
|
||||
dc->hMetaClipRgn = 0;
|
||||
}
|
||||
else if (dc->hClipRgn)
|
||||
{
|
||||
dc->hMetaRgn = dc->hClipRgn;
|
||||
dc->hClipRgn = 0;
|
||||
if (dc->hMetaRgn)
|
||||
{
|
||||
/* the intersection becomes the new meta region */
|
||||
CombineRgn( dc->hMetaRgn, dc->hMetaRgn, dc->hClipRgn, RGN_AND );
|
||||
DeleteObject( dc->hClipRgn );
|
||||
dc->hClipRgn = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc->hMetaRgn = dc->hClipRgn;
|
||||
dc->hClipRgn = 0;
|
||||
}
|
||||
}
|
||||
/* else nothing to do */
|
||||
|
||||
|
|
|
@ -138,7 +138,6 @@ static void free_dc_state( DC *dc )
|
|||
{
|
||||
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
|
||||
if (dc->hMetaRgn) DeleteObject( dc->hMetaRgn );
|
||||
if (dc->hMetaClipRgn) DeleteObject( dc->hMetaClipRgn );
|
||||
if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
|
||||
if (dc->region) DeleteObject( dc->region );
|
||||
if (dc->path) free_gdi_path( dc->path );
|
||||
|
@ -396,8 +395,6 @@ INT nulldrv_SaveDC( PHYSDEV dev )
|
|||
CombineRgn( newdc->hMetaRgn, dc->hMetaRgn, 0, RGN_COPY );
|
||||
}
|
||||
|
||||
/* don't bother recomputing hMetaClipRgn, we'll do that in SetDCState */
|
||||
|
||||
if (!PATH_SavePath( newdc, dc ))
|
||||
{
|
||||
release_dc_ptr( dc );
|
||||
|
|
|
@ -106,7 +106,6 @@ typedef struct tagDC
|
|||
DWORD layout;
|
||||
HRGN hClipRgn; /* Clip region */
|
||||
HRGN hMetaRgn; /* Meta region */
|
||||
HRGN hMetaClipRgn; /* Intersection of meta and clip regions */
|
||||
HRGN hVisRgn; /* Visible region */
|
||||
HRGN region; /* Total DC region (intersection of clip and visible) */
|
||||
HPEN hPen;
|
||||
|
@ -216,20 +215,13 @@ extern BOOL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void **bits,
|
|||
extern BOOL clip_visrect( DC *dc, RECT *dst, const RECT *src ) DECLSPEC_HIDDEN;
|
||||
extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* Return the total clip region (if any) */
|
||||
static inline HRGN get_clip_region( DC * dc )
|
||||
{
|
||||
if (dc->hMetaClipRgn) return dc->hMetaClipRgn;
|
||||
if (dc->hMetaRgn) return dc->hMetaRgn;
|
||||
return dc->hClipRgn;
|
||||
}
|
||||
|
||||
/* Return the total DC region (if any) */
|
||||
static inline HRGN get_dc_region( DC *dc )
|
||||
{
|
||||
if (dc->region) return dc->region;
|
||||
if (dc->hVisRgn) return dc->hVisRgn;
|
||||
return get_clip_region( dc );
|
||||
if (dc->hClipRgn) return dc->hClipRgn;
|
||||
return dc->hMetaRgn;
|
||||
}
|
||||
|
||||
/* dc.c */
|
||||
|
|
Loading…
Reference in New Issue