gdi32: Avoid making a copy of the device clipping region in the DIB driver.
This commit is contained in:
parent
56373bc491
commit
8b3271c3b0
|
@ -929,7 +929,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
|
||||||
struct clipped_rects clipped_rects;
|
struct clipped_rects clipped_rects;
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
dib_info src_dib;
|
dib_info src_dib;
|
||||||
HRGN saved_clip = NULL;
|
HRGN tmp_rgn = 0;
|
||||||
dibdrv_physdev *pdev = NULL;
|
dibdrv_physdev *pdev = NULL;
|
||||||
|
|
||||||
TRACE( "%p %p %p\n", dev, hbitmap, info );
|
TRACE( "%p %p %p\n", dev, hbitmap, info );
|
||||||
|
@ -972,8 +972,13 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info
|
||||||
|
|
||||||
if (!hbitmap)
|
if (!hbitmap)
|
||||||
{
|
{
|
||||||
if (clip) saved_clip = add_extra_clipping_region( pdev, clip );
|
if (clip && pdev->clip)
|
||||||
clip = pdev->clip;
|
{
|
||||||
|
tmp_rgn = CreateRectRgn( 0, 0, 0, 0 );
|
||||||
|
CombineRgn( tmp_rgn, clip, pdev->clip, RGN_AND );
|
||||||
|
clip = tmp_rgn;
|
||||||
|
}
|
||||||
|
else if (!clip) clip = pdev->clip;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!get_clipped_rects( dib, &dst->visrect, clip, &clipped_rects ))
|
if (!get_clipped_rects( dib, &dst->visrect, clip, &clipped_rects ))
|
||||||
|
@ -1000,7 +1005,7 @@ update_format:
|
||||||
ret = ERROR_BAD_FORMAT;
|
ret = ERROR_BAD_FORMAT;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (saved_clip) restore_clipping_region( pdev, saved_clip );
|
if (tmp_rgn) DeleteObject( tmp_rgn );
|
||||||
if (hbitmap) GDI_ReleaseObj( hbitmap );
|
if (hbitmap) GDI_ReleaseObj( hbitmap );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,33 +298,6 @@ int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct cl
|
||||||
return clip_rects->count;
|
return clip_rects->count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* add_extra_clipping_region
|
|
||||||
*
|
|
||||||
* Temporarily add a region to the current clipping region.
|
|
||||||
* The returned region must be restored with restore_clipping_region.
|
|
||||||
*/
|
|
||||||
HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn )
|
|
||||||
{
|
|
||||||
HRGN ret, clip;
|
|
||||||
|
|
||||||
if (!(clip = CreateRectRgn( 0, 0, 0, 0 ))) return 0;
|
|
||||||
CombineRgn( clip, pdev->clip, rgn, RGN_AND );
|
|
||||||
ret = pdev->clip;
|
|
||||||
pdev->clip = clip;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* restore_clipping_region
|
|
||||||
*/
|
|
||||||
void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn )
|
|
||||||
{
|
|
||||||
if (!rgn) return;
|
|
||||||
DeleteObject( pdev->clip );
|
|
||||||
pdev->clip = rgn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* dibdrv_CreateDC
|
* dibdrv_CreateDC
|
||||||
*/
|
*/
|
||||||
|
@ -334,11 +307,6 @@ static BOOL dibdrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
|
||||||
dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) );
|
dibdrv_physdev *pdev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pdev) );
|
||||||
|
|
||||||
if (!pdev) return FALSE;
|
if (!pdev) return FALSE;
|
||||||
if (!(pdev->clip = CreateRectRgn(0, 0, 0, 0)))
|
|
||||||
{
|
|
||||||
HeapFree( GetProcessHeap(), 0, pdev );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
clear_dib_info(&pdev->dib);
|
clear_dib_info(&pdev->dib);
|
||||||
clear_dib_info(&pdev->brush_dib);
|
clear_dib_info(&pdev->brush_dib);
|
||||||
push_dc_driver( dev, &pdev->dev, &dib_driver );
|
push_dc_driver( dev, &pdev->dev, &dib_driver );
|
||||||
|
@ -352,7 +320,6 @@ static BOOL dibdrv_DeleteDC( PHYSDEV dev )
|
||||||
{
|
{
|
||||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||||
TRACE("(%p)\n", dev);
|
TRACE("(%p)\n", dev);
|
||||||
DeleteObject(pdev->clip);
|
|
||||||
free_pattern_brush(pdev);
|
free_pattern_brush(pdev);
|
||||||
HeapFree( GetProcessHeap(), 0, pdev );
|
HeapFree( GetProcessHeap(), 0, pdev );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -409,8 +376,7 @@ static void dibdrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
|
||||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||||
TRACE("(%p, %p)\n", dev, rgn);
|
TRACE("(%p, %p)\n", dev, rgn);
|
||||||
|
|
||||||
SetRectRgn( pdev->clip, 0, 0, pdev->dib.width, pdev->dib.height );
|
pdev->clip = rgn;
|
||||||
if (rgn) CombineRgn( pdev->clip, pdev->clip, rgn, RGN_AND );
|
|
||||||
return next->funcs->pSetDeviceClipping( next, rgn );
|
return next->funcs->pSetDeviceClipping( next, rgn );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,8 +232,6 @@ extern COLORREF make_rgb_colorref( HDC hdc, dib_info *dib, COLORREF color, BOOL
|
||||||
extern DWORD get_pixel_color(dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup) DECLSPEC_HIDDEN;
|
extern DWORD get_pixel_color(dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup) DECLSPEC_HIDDEN;
|
||||||
extern BOOL brush_rect( dibdrv_physdev *pdev, const RECT *rect ) DECLSPEC_HIDDEN;
|
extern BOOL brush_rect( dibdrv_physdev *pdev, const RECT *rect ) DECLSPEC_HIDDEN;
|
||||||
extern int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects ) DECLSPEC_HIDDEN;
|
extern int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects ) DECLSPEC_HIDDEN;
|
||||||
extern HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN;
|
|
||||||
extern void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN;
|
|
||||||
extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
|
extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
|
||||||
const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN;
|
const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue