From edb68487f417281866519587635f06bd9dac67b2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 4 Apr 2011 12:27:02 +0200 Subject: [PATCH] gdi32: Use the hdc from the generic physdev structure in metafiles. --- dlls/gdi32/mfdrv/init.c | 11 +++++------ dlls/gdi32/mfdrv/metafiledrv.h | 1 - dlls/gdi32/mfdrv/objects.c | 14 +++++--------- dlls/gdi32/mfdrv/text.c | 3 +-- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index cee45347379..cba26ebdeb3 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -181,7 +181,6 @@ static DC *MFDRV_AllocMetaFile(void) } push_dc_driver( dc, &physDev->dev, &MFDRV_Funcs ); - physDev->hdc = dc->hSelf; physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0])); physDev->handles_size = HANDLE_LIST_INC; @@ -196,7 +195,7 @@ static DC *MFDRV_AllocMetaFile(void) physDev->mh->mtMaxRecord = 0; physDev->mh->mtNoParameters = 0; - SetVirtualResolution(dc->hSelf, 0, 0, 0, 0); + SetVirtualResolution( physDev->dev.hdc, 0, 0, 0, 0); return dc; } @@ -213,7 +212,7 @@ static BOOL CDECL MFDRV_DeleteDC( PHYSDEV dev ) HeapFree( GetProcessHeap(), 0, physDev->mh ); for(index = 0; index < physDev->handles_size; index++) if(physDev->handles[index]) - GDI_hdc_not_using_object(physDev->handles[index], physDev->hdc); + GDI_hdc_not_using_object(physDev->handles[index], dev->hdc); HeapFree( GetProcessHeap(), 0, physDev->handles ); HeapFree( GetProcessHeap(), 0, physDev ); return TRUE; @@ -265,8 +264,8 @@ HDC WINAPI CreateMetaFileW( LPCWSTR filename ) else /* memory based metafile */ physDev->mh->mtType = METAFILE_MEMORY; - TRACE("returning %p\n", dc->hSelf); - ret = dc->hSelf; + TRACE("returning %p\n", physDev->dev.hdc); + ret = physDev->dev.hdc; release_dc_ptr( dc ); return ret; } @@ -314,7 +313,7 @@ static DC *MFDRV_CloseMetaFile( HDC hdc ) } if (dc->refcount != 1) { - FIXME( "not deleting busy DC %p refcount %u\n", dc->hSelf, dc->refcount ); + FIXME( "not deleting busy DC %p refcount %u\n", hdc, dc->refcount ); release_dc_ptr( dc ); return NULL; } diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index 7c1581334b5..296cb47f44d 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -33,7 +33,6 @@ typedef struct { struct gdi_physdev dev; - HDC hdc; METAHEADER *mh; /* Pointer to metafile header */ UINT handles_size, cur_handles; HGDIOBJ *handles; diff --git a/dlls/gdi32/mfdrv/objects.c b/dlls/gdi32/mfdrv/objects.c index c4b160280ba..eea46894473 100644 --- a/dlls/gdi32/mfdrv/objects.c +++ b/dlls/gdi32/mfdrv/objects.c @@ -214,7 +214,6 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush ) DWORD size; METARECORD *mr; LOGBRUSH logbrush; - METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; BOOL r; if (!GetObjectA( hBrush, sizeof(logbrush), &logbrush )) return -1; @@ -282,12 +281,12 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush ) MFDRV_Reverse((LPBYTE)info + sizeof(BITMAPINFO) + sizeof(RGBQUAD), bm.bmWidth, bm.bmHeight); - cref = GetTextColor(physDev->hdc); + cref = GetTextColor( dev->hdc ); info->bmiColors[0].rgbRed = GetRValue(cref); info->bmiColors[0].rgbGreen = GetGValue(cref); info->bmiColors[0].rgbBlue = GetBValue(cref); info->bmiColors[0].rgbReserved = 0; - cref = GetBkColor(physDev->hdc); + cref = GetBkColor( dev->hdc ); info->bmiColors[1].rgbRed = GetRValue(cref); info->bmiColors[1].rgbGreen = GetGValue(cref); info->bmiColors[1].rgbBlue = GetBValue(cref); @@ -341,7 +340,6 @@ done: */ HBRUSH CDECL MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) { - METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; INT16 index; index = MFDRV_FindObject(dev, hbrush); @@ -350,7 +348,7 @@ HBRUSH CDECL MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) index = MFDRV_CreateBrushIndirect( dev, hbrush ); if( index < 0 ) return 0; - GDI_hdc_using_object(hbrush, physDev->hdc); + GDI_hdc_using_object(hbrush, dev->hdc); } return MFDRV_SelectObject( dev, index ) ? hbrush : HGDI_ERROR; } @@ -398,7 +396,6 @@ static UINT16 MFDRV_CreateFontIndirect(PHYSDEV dev, HFONT hFont, LOGFONTW *logfo */ HFONT CDECL MFDRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) { - METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; LOGFONTW font; INT16 index; @@ -410,7 +407,7 @@ HFONT CDECL MFDRV_SelectFont( PHYSDEV dev, HFONT hfont, HANDLE gdiFont ) index = MFDRV_CreateFontIndirect(dev, hfont, &font); if( index < 0 ) return HGDI_ERROR; - GDI_hdc_using_object(hfont, physDev->hdc); + GDI_hdc_using_object(hfont, dev->hdc); } return MFDRV_SelectObject( dev, index ) ? hfont : HGDI_ERROR; } @@ -437,7 +434,6 @@ static UINT16 MFDRV_CreatePenIndirect(PHYSDEV dev, HPEN hPen, LOGPEN16 *logpen) */ HPEN CDECL MFDRV_SelectPen( PHYSDEV dev, HPEN hpen ) { - METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; LOGPEN16 logpen; INT16 index; @@ -476,7 +472,7 @@ HPEN CDECL MFDRV_SelectPen( PHYSDEV dev, HPEN hpen ) index = MFDRV_CreatePenIndirect( dev, hpen, &logpen ); if( index < 0 ) return 0; - GDI_hdc_using_object(hpen, physDev->hdc); + GDI_hdc_using_object(hpen, dev->hdc); } return MFDRV_SelectObject( dev, index ) ? hpen : HGDI_ERROR; } diff --git a/dlls/gdi32/mfdrv/text.c b/dlls/gdi32/mfdrv/text.c index 3ec37033801..5722211c140 100644 --- a/dlls/gdi32/mfdrv/text.c +++ b/dlls/gdi32/mfdrv/text.c @@ -84,8 +84,7 @@ MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, LPSTR ascii; DWORD len; CHARSETINFO csi; - METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev; - int charset = GetTextCharset(physDev->hdc); + int charset = GetTextCharset( dev->hdc ); UINT cp = CP_ACP; if(TranslateCharsetInfo(ULongToPtr(charset), &csi, TCI_SRCCHARSET))