gdi32: Use the hdc from the generic physdev structure in enhanced metafiles.
This commit is contained in:
parent
edb68487f4
commit
71c6f48269
|
@ -42,7 +42,7 @@ BOOL CDECL EMFDRV_RestoreDC( PHYSDEV dev, INT level )
|
|||
{
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRestoreDC );
|
||||
EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
|
||||
DC *dc = get_dc_ptr( physDev->hdc );
|
||||
DC *dc = get_dc_ptr( dev->hdc );
|
||||
EMRRESTOREDC emr;
|
||||
BOOL ret;
|
||||
|
||||
|
@ -357,10 +357,9 @@ BOOL CDECL EMFDRV_OffsetViewportOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
|
|||
{
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pOffsetViewportOrgEx );
|
||||
EMRSETVIEWPORTORGEX emr;
|
||||
EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
|
||||
POINT prev;
|
||||
|
||||
GetViewportOrgEx(physDev->hdc, &prev);
|
||||
GetViewportOrgEx( dev->hdc, &prev );
|
||||
|
||||
emr.emr.iType = EMR_SETVIEWPORTORGEX;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
|
@ -375,10 +374,9 @@ BOOL CDECL EMFDRV_OffsetWindowOrgEx( PHYSDEV dev, INT x, INT y, POINT *pt )
|
|||
{
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pOffsetWindowOrgEx );
|
||||
EMRSETWINDOWORGEX emr;
|
||||
EMFDRV_PDEVICE* physDev = (EMFDRV_PDEVICE*)dev;
|
||||
POINT prev;
|
||||
|
||||
GetWindowOrgEx(physDev->hdc, &prev);
|
||||
GetWindowOrgEx( dev->hdc, &prev );
|
||||
|
||||
emr.emr.iType = EMR_SETWINDOWORGEX;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
typedef struct
|
||||
{
|
||||
struct gdi_physdev dev;
|
||||
HDC hdc;
|
||||
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
|
||||
UINT handles_size, cur_handles;
|
||||
HGDIOBJ *handles;
|
||||
|
|
|
@ -58,7 +58,6 @@ EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
|
|||
POINT pt;
|
||||
EMRLINETO emr;
|
||||
RECTL bounds;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
|
||||
emr.emr.iType = EMR_LINETO;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
|
@ -68,7 +67,7 @@ EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
|
|||
if(!EMFDRV_WriteRecord( dev, &emr.emr ))
|
||||
return FALSE;
|
||||
|
||||
GetCurrentPositionEx(physDev->hdc, &pt);
|
||||
GetCurrentPositionEx( dev->hdc, &pt );
|
||||
|
||||
bounds.left = min(x, pt.x);
|
||||
bounds.top = min(y, pt.y);
|
||||
|
@ -93,14 +92,13 @@ EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|||
double xinterStart, yinterStart, xinterEnd, yinterEnd;
|
||||
EMRARC emr;
|
||||
RECTL bounds;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
|
||||
if(left == right || top == bottom) return FALSE;
|
||||
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
|
@ -227,7 +225,6 @@ EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
|||
{
|
||||
EMRELLIPSE emr;
|
||||
INT temp;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
|
||||
TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
|
||||
|
||||
|
@ -236,7 +233,7 @@ EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
|||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
|
@ -260,7 +257,6 @@ EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
|||
{
|
||||
EMRRECTANGLE emr;
|
||||
INT temp;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
|
||||
TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
|
||||
|
||||
|
@ -269,7 +265,7 @@ EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
|
|||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
|
@ -294,14 +290,13 @@ EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
|
|||
{
|
||||
EMRROUNDRECT emr;
|
||||
INT temp;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
|
||||
|
||||
if(left == right || top == bottom) return FALSE;
|
||||
|
||||
if(left > right) {temp = left; left = right; right = temp;}
|
||||
if(top > bottom) {temp = top; top = bottom; bottom = temp;}
|
||||
|
||||
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) {
|
||||
if(GetGraphicsMode( dev->hdc ) == GM_COMPATIBLE) {
|
||||
right--;
|
||||
bottom--;
|
||||
}
|
||||
|
@ -687,11 +682,10 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
EMREXTTEXTOUTW *pemr;
|
||||
DWORD nSize;
|
||||
BOOL ret;
|
||||
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
|
||||
int textHeight = 0;
|
||||
int textWidth = 0;
|
||||
const UINT textAlign = GetTextAlign(physDev->hdc);
|
||||
const INT graphicsMode = GetGraphicsMode(physDev->hdc);
|
||||
const UINT textAlign = GetTextAlign( dev->hdc );
|
||||
const INT graphicsMode = GetGraphicsMode( dev->hdc );
|
||||
FLOAT exScale, eyScale;
|
||||
|
||||
nSize = sizeof(*pemr) + ((count+1) & ~1) * sizeof(WCHAR) + count * sizeof(INT);
|
||||
|
@ -702,14 +696,14 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
|
||||
if (graphicsMode == GM_COMPATIBLE)
|
||||
{
|
||||
const INT horzSize = GetDeviceCaps(physDev->hdc, HORZSIZE);
|
||||
const INT horzRes = GetDeviceCaps(physDev->hdc, HORZRES);
|
||||
const INT vertSize = GetDeviceCaps(physDev->hdc, VERTSIZE);
|
||||
const INT vertRes = GetDeviceCaps(physDev->hdc, VERTRES);
|
||||
const INT horzSize = GetDeviceCaps( dev->hdc, HORZSIZE );
|
||||
const INT horzRes = GetDeviceCaps( dev->hdc, HORZRES );
|
||||
const INT vertSize = GetDeviceCaps( dev->hdc, VERTSIZE );
|
||||
const INT vertRes = GetDeviceCaps( dev->hdc, VERTRES );
|
||||
SIZE wndext, vportext;
|
||||
|
||||
GetViewportExtEx(physDev->hdc, &vportext);
|
||||
GetWindowExtEx(physDev->hdc, &wndext);
|
||||
GetViewportExtEx( dev->hdc, &vportext );
|
||||
GetWindowExtEx( dev->hdc, &wndext );
|
||||
exScale = 100.0 * ((FLOAT)horzSize / (FLOAT)horzRes) /
|
||||
((FLOAT)wndext.cx / (FLOAT)vportext.cx);
|
||||
eyScale = 100.0 * ((FLOAT)vertSize / (FLOAT)vertRes) /
|
||||
|
@ -750,7 +744,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
for (i = 0; i < count; i++) {
|
||||
textWidth += lpDx[i];
|
||||
}
|
||||
if (GetTextExtentPoint32W(physDev->hdc, str, count, &strSize))
|
||||
if (GetTextExtentPoint32W( dev->hdc, str, count, &strSize ))
|
||||
textHeight = strSize.cy;
|
||||
}
|
||||
else {
|
||||
|
@ -758,7 +752,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
INT *dx = (INT *)((char*)pemr + pemr->emrtext.offDx);
|
||||
SIZE charSize;
|
||||
for (i = 0; i < count; i++) {
|
||||
if (GetTextExtentPoint32W(physDev->hdc, str + i, 1, &charSize)) {
|
||||
if (GetTextExtentPoint32W( dev->hdc, str + i, 1, &charSize )) {
|
||||
dx[i] = charSize.cx;
|
||||
textWidth += charSize.cx;
|
||||
textHeight = max(textHeight, charSize.cy);
|
||||
|
@ -793,7 +787,7 @@ BOOL CDECL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
|||
switch (textAlign & (TA_TOP | TA_BOTTOM | TA_BASELINE)) {
|
||||
case TA_BASELINE: {
|
||||
TEXTMETRICW tm;
|
||||
if (!GetTextMetricsW(physDev->hdc, &tm))
|
||||
if (!GetTextMetricsW( dev->hdc, &tm ))
|
||||
tm.tmDescent = 0;
|
||||
/* Play safe here... it's better to have a bounding box */
|
||||
/* that is too big than too small. */
|
||||
|
|
|
@ -169,7 +169,7 @@ static BOOL CDECL EMFDRV_DeleteDC( PHYSDEV dev )
|
|||
if (physDev->emh) HeapFree( GetProcessHeap(), 0, physDev->emh );
|
||||
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;
|
||||
|
@ -223,8 +223,8 @@ void EMFDRV_UpdateBBox( PHYSDEV dev, RECTL *rect )
|
|||
RECTL *bounds = &physDev->emh->rclBounds;
|
||||
RECTL vportRect = *rect;
|
||||
|
||||
LPtoDP(physDev->hdc, (LPPOINT)&vportRect, 2);
|
||||
|
||||
LPtoDP( dev->hdc, (LPPOINT)&vportRect, 2 );
|
||||
|
||||
/* The coordinate systems may be mirrored
|
||||
(LPtoDP handles points, not rectangles) */
|
||||
if (vportRect.left > vportRect.right)
|
||||
|
@ -334,7 +334,6 @@ HDC WINAPI CreateEnhMetaFileW(
|
|||
}
|
||||
|
||||
push_dc_driver( dc, &physDev->dev, &EMFDRV_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;
|
||||
|
@ -356,7 +355,7 @@ HDC WINAPI CreateEnhMetaFileW(
|
|||
physDev->numcolors = GetDeviceCaps(hRefDC, NUMCOLORS);
|
||||
physDev->restoring = 0;
|
||||
|
||||
SetVirtualResolution(dc->hSelf, 0, 0, 0, 0);
|
||||
SetVirtualResolution(physDev->dev.hdc, 0, 0, 0, 0);
|
||||
|
||||
physDev->emh->iType = EMR_HEADER;
|
||||
physDev->emh->nSize = size;
|
||||
|
@ -415,8 +414,8 @@ HDC WINAPI CreateEnhMetaFileW(
|
|||
physDev->hFile = hFile;
|
||||
}
|
||||
|
||||
TRACE("returning %p\n", dc->hSelf);
|
||||
ret = dc->hSelf;
|
||||
TRACE("returning %p\n", physDev->dev.hdc);
|
||||
ret = physDev->dev.hdc;
|
||||
release_dc_ptr( dc );
|
||||
|
||||
if( !hdc )
|
||||
|
@ -446,7 +445,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -299,7 +299,7 @@ HBRUSH CDECL EMFDRV_SelectBrush(PHYSDEV dev, HBRUSH hBrush )
|
|||
goto found;
|
||||
|
||||
if (!(index = EMFDRV_CreateBrushIndirect(dev, hBrush ))) return 0;
|
||||
GDI_hdc_using_object(hBrush, physDev->hdc);
|
||||
GDI_hdc_using_object(hBrush, dev->hdc);
|
||||
|
||||
found:
|
||||
emr.emr.iType = EMR_SELECTOBJECT;
|
||||
|
@ -380,7 +380,7 @@ HFONT CDECL EMFDRV_SelectFont( PHYSDEV dev, HFONT hFont, HANDLE gdiFont )
|
|||
goto found;
|
||||
|
||||
if (!(index = EMFDRV_CreateFontIndirect(dev, hFont ))) return HGDI_ERROR;
|
||||
GDI_hdc_using_object(hFont, physDev->hdc);
|
||||
GDI_hdc_using_object(hFont, dev->hdc);
|
||||
|
||||
found:
|
||||
emr.emr.iType = EMR_SELECTOBJECT;
|
||||
|
@ -460,7 +460,7 @@ HPEN CDECL EMFDRV_SelectPen(PHYSDEV dev, HPEN hPen )
|
|||
goto found;
|
||||
|
||||
if (!(index = EMFDRV_CreatePenIndirect(dev, hPen))) return 0;
|
||||
GDI_hdc_using_object(hPen, physDev->hdc);
|
||||
GDI_hdc_using_object(hPen, dev->hdc);
|
||||
|
||||
found:
|
||||
emr.emr.iType = EMR_SELECTOBJECT;
|
||||
|
@ -519,7 +519,7 @@ HPALETTE CDECL EMFDRV_SelectPalette( PHYSDEV dev, HPALETTE hPal, BOOL force )
|
|||
goto found;
|
||||
|
||||
if (!(index = EMFDRV_CreatePalette( dev, hPal ))) return 0;
|
||||
GDI_hdc_using_object( hPal, physDev->hdc );
|
||||
GDI_hdc_using_object( hPal, dev->hdc );
|
||||
|
||||
found:
|
||||
emr.emr.iType = EMR_SELECTPALETTE;
|
||||
|
@ -537,12 +537,12 @@ COLORREF CDECL EMFDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color )
|
|||
EMRSELECTOBJECT emr;
|
||||
DWORD index;
|
||||
|
||||
if (GetCurrentObject( physDev->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return color;
|
||||
if (GetCurrentObject( dev->hdc, OBJ_BRUSH ) != GetStockObject( DC_BRUSH )) return color;
|
||||
|
||||
if (physDev->dc_brush) DeleteObject( physDev->dc_brush );
|
||||
if (!(physDev->dc_brush = CreateSolidBrush( color ))) return CLR_INVALID;
|
||||
if (!(index = EMFDRV_CreateBrushIndirect(dev, physDev->dc_brush ))) return CLR_INVALID;
|
||||
GDI_hdc_using_object( physDev->dc_brush, physDev->hdc );
|
||||
GDI_hdc_using_object( physDev->dc_brush, dev->hdc );
|
||||
emr.emr.iType = EMR_SELECTOBJECT;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.ihObject = index;
|
||||
|
@ -559,12 +559,12 @@ COLORREF CDECL EMFDRV_SetDCPenColor( PHYSDEV dev, COLORREF color )
|
|||
DWORD index;
|
||||
LOGPEN logpen = { PS_SOLID, { 0, 0 }, color };
|
||||
|
||||
if (GetCurrentObject( physDev->hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return color;
|
||||
if (GetCurrentObject( dev->hdc, OBJ_PEN ) != GetStockObject( DC_PEN )) return color;
|
||||
|
||||
if (physDev->dc_pen) DeleteObject( physDev->dc_pen );
|
||||
if (!(physDev->dc_pen = CreatePenIndirect( &logpen ))) return CLR_INVALID;
|
||||
if (!(index = EMFDRV_CreatePenIndirect(dev, physDev->dc_pen))) return CLR_INVALID;
|
||||
GDI_hdc_using_object( physDev->dc_pen, physDev->hdc );
|
||||
GDI_hdc_using_object( physDev->dc_pen, dev->hdc );
|
||||
emr.emr.iType = EMR_SELECTOBJECT;
|
||||
emr.emr.nSize = sizeof(emr);
|
||||
emr.ihObject = index;
|
||||
|
|
Loading…
Reference in New Issue