gdi32: Use NtGdiDeleteObjectApp instead of DeleteObject in ntgdi functions.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-03 13:59:52 +01:00 committed by Alexandre Julliard
parent 072a100f66
commit 8e70a0a5cc
13 changed files with 59 additions and 59 deletions

View File

@ -488,7 +488,7 @@ BOOL CDECL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert
ret = !dev->funcs->pPutImage( dev, rgn, info, &bits, &src, &dst, SRCCOPY );
if (bits.free) bits.free( &bits );
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
done:
HeapFree( GetProcessHeap(), 0, pts );
@ -823,9 +823,9 @@ BOOL WINAPI MaskBlt(HDC hdcDest, INT nXDest, INT nYDest,
NtGdiSelectBitmap(hDC2, hOldBitmap2);
/* delete all temp objects */
DeleteObject(hBitmap1);
DeleteObject(hBitmap2);
DeleteObject(hbrMask);
NtGdiDeleteObjectApp( hBitmap1 );
NtGdiDeleteObjectApp( hBitmap2 );
NtGdiDeleteObjectApp( hbrMask );
NtGdiDeleteObjectApp( hDC1 );
NtGdiDeleteObjectApp( hDC2 );
@ -926,12 +926,12 @@ error:
NtGdiSelectBitmap(hdcWork, oldWork);
NtGdiDeleteObjectApp( hdcWork );
}
if(bmpWork) DeleteObject(bmpWork);
if(bmpWork) NtGdiDeleteObjectApp( bmpWork );
if(hdcMask) {
NtGdiSelectBitmap(hdcMask, oldMask);
NtGdiDeleteObjectApp( hdcMask );
}
if(bmpMask) DeleteObject(bmpMask);
if(bmpMask) NtGdiDeleteObjectApp( bmpMask );
return ret;
}

View File

@ -303,7 +303,7 @@ LONG WINAPI NtGdiSetBitmapBits(
last_row = NtGdiCreateRectRgn( src.visrect.left, src.visrect.bottom - 1,
src.visrect.left + extra_pixels, src.visrect.bottom );
NtGdiCombineRgn( clip, clip, last_row, RGN_OR );
DeleteObject( last_row );
NtGdiDeleteObjectApp( last_row );
}
TRACE("(%p, %d, %p) %dx%d %d bpp fetched height: %d\n",
@ -354,7 +354,7 @@ LONG WINAPI NtGdiSetBitmapBits(
}
if (err) count = 0;
if (clip) DeleteObject( clip );
if (clip) NtGdiDeleteObjectApp( clip );
if (src_bits.free) src_bits.free( &src_bits );
GDI_ReleaseObj( hbitmap );
return count;

View File

@ -111,7 +111,7 @@ void update_dc_clipping( DC * dc )
}
else /* only one region, we don't need the total region */
{
if (dc->region) DeleteObject( dc->region );
if (dc->region) NtGdiDeleteObjectApp( dc->region );
dc->region = 0;
}
physdev->funcs->pSetDeviceClipping( physdev, get_dc_region( dc ));
@ -153,7 +153,7 @@ INT WINAPI NtGdiExtSelectClipRgn( HDC hdc, HRGN rgn, INT mode )
switch (mode)
{
case RGN_COPY:
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
if (dc->hClipRgn) NtGdiDeleteObjectApp( dc->hClipRgn );
dc->hClipRgn = 0;
ret = SIMPLEREGION;
break;
@ -189,7 +189,7 @@ INT WINAPI NtGdiExtSelectClipRgn( HDC hdc, HRGN rgn, INT mode )
else
ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, mode );
if (mirrored) DeleteObject( mirrored );
if (mirrored) NtGdiDeleteObjectApp( mirrored );
}
if (ret != ERROR) update_dc_clipping( dc );
release_dc_ptr( dc );
@ -212,7 +212,7 @@ void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect,
/* map region to DC coordinates */
NtGdiOffsetRgn( hrgn, -vis_rect->left, -vis_rect->top );
if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn );
dc->dirty = 0;
dc->attr->vis_rect = *vis_rect;
dc->device_rect = *device_rect;
@ -269,7 +269,7 @@ INT WINAPI NtGdiExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bott
{
if (!dc->hClipRgn) create_default_clip_region( dc );
ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, RGN_DIFF );
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
if (ret != ERROR) update_dc_clipping( dc );
}
release_dc_ptr( dc );
@ -299,7 +299,7 @@ INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bo
else if ((rgn = CreateRectRgnIndirect( &rect )))
{
ret = NtGdiCombineRgn( dc->hClipRgn, dc->hClipRgn, rgn, RGN_AND );
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
}
if (ret != ERROR) update_dc_clipping( dc );
release_dc_ptr( dc );
@ -476,7 +476,7 @@ INT WINAPI NtGdiSetMetaRgn( HDC hdc )
{
/* the intersection becomes the new meta region */
NtGdiCombineRgn( dc->hMetaRgn, dc->hMetaRgn, dc->hClipRgn, RGN_AND );
DeleteObject( dc->hClipRgn );
NtGdiDeleteObjectApp( dc->hClipRgn );
dc->hClipRgn = 0;
}
else

View File

@ -164,10 +164,10 @@ DC *alloc_dc_ptr( DWORD magic )
*/
static void free_dc_state( DC *dc )
{
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
if (dc->hMetaRgn) DeleteObject( dc->hMetaRgn );
if (dc->hVisRgn) DeleteObject( dc->hVisRgn );
if (dc->region) DeleteObject( dc->region );
if (dc->hClipRgn) NtGdiDeleteObjectApp( dc->hClipRgn );
if (dc->hMetaRgn) NtGdiDeleteObjectApp( dc->hMetaRgn );
if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn );
if (dc->region) NtGdiDeleteObjectApp( dc->region );
if (dc->path) free_gdi_path( dc->path );
HeapFree( GetProcessHeap(), 0, dc->attr );
HeapFree( GetProcessHeap(), 0, dc );
@ -403,8 +403,8 @@ static BOOL reset_dc_state( HDC hdc )
NtGdiSetBoundsRect( hdc, NULL, DCB_DISABLE );
NtGdiAbortPath( hdc );
if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
if (dc->hMetaRgn) DeleteObject( dc->hMetaRgn );
if (dc->hClipRgn) NtGdiDeleteObjectApp( dc->hClipRgn );
if (dc->hMetaRgn) NtGdiDeleteObjectApp( dc->hMetaRgn );
dc->hClipRgn = 0;
dc->hMetaRgn = 0;
update_dc_clipping( dc );

View File

@ -439,7 +439,7 @@ static BOOL build_rle_bitmap( BITMAPINFO *info, struct gdi_image_bits *bits, HRG
}
done:
if (run) DeleteObject( run );
if (run) NtGdiDeleteObjectApp( run );
if (bits->free) bits->free( bits );
bits->ptr = out_bits;
@ -450,8 +450,8 @@ done:
return TRUE;
fail:
if (run) DeleteObject( run );
if (clip && *clip) DeleteObject( *clip );
if (run) NtGdiDeleteObjectApp( run );
if (clip && *clip) NtGdiDeleteObjectApp( *clip );
HeapFree( GetProcessHeap(), 0, out_bits );
return FALSE;
}
@ -600,7 +600,7 @@ INT CDECL nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
done:
if (src_bits.free) src_bits.free( &src_bits );
if (clip) DeleteObject( clip );
if (clip) NtGdiDeleteObjectApp( clip );
return ret;
}
@ -756,7 +756,7 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
done:
if (src_bits.free) src_bits.free( &src_bits );
if (clip) DeleteObject( clip );
if (clip) NtGdiDeleteObjectApp( clip );
GDI_ReleaseObj( hbitmap );
return result;
}
@ -874,7 +874,7 @@ INT CDECL nulldrv_SetDIBitsToDevice( PHYSDEV dev, INT x_dst, INT y_dst, DWORD cx
done:
if (src_bits.free) src_bits.free( &src_bits );
if (clip) DeleteObject( clip );
if (clip) NtGdiDeleteObjectApp( clip );
return lines;
}
@ -1691,7 +1691,7 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY
if (GetObjectType( desc->hDc ) != OBJ_MEMDC ||
GetObjectType( desc->hBitmap ) != OBJ_BITMAP) return STATUS_INVALID_PARAMETER;
DeleteObject( desc->hBitmap );
NtGdiDeleteObjectApp( desc->hBitmap );
NtGdiDeleteObjectApp( desc->hDc );
return STATUS_SUCCESS;

View File

@ -1034,7 +1034,7 @@ DWORD CDECL dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
free_clipped_rects( &clipped_rects );
}
free_dib_info( &src_dib );
if (tmp_rgn) DeleteObject( tmp_rgn );
if (tmp_rgn) NtGdiDeleteObjectApp( tmp_rgn );
return ret;
update_format:

View File

@ -375,7 +375,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
!(interior = create_polypolygon_region( points, &count, 1, WINDING, &rc )))
{
HeapFree( GetProcessHeap(), 0, points );
if (outline) DeleteObject( outline );
if (outline) NtGdiDeleteObjectApp( outline );
return FALSE;
}
@ -383,7 +383,7 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
if (interior && !outline)
{
ret = brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
interior = 0;
}
@ -395,12 +395,12 @@ static BOOL draw_arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
{
NtGdiCombineRgn( interior, interior, outline, RGN_DIFF );
ret = brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
}
if (outline)
{
if (ret) ret = pen_region( pdev, outline );
DeleteObject( outline );
NtGdiDeleteObjectApp( outline );
}
HeapFree( GetProcessHeap(), 0, points );
return ret;
@ -428,7 +428,7 @@ static BOOL stroke_and_fill_path( dibdrv_physdev *dev, BOOL stroke, BOOL fill )
if (interior && !outline)
{
ret = brush_region( dev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
interior = 0;
}
@ -460,12 +460,12 @@ static BOOL stroke_and_fill_path( dibdrv_physdev *dev, BOOL stroke, BOOL fill )
{
NtGdiCombineRgn( interior, interior, outline, RGN_DIFF );
ret = brush_region( dev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
}
if (outline)
{
if (ret) ret = pen_region( dev, outline );
DeleteObject( outline );
NtGdiDeleteObjectApp( outline );
}
done:
@ -1074,7 +1074,7 @@ BOOL CDECL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT
add_clipped_bounds( pdev, NULL, rgn );
brush_region( pdev, rgn );
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
return TRUE;
}
@ -1156,7 +1156,7 @@ BOOL CDECL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
if (region)
{
ret = pen_region( pdev, region );
DeleteObject( region );
NtGdiDeleteObjectApp( region );
}
return ret;
}
@ -1284,7 +1284,7 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
if (interior && !outline)
{
ret = brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
interior = 0;
}
@ -1300,12 +1300,12 @@ BOOL CDECL dibdrv_PolyPolygon( PHYSDEV dev, const POINT *pt, const INT *counts,
{
NtGdiCombineRgn( interior, interior, outline, RGN_DIFF );
ret = brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
}
if (outline)
{
if (ret) ret = pen_region( pdev, outline );
DeleteObject( outline );
NtGdiDeleteObjectApp( outline );
}
done:
@ -1357,7 +1357,7 @@ BOOL CDECL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* count
if (outline)
{
ret = pen_region( pdev, outline );
DeleteObject( outline );
NtGdiDeleteObjectApp( outline );
}
done:
@ -1425,10 +1425,10 @@ BOOL CDECL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bott
NtGdiCombineRgn( interior, interior, outline, RGN_DIFF );
brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
}
ret = pen_region( pdev, outline );
DeleteObject( outline );
NtGdiDeleteObjectApp( outline );
}
else
{
@ -1480,7 +1480,7 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott
ellipse_width, ellipse_height )))
{
HeapFree( GetProcessHeap(), 0, points );
if (outline) DeleteObject( outline );
if (outline) NtGdiDeleteObjectApp( outline );
return FALSE;
}
@ -1488,7 +1488,7 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott
if (interior && !outline)
{
ret = brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
interior = 0;
}
@ -1543,12 +1543,12 @@ BOOL CDECL dibdrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bott
{
NtGdiCombineRgn( interior, interior, outline, RGN_DIFF );
ret = brush_region( pdev, interior );
DeleteObject( interior );
NtGdiDeleteObjectApp( interior );
}
if (outline)
{
if (ret) ret = pen_region( pdev, outline );
DeleteObject( outline );
NtGdiDeleteObjectApp( outline );
}
HeapFree( GetProcessHeap(), 0, points );
return ret;

View File

@ -1367,7 +1367,7 @@ static void add_join( dibdrv_physdev *pdev, HRGN region, HRGN round_cap, const P
NtGdiGetRgnBox( join, &rect );
if (clip_rect_to_dib( &pdev->dib, &rect ))
NtGdiCombineRgn( region, region, join, RGN_OR );
DeleteObject( join );
NtGdiDeleteObjectApp( join );
return;
}
@ -1499,7 +1499,7 @@ static BOOL wide_line_segment( dibdrv_physdev *pdev, HRGN total,
{
segment = CreatePolygonRgn( seg_pts, 4, ALTERNATE );
NtGdiCombineRgn( total, total, segment, RGN_OR );
DeleteObject( segment );
NtGdiDeleteObjectApp( segment );
}
face_1->start = seg_pts[0];
@ -1583,7 +1583,7 @@ static BOOL wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close
else
wide_line_segments( pdev, num, pts, FALSE, 0, num - 1, &pts[0], &pts[num - 1], round_cap, total );
if (round_cap) DeleteObject( round_cap );
if (round_cap) NtGdiDeleteObjectApp( round_cap );
return TRUE;
}
@ -1702,7 +1702,7 @@ static BOOL dashed_wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOO
&pts[0], &initial_point, round_cap, total );
}
if (round_cap) DeleteObject( round_cap );
if (round_cap) NtGdiDeleteObjectApp( round_cap );
return TRUE;
}

View File

@ -4839,7 +4839,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
dp_to_lp( dc, (POINT *)&rc, 2 );
NtGdiPatBlt( dev->hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
NtGdiSelectBrush( dev->hdc, orig );
DeleteObject( brush );
NtGdiDeleteObjectApp( brush );
}
}
@ -4954,7 +4954,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
}
NtGdiSelectPen( dev->hdc, orig );
DeleteObject( pen );
NtGdiDeleteObjectApp( pen );
return TRUE;
}
@ -5351,7 +5351,7 @@ done:
NtGdiSelectPen(hdc, hpen);
hbrush = NtGdiSelectBrush(hdc, hbrush);
DeleteObject(hbrush);
NtGdiDeleteObjectApp( hbrush );
}
release_dc_ptr( dc );

View File

@ -504,7 +504,7 @@ BOOL GDI_dec_ref_count( HGDIOBJ handle )
entry_obj( entry )->deleted = 0;
LeaveCriticalSection( &gdi_section );
TRACE( "executing delayed DeleteObject for %p\n", handle );
DeleteObject( handle );
NtGdiDeleteObjectApp( handle );
return TRUE;
}
}

View File

@ -92,7 +92,7 @@ BOOL CDECL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, INT
{
if (REGION_FrameRgn( tmp, rgn, width, height ))
ret = NtGdiFillRgn( dev->hdc, tmp, brush );
DeleteObject( tmp );
NtGdiDeleteObjectApp( tmp );
}
return ret;
}

View File

@ -721,7 +721,7 @@ BOOL WINAPI NtGdiSelectClipPath( HDC hdc, INT mode )
if ((rgn = NtGdiPathToRegion( hdc )))
{
ret = NtGdiExtSelectClipRgn( hdc, rgn, mode ) != ERROR;
DeleteObject( rgn );
NtGdiDeleteObjectApp( rgn );
}
return ret;
}

View File

@ -929,7 +929,7 @@ HRGN WINAPI NtGdiExtCreateRegion( const XFORM *xform, DWORD count, const RGNDATA
translate( pt, 4, xform );
poly_hrgn = CreatePolyPolygonRgn( pt, &count, 1, WINDING );
NtGdiCombineRgn( hrgn, hrgn, poly_hrgn, RGN_OR );
DeleteObject( poly_hrgn );
NtGdiDeleteObjectApp( poly_hrgn );
}
return hrgn;
}