Commit e21c15e3 authored by Alexandre Julliard's avatar Alexandre Julliard

Changed the GDI driver interface to pass an opaque PHYSDEV pointer

instead of a DC structure. Removed some direct accesses to the DC structure from the drivers. Got rid the bitmap driver.
parent c4912ecd
...@@ -27,12 +27,10 @@ C_SRCS = \ ...@@ -27,12 +27,10 @@ C_SRCS = \
mfdrv/objects.c \ mfdrv/objects.c \
mfdrv/text.c \ mfdrv/text.c \
printdrv.c \ printdrv.c \
win16drv/brush.c \
win16drv/font.c \ win16drv/font.c \
win16drv/graphics.c \ win16drv/graphics.c \
win16drv/init.c \ win16drv/init.c \
win16drv/objects.c \ win16drv/objects.c \
win16drv/pen.c \
win16drv/prtdrv.c \ win16drv/prtdrv.c \
win16drv/text.c \ win16drv/text.c \
wing.c wing.c
......
...@@ -96,6 +96,8 @@ static struct graphics_driver *create_driver( HMODULE module ) ...@@ -96,6 +96,8 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(FrameRgn); GET_FUNC(FrameRgn);
GET_FUNC(GetCharWidth); GET_FUNC(GetCharWidth);
GET_FUNC(GetDCOrgEx); GET_FUNC(GetDCOrgEx);
GET_FUNC(GetDIBColorTable);
GET_FUNC(GetDIBits);
GET_FUNC(GetDeviceCaps); GET_FUNC(GetDeviceCaps);
GET_FUNC(GetDeviceGammaRamp); GET_FUNC(GetDeviceGammaRamp);
GET_FUNC(GetPixel); GET_FUNC(GetPixel);
...@@ -127,12 +129,17 @@ static struct graphics_driver *create_driver( HMODULE module ) ...@@ -127,12 +129,17 @@ static struct graphics_driver *create_driver( HMODULE module )
GET_FUNC(SaveDC); GET_FUNC(SaveDC);
GET_FUNC(ScaleViewportExt); GET_FUNC(ScaleViewportExt);
GET_FUNC(ScaleWindowExt); GET_FUNC(ScaleWindowExt);
GET_FUNC(SelectBitmap);
GET_FUNC(SelectBrush);
GET_FUNC(SelectClipPath); GET_FUNC(SelectClipPath);
GET_FUNC(SelectClipRgn); GET_FUNC(SelectClipRgn);
GET_FUNC(SelectObject); GET_FUNC(SelectFont);
GET_FUNC(SelectPalette); GET_FUNC(SelectPalette);
GET_FUNC(SelectPen);
GET_FUNC(SetBkColor); GET_FUNC(SetBkColor);
GET_FUNC(SetBkMode); GET_FUNC(SetBkMode);
GET_FUNC(SetDIBColorTable);
GET_FUNC(SetDIBits);
GET_FUNC(SetDIBitsToDevice); GET_FUNC(SetDIBitsToDevice);
GET_FUNC(SetDeviceClipping); GET_FUNC(SetDeviceClipping);
GET_FUNC(SetDeviceGammaRamp); GET_FUNC(SetDeviceGammaRamp);
......
...@@ -23,78 +23,78 @@ ...@@ -23,78 +23,78 @@
WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile); WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
INT EMFDRV_SaveDC( DC *dc ) INT EMFDRV_SaveDC( PHYSDEV dev )
{ {
EMRSAVEDC emr; EMRSAVEDC emr;
emr.emr.iType = EMR_SAVEDC; emr.emr.iType = EMR_SAVEDC;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_RestoreDC( DC *dc, INT level ) BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level )
{ {
EMRRESTOREDC emr; EMRRESTOREDC emr;
emr.emr.iType = EMR_RESTOREDC; emr.emr.iType = EMR_RESTOREDC;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iRelative = level; emr.iRelative = level;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
UINT EMFDRV_SetTextAlign( DC *dc, UINT align ) UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align )
{ {
EMRSETTEXTALIGN emr; EMRSETTEXTALIGN emr;
emr.emr.iType = EMR_SETTEXTALIGN; emr.emr.iType = EMR_SETTEXTALIGN;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = align; emr.iMode = align;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_SetBkMode( DC *dc, INT mode ) INT EMFDRV_SetBkMode( PHYSDEV dev, INT mode )
{ {
EMRSETBKMODE emr; EMRSETBKMODE emr;
emr.emr.iType = EMR_SETBKMODE; emr.emr.iType = EMR_SETBKMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_SetROP2( DC *dc, INT rop ) INT EMFDRV_SetROP2( PHYSDEV dev, INT rop )
{ {
EMRSETROP2 emr; EMRSETROP2 emr;
emr.emr.iType = EMR_SETROP2; emr.emr.iType = EMR_SETROP2;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = rop; emr.iMode = rop;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_SetPolyFillMode( DC *dc, INT mode ) INT EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
{ {
EMRSETPOLYFILLMODE emr; EMRSETPOLYFILLMODE emr;
emr.emr.iType = EMR_SETPOLYFILLMODE; emr.emr.iType = EMR_SETPOLYFILLMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_SetStretchBltMode( DC *dc, INT mode ) INT EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
{ {
EMRSETSTRETCHBLTMODE emr; EMRSETSTRETCHBLTMODE emr;
emr.emr.iType = EMR_SETSTRETCHBLTMODE; emr.emr.iType = EMR_SETSTRETCHBLTMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_SetMapMode( DC *dc, INT mode ) INT EMFDRV_SetMapMode( PHYSDEV dev, INT mode )
{ {
EMRSETMAPMODE emr; EMRSETMAPMODE emr;
emr.emr.iType = EMR_SETMAPMODE; emr.emr.iType = EMR_SETMAPMODE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = mode; emr.iMode = mode;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT bottom ) INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{ {
EMREXCLUDECLIPRECT emr; EMREXCLUDECLIPRECT emr;
emr.emr.iType = EMR_EXCLUDECLIPRECT; emr.emr.iType = EMR_EXCLUDECLIPRECT;
...@@ -103,10 +103,10 @@ INT EMFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT bottom ) ...@@ -103,10 +103,10 @@ INT EMFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT bottom )
emr.rclClip.top = top; emr.rclClip.top = top;
emr.rclClip.right = right; emr.rclClip.right = right;
emr.rclClip.bottom = bottom; emr.rclClip.bottom = bottom;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT bottom) INT EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom)
{ {
EMRINTERSECTCLIPRECT emr; EMRINTERSECTCLIPRECT emr;
emr.emr.iType = EMR_INTERSECTCLIPRECT; emr.emr.iType = EMR_INTERSECTCLIPRECT;
...@@ -115,20 +115,20 @@ INT EMFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT bottom) ...@@ -115,20 +115,20 @@ INT EMFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT bottom)
emr.rclClip.top = top; emr.rclClip.top = top;
emr.rclClip.right = right; emr.rclClip.right = right;
emr.rclClip.bottom = bottom; emr.rclClip.bottom = bottom;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
INT EMFDRV_OffsetClipRgn( DC *dc, INT x, INT y ) INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
{ {
EMROFFSETCLIPRGN emr; EMROFFSETCLIPRGN emr;
emr.emr.iType = EMR_OFFSETCLIPRGN; emr.emr.iType = EMR_OFFSETCLIPRGN;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ptlOffset.x = x; emr.ptlOffset.x = x;
emr.ptlOffset.y = y; emr.ptlOffset.y = y;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
DWORD EMFDRV_SetMapperFlags( DC *dc, DWORD flags ) DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
{ {
EMRSETMAPPERFLAGS emr; EMRSETMAPPERFLAGS emr;
...@@ -136,50 +136,50 @@ DWORD EMFDRV_SetMapperFlags( DC *dc, DWORD flags ) ...@@ -136,50 +136,50 @@ DWORD EMFDRV_SetMapperFlags( DC *dc, DWORD flags )
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.dwFlags = flags; emr.dwFlags = flags;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_AbortPath( DC *dc ) BOOL EMFDRV_AbortPath( PHYSDEV dev )
{ {
EMRABORTPATH emr; EMRABORTPATH emr;
emr.emr.iType = EMR_ABORTPATH; emr.emr.iType = EMR_ABORTPATH;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_BeginPath( DC *dc ) BOOL EMFDRV_BeginPath( PHYSDEV dev )
{ {
EMRBEGINPATH emr; EMRBEGINPATH emr;
emr.emr.iType = EMR_BEGINPATH; emr.emr.iType = EMR_BEGINPATH;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_CloseFigure( DC *dc ) BOOL EMFDRV_CloseFigure( PHYSDEV dev )
{ {
EMRCLOSEFIGURE emr; EMRCLOSEFIGURE emr;
emr.emr.iType = EMR_CLOSEFIGURE; emr.emr.iType = EMR_CLOSEFIGURE;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_EndPath( DC *dc ) BOOL EMFDRV_EndPath( PHYSDEV dev )
{ {
EMRENDPATH emr; EMRENDPATH emr;
emr.emr.iType = EMR_ENDPATH; emr.emr.iType = EMR_ENDPATH;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_FillPath( DC *dc ) BOOL EMFDRV_FillPath( PHYSDEV dev )
{ {
EMRFILLPATH emr; EMRFILLPATH emr;
...@@ -190,20 +190,20 @@ BOOL EMFDRV_FillPath( DC *dc ) ...@@ -190,20 +190,20 @@ BOOL EMFDRV_FillPath( DC *dc )
emr.rclBounds.top = 0; emr.rclBounds.top = 0;
emr.rclBounds.right = 0; emr.rclBounds.right = 0;
emr.rclBounds.bottom = 0; emr.rclBounds.bottom = 0;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_FlattenPath( DC *dc ) BOOL EMFDRV_FlattenPath( PHYSDEV dev )
{ {
EMRFLATTENPATH emr; EMRFLATTENPATH emr;
emr.emr.iType = EMR_FLATTENPATH; emr.emr.iType = EMR_FLATTENPATH;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_SelectClipPath( DC *dc, INT iMode ) BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
{ {
EMRSELECTCLIPPATH emr; EMRSELECTCLIPPATH emr;
...@@ -211,10 +211,10 @@ BOOL EMFDRV_SelectClipPath( DC *dc, INT iMode ) ...@@ -211,10 +211,10 @@ BOOL EMFDRV_SelectClipPath( DC *dc, INT iMode )
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.iMode = iMode; emr.iMode = iMode;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_StrokeAndFillPath( DC *dc ) BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev )
{ {
EMRSTROKEANDFILLPATH emr; EMRSTROKEANDFILLPATH emr;
...@@ -225,10 +225,10 @@ BOOL EMFDRV_StrokeAndFillPath( DC *dc ) ...@@ -225,10 +225,10 @@ BOOL EMFDRV_StrokeAndFillPath( DC *dc )
emr.rclBounds.top = 0; emr.rclBounds.top = 0;
emr.rclBounds.right = 0; emr.rclBounds.right = 0;
emr.rclBounds.bottom = 0; emr.rclBounds.bottom = 0;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_StrokePath( DC *dc ) BOOL EMFDRV_StrokePath( PHYSDEV dev )
{ {
EMRSTROKEPATH emr; EMRSTROKEPATH emr;
...@@ -239,15 +239,15 @@ BOOL EMFDRV_StrokePath( DC *dc ) ...@@ -239,15 +239,15 @@ BOOL EMFDRV_StrokePath( DC *dc )
emr.rclBounds.top = 0; emr.rclBounds.top = 0;
emr.rclBounds.right = 0; emr.rclBounds.right = 0;
emr.rclBounds.bottom = 0; emr.rclBounds.bottom = 0;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_WidenPath( DC *dc ) BOOL EMFDRV_WidenPath( PHYSDEV dev )
{ {
EMRWIDENPATH emr; EMRWIDENPATH emr;
emr.emr.iType = EMR_WIDENPATH; emr.emr.iType = EMR_WIDENPATH;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
...@@ -42,9 +42,9 @@ static const DC_FUNCTIONS EMFDRV_Funcs = ...@@ -42,9 +42,9 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_Chord, /* pChord */ EMFDRV_Chord, /* pChord */
EMFDRV_CloseFigure, /* pCloseFigure */ EMFDRV_CloseFigure, /* pCloseFigure */
NULL, /* pCreateBitmap */ NULL, /* pCreateBitmap */
NULL, /* no implementation */ /* pCreateDC */ NULL, /* pCreateDC */
NULL, /* pCreateDIBSection */ NULL, /* pCreateDIBSection */
NULL, /* no implementation */ /* pDeleteDC */ NULL, /* pDeleteDC */
NULL, /* pDeleteObject */ NULL, /* pDeleteObject */
NULL, /* pDescribePixelFormat */ NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */ NULL, /* pDeviceCapabilities */
...@@ -64,9 +64,11 @@ static const DC_FUNCTIONS EMFDRV_Funcs = ...@@ -64,9 +64,11 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_FrameRgn, /* pFrameRgn */ EMFDRV_FrameRgn, /* pFrameRgn */
NULL, /* pGetCharWidth */ NULL, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */ NULL, /* pGetDCOrgEx */
NULL, /* pGetDIBColorTable */
NULL, /* pGetDIBits */
NULL, /* pGetDeviceCaps */ NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */ NULL, /* pGetDeviceGammaRamp */
NULL, /* no implementation */ /* pGetPixel */ NULL, /* pGetPixel */
NULL, /* pGetPixelFormat */ NULL, /* pGetPixelFormat */
NULL, /* pGetTextExtentPoint */ NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */ NULL, /* pGetTextMetrics */
...@@ -95,15 +97,20 @@ static const DC_FUNCTIONS EMFDRV_Funcs = ...@@ -95,15 +97,20 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
EMFDRV_SaveDC, /* pSaveDC */ EMFDRV_SaveDC, /* pSaveDC */
EMFDRV_ScaleViewportExt, /* pScaleViewportExt */ EMFDRV_ScaleViewportExt, /* pScaleViewportExt */
EMFDRV_ScaleWindowExt, /* pScaleWindowExt */ EMFDRV_ScaleWindowExt, /* pScaleWindowExt */
EMFDRV_SelectBitmap, /* pSelectBitmap */
EMFDRV_SelectBrush, /* pSelectBrush */
EMFDRV_SelectClipPath, /* pSelectClipPath */ EMFDRV_SelectClipPath, /* pSelectClipPath */
NULL, /* pSelectClipRgn */ NULL, /* pSelectClipRgn */
EMFDRV_SelectObject, /* pSelectObject */ EMFDRV_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */ NULL, /* pSelectPalette */
EMFDRV_SelectPen, /* pSelectPen */
EMFDRV_SetBkColor, /* pSetBkColor */ EMFDRV_SetBkColor, /* pSetBkColor */
EMFDRV_SetBkMode, /* pSetBkMode */ EMFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */ NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
NULL, /* pSetDIBitsToDevice */
EMFDRV_SetMapMode, /* pSetMapMode */ EMFDRV_SetMapMode, /* pSetMapMode */
EMFDRV_SetMapperFlags, /* pSetMapperFlags */ EMFDRV_SetMapperFlags, /* pSetMapperFlags */
NULL, /* pSetPixel */ NULL, /* pSetPixel */
...@@ -134,9 +141,10 @@ static const DC_FUNCTIONS EMFDRV_Funcs = ...@@ -134,9 +141,10 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
/********************************************************************** /**********************************************************************
* EMFDRV_DeleteDC * EMFDRV_DeleteDC
*/ */
static BOOL EMFDRV_DeleteDC( DC *dc ) static BOOL EMFDRV_DeleteDC( PHYSDEV dev )
{ {
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dc->physDev; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
if (physDev->emh) HeapFree( GetProcessHeap(), 0, physDev->emh ); if (physDev->emh) HeapFree( GetProcessHeap(), 0, physDev->emh );
HeapFree( GetProcessHeap(), 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
...@@ -151,11 +159,11 @@ static BOOL EMFDRV_DeleteDC( DC *dc ) ...@@ -151,11 +159,11 @@ static BOOL EMFDRV_DeleteDC( DC *dc )
* *
* Warning: this function can change the pointer to the metafile header. * Warning: this function can change the pointer to the metafile header.
*/ */
BOOL EMFDRV_WriteRecord( DC *dc, EMR *emr ) BOOL EMFDRV_WriteRecord( PHYSDEV dev, EMR *emr )
{ {
DWORD len; DWORD len;
ENHMETAHEADER *emh; ENHMETAHEADER *emh;
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dc->physDev; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
physDev->emh->nBytes += emr->nSize; physDev->emh->nBytes += emr->nSize;
physDev->emh->nRecords++; physDev->emh->nRecords++;
...@@ -179,9 +187,9 @@ BOOL EMFDRV_WriteRecord( DC *dc, EMR *emr ) ...@@ -179,9 +187,9 @@ BOOL EMFDRV_WriteRecord( DC *dc, EMR *emr )
/****************************************************************** /******************************************************************
* EMFDRV_UpdateBBox * EMFDRV_UpdateBBox
*/ */
void EMFDRV_UpdateBBox( DC *dc, RECTL *rect ) void EMFDRV_UpdateBBox( PHYSDEV dev, RECTL *rect )
{ {
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dc->physDev; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
RECTL *bounds = &physDev->emh->rclBounds; RECTL *bounds = &physDev->emh->rclBounds;
if(bounds->left > bounds->right) {/* first rect */ if(bounds->left > bounds->right) {/* first rect */
...@@ -202,9 +210,9 @@ void EMFDRV_UpdateBBox( DC *dc, RECTL *rect ) ...@@ -202,9 +210,9 @@ void EMFDRV_UpdateBBox( DC *dc, RECTL *rect )
* If we do someday, we'll need to maintain a table to re-use deleted * If we do someday, we'll need to maintain a table to re-use deleted
* handles. * handles.
*/ */
int EMFDRV_AddHandleDC( DC *dc ) int EMFDRV_AddHandleDC( PHYSDEV dev )
{ {
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dc->physDev; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
physDev->emh->nHandles++; physDev->emh->nHandles++;
return physDev->nextHandle++; return physDev->nextHandle++;
} }
...@@ -276,7 +284,9 @@ HDC WINAPI CreateEnhMetaFileW( ...@@ -276,7 +284,9 @@ HDC WINAPI CreateEnhMetaFileW(
GDI_FreeObject( dc->hSelf, dc ); GDI_FreeObject( dc->hSelf, dc );
return 0; return 0;
} }
dc->physDev = physDev; dc->physDev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
if(description) { /* App name\0Title\0\0 */ if(description) { /* App name\0Title\0\0 */
length = lstrlenW(description); length = lstrlenW(description);
...@@ -338,11 +348,11 @@ HDC WINAPI CreateEnhMetaFileW( ...@@ -338,11 +348,11 @@ HDC WINAPI CreateEnhMetaFileW(
{ {
if ((hFile = CreateFileW(filename, GENERIC_WRITE | GENERIC_READ, 0, if ((hFile = CreateFileW(filename, GENERIC_WRITE | GENERIC_READ, 0,
NULL, CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) { NULL, CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
EMFDRV_DeleteDC( dc ); EMFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
if (!WriteFile( hFile, (LPSTR)physDev->emh, size, NULL, NULL )) { if (!WriteFile( hFile, (LPSTR)physDev->emh, size, NULL, NULL )) {
EMFDRV_DeleteDC( dc ); EMFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
physDev->hFile = hFile; physDev->hFile = hFile;
...@@ -379,7 +389,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */ ...@@ -379,7 +389,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
emr.nPalEntries = 0; emr.nPalEntries = 0;
emr.offPalEntries = 0; emr.offPalEntries = 0;
emr.nSizeLast = emr.emr.nSize; emr.nSizeLast = emr.emr.nSize;
EMFDRV_WriteRecord( dc, &emr.emr ); EMFDRV_WriteRecord( dc->physDev, &emr.emr );
/* Update rclFrame if not initialized in CreateEnhMetaFile */ /* Update rclFrame if not initialized in CreateEnhMetaFile */
if(physDev->emh->rclFrame.left > physDev->emh->rclFrame.right) { if(physDev->emh->rclFrame.left > physDev->emh->rclFrame.right) {
...@@ -398,7 +408,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */ ...@@ -398,7 +408,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0)
{ {
CloseHandle( physDev->hFile ); CloseHandle( physDev->hFile );
EMFDRV_DeleteDC( dc ); EMFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
...@@ -406,7 +416,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */ ...@@ -406,7 +416,7 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
sizeof(*physDev->emh), NULL, NULL)) sizeof(*physDev->emh), NULL, NULL))
{ {
CloseHandle( physDev->hFile ); CloseHandle( physDev->hFile );
EMFDRV_DeleteDC( dc ); EMFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
HeapFree( GetProcessHeap(), 0, physDev->emh ); HeapFree( GetProcessHeap(), 0, physDev->emh );
...@@ -421,6 +431,6 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */ ...@@ -421,6 +431,6 @@ HENHMETAFILE WINAPI CloseEnhMetaFile(HDC hdc) /* [in] metafile DC */
hmf = EMF_Create_HENHMETAFILE( physDev->emh, (physDev->hFile != 0) ); hmf = EMF_Create_HENHMETAFILE( physDev->emh, (physDev->hFile != 0) );
physDev->emh = NULL; /* So it won't be deleted */ physDev->emh = NULL; /* So it won't be deleted */
EMFDRV_DeleteDC( dc ); EMFDRV_DeleteDC( dc->physDev );
return hmf; return hmf;
} }
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "enhmfdrv/enhmetafiledrv.h" #include "enhmfdrv/enhmetafiledrv.h"
BOOL EMFDRV_SetViewportExt( DC *dc, INT cx, INT cy ) BOOL EMFDRV_SetViewportExt( PHYSDEV dev, INT cx, INT cy )
{ {
EMRSETVIEWPORTEXTEX emr; EMRSETVIEWPORTEXTEX emr;
...@@ -29,10 +29,10 @@ BOOL EMFDRV_SetViewportExt( DC *dc, INT cx, INT cy ) ...@@ -29,10 +29,10 @@ BOOL EMFDRV_SetViewportExt( DC *dc, INT cx, INT cy )
emr.szlExtent.cx = cx; emr.szlExtent.cx = cx;
emr.szlExtent.cy = cy; emr.szlExtent.cy = cy;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_SetWindowExt( DC *dc, INT cx, INT cy ) BOOL EMFDRV_SetWindowExt( PHYSDEV dev, INT cx, INT cy )
{ {
EMRSETWINDOWEXTEX emr; EMRSETWINDOWEXTEX emr;
...@@ -41,10 +41,10 @@ BOOL EMFDRV_SetWindowExt( DC *dc, INT cx, INT cy ) ...@@ -41,10 +41,10 @@ BOOL EMFDRV_SetWindowExt( DC *dc, INT cx, INT cy )
emr.szlExtent.cx = cx; emr.szlExtent.cx = cx;
emr.szlExtent.cy = cy; emr.szlExtent.cy = cy;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_SetViewportOrg( DC *dc, INT x, INT y ) BOOL EMFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y )
{ {
EMRSETVIEWPORTORGEX emr; EMRSETVIEWPORTORGEX emr;
...@@ -53,10 +53,10 @@ BOOL EMFDRV_SetViewportOrg( DC *dc, INT x, INT y ) ...@@ -53,10 +53,10 @@ BOOL EMFDRV_SetViewportOrg( DC *dc, INT x, INT y )
emr.ptlOrigin.x = x; emr.ptlOrigin.x = x;
emr.ptlOrigin.y = y; emr.ptlOrigin.y = y;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_SetWindowOrg( DC *dc, INT x, INT y ) BOOL EMFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y )
{ {
EMRSETWINDOWORGEX emr; EMRSETWINDOWORGEX emr;
...@@ -65,10 +65,10 @@ BOOL EMFDRV_SetWindowOrg( DC *dc, INT x, INT y ) ...@@ -65,10 +65,10 @@ BOOL EMFDRV_SetWindowOrg( DC *dc, INT x, INT y )
emr.ptlOrigin.x = x; emr.ptlOrigin.x = x;
emr.ptlOrigin.y = y; emr.ptlOrigin.y = y;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, INT yNum, BOOL EMFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum,
INT yDenom ) INT yDenom )
{ {
EMRSCALEVIEWPORTEXTEX emr; EMRSCALEVIEWPORTEXTEX emr;
...@@ -80,10 +80,10 @@ BOOL EMFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, INT yNum, ...@@ -80,10 +80,10 @@ BOOL EMFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, INT yNum,
emr.yNum = yNum; emr.yNum = yNum;
emr.yDenom = yDenom; emr.yDenom = yDenom;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
BOOL EMFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, INT yNum, BOOL EMFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum,
INT yDenom ) INT yDenom )
{ {
EMRSCALEWINDOWEXTEX emr; EMRSCALEWINDOWEXTEX emr;
...@@ -95,7 +95,7 @@ BOOL EMFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, INT yNum, ...@@ -95,7 +95,7 @@ BOOL EMFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, INT yNum,
emr.yNum = yNum; emr.yNum = yNum;
emr.yDenom = yDenom; emr.yDenom = yDenom;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile); WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
/*********************************************************************** /***********************************************************************
* EMFDRV_BITMAP_SelectObject * EMFDRV_SelectBitmap
*/ */
static HBITMAP EMFDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap ) HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
{ {
return 0; return 0;
} }
...@@ -40,7 +40,7 @@ static HBITMAP EMFDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap ) ...@@ -40,7 +40,7 @@ static HBITMAP EMFDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap )
/*********************************************************************** /***********************************************************************
* EMFDRV_CreateBrushIndirect * EMFDRV_CreateBrushIndirect
*/ */
DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ) DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
{ {
DWORD index = 0; DWORD index = 0;
LOGBRUSH logbrush; LOGBRUSH logbrush;
...@@ -55,10 +55,10 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ) ...@@ -55,10 +55,10 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush )
EMRCREATEBRUSHINDIRECT emr; EMRCREATEBRUSHINDIRECT emr;
emr.emr.iType = EMR_CREATEBRUSHINDIRECT; emr.emr.iType = EMR_CREATEBRUSHINDIRECT;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ihBrush = index = EMFDRV_AddHandleDC( dc ); emr.ihBrush = index = EMFDRV_AddHandleDC( dev );
emr.lb = logbrush; emr.lb = logbrush;
if(!EMFDRV_WriteRecord( dc, &emr.emr )) if(!EMFDRV_WriteRecord( dev, &emr.emr ))
index = 0; index = 0;
} }
break; break;
...@@ -80,7 +80,7 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ) ...@@ -80,7 +80,7 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush )
if(!emr) break; if(!emr) break;
emr->emr.iType = EMR_CREATEDIBPATTERNBRUSHPT; emr->emr.iType = EMR_CREATEDIBPATTERNBRUSHPT;
emr->emr.nSize = size; emr->emr.nSize = size;
emr->ihBrush = index = EMFDRV_AddHandleDC( dc ); emr->ihBrush = index = EMFDRV_AddHandleDC( dev );
emr->iUsage = LOWORD(logbrush.lbColor); emr->iUsage = LOWORD(logbrush.lbColor);
emr->offBmi = sizeof(EMRCREATEDIBPATTERNBRUSHPT); emr->offBmi = sizeof(EMRCREATEDIBPATTERNBRUSHPT);
emr->cbBmi = biSize; emr->cbBmi = biSize;
...@@ -88,7 +88,7 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ) ...@@ -88,7 +88,7 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush )
memcpy((char *)emr + sizeof(EMRCREATEDIBPATTERNBRUSHPT), info, memcpy((char *)emr + sizeof(EMRCREATEDIBPATTERNBRUSHPT), info,
biSize + bmSize ); biSize + bmSize );
if(!EMFDRV_WriteRecord( dc, &emr->emr )) if(!EMFDRV_WriteRecord( dev, &emr->emr ))
index = 0; index = 0;
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
GlobalUnlock16(logbrush.lbHatch); GlobalUnlock16(logbrush.lbHatch);
...@@ -108,13 +108,12 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ) ...@@ -108,13 +108,12 @@ DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush )
/*********************************************************************** /***********************************************************************
* EMFDRV_BRUSH_SelectObject * EMFDRV_SelectBrush
*/ */
static HBRUSH EMFDRV_BRUSH_SelectObject(DC *dc, HBRUSH hBrush ) HBRUSH EMFDRV_SelectBrush(PHYSDEV dev, HBRUSH hBrush )
{ {
EMRSELECTOBJECT emr; EMRSELECTOBJECT emr;
DWORD index; DWORD index;
HBRUSH hOldBrush;
int i; int i;
/* If the object is a stock brush object, do not need to create it. /* If the object is a stock brush object, do not need to create it.
...@@ -130,25 +129,20 @@ static HBRUSH EMFDRV_BRUSH_SelectObject(DC *dc, HBRUSH hBrush ) ...@@ -130,25 +129,20 @@ static HBRUSH EMFDRV_BRUSH_SelectObject(DC *dc, HBRUSH hBrush )
goto found; goto found;
} }
} }
if (!(index = EMFDRV_CreateBrushIndirect(dc, hBrush ))) return 0; if (!(index = EMFDRV_CreateBrushIndirect(dev, hBrush ))) return 0;
found: found:
emr.emr.iType = EMR_SELECTOBJECT; emr.emr.iType = EMR_SELECTOBJECT;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ihObject = index; emr.ihObject = index;
if(!EMFDRV_WriteRecord( dc, &emr.emr )) return EMFDRV_WriteRecord( dev, &emr.emr ) ? hBrush : 0;
return FALSE;
hOldBrush = dc->hBrush;
dc->hBrush = hBrush;
return hOldBrush;
} }
/****************************************************************** /******************************************************************
* EMFDRV_CreateFontIndirect * EMFDRV_CreateFontIndirect
*/ */
static BOOL EMFDRV_CreateFontIndirect(DC *dc, HFONT hFont ) static BOOL EMFDRV_CreateFontIndirect(PHYSDEV dev, HFONT hFont )
{ {
DWORD index = 0; DWORD index = 0;
EMREXTCREATEFONTINDIRECTW emr; EMREXTCREATEFONTINDIRECTW emr;
...@@ -158,7 +152,7 @@ static BOOL EMFDRV_CreateFontIndirect(DC *dc, HFONT hFont ) ...@@ -158,7 +152,7 @@ static BOOL EMFDRV_CreateFontIndirect(DC *dc, HFONT hFont )
emr.emr.iType = EMR_EXTCREATEFONTINDIRECTW; emr.emr.iType = EMR_EXTCREATEFONTINDIRECTW;
emr.emr.nSize = (sizeof(emr) + 3) / 4 * 4; emr.emr.nSize = (sizeof(emr) + 3) / 4 * 4;
emr.ihFont = index = EMFDRV_AddHandleDC( dc ); emr.ihFont = index = EMFDRV_AddHandleDC( dev );
emr.elfw.elfFullName[0] = '\0'; emr.elfw.elfFullName[0] = '\0';
emr.elfw.elfStyle[0] = '\0'; emr.elfw.elfStyle[0] = '\0';
emr.elfw.elfVersion = 0; emr.elfw.elfVersion = 0;
...@@ -179,16 +173,16 @@ static BOOL EMFDRV_CreateFontIndirect(DC *dc, HFONT hFont ) ...@@ -179,16 +173,16 @@ static BOOL EMFDRV_CreateFontIndirect(DC *dc, HFONT hFont )
emr.elfw.elfPanose.bMidline = PAN_NO_FIT; emr.elfw.elfPanose.bMidline = PAN_NO_FIT;
emr.elfw.elfPanose.bXHeight = PAN_NO_FIT; emr.elfw.elfPanose.bXHeight = PAN_NO_FIT;
if(!EMFDRV_WriteRecord( dc, &emr.emr )) if(!EMFDRV_WriteRecord( dev, &emr.emr ))
index = 0; index = 0;
return index; return index;
} }
/*********************************************************************** /***********************************************************************
* EMFDRV_FONT_SelectObject * EMFDRV_SelectFont
*/ */
static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont ) HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT hFont )
{ {
EMRSELECTOBJECT emr; EMRSELECTOBJECT emr;
DWORD index; DWORD index;
...@@ -208,15 +202,14 @@ static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont ) ...@@ -208,15 +202,14 @@ static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont )
goto found; goto found;
} }
} }
if (!(index = EMFDRV_CreateFontIndirect(dc, hFont ))) return GDI_ERROR; if (!(index = EMFDRV_CreateFontIndirect(dev, hFont ))) return GDI_ERROR;
found: found:
emr.emr.iType = EMR_SELECTOBJECT; emr.emr.iType = EMR_SELECTOBJECT;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ihObject = index; emr.ihObject = index;
if(!EMFDRV_WriteRecord( dc, &emr.emr )) if(!EMFDRV_WriteRecord( dev, &emr.emr ))
return GDI_ERROR; return GDI_ERROR;
return 0;
return FALSE;
} }
...@@ -224,7 +217,7 @@ static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont ) ...@@ -224,7 +217,7 @@ static HFONT EMFDRV_FONT_SelectObject( DC * dc, HFONT hFont )
/****************************************************************** /******************************************************************
* EMFDRV_CreatePenIndirect * EMFDRV_CreatePenIndirect
*/ */
static HPEN EMFDRV_CreatePenIndirect(DC *dc, HPEN hPen ) static HPEN EMFDRV_CreatePenIndirect(PHYSDEV dev, HPEN hPen )
{ {
EMRCREATEPEN emr; EMRCREATEPEN emr;
DWORD index = 0; DWORD index = 0;
...@@ -233,21 +226,20 @@ static HPEN EMFDRV_CreatePenIndirect(DC *dc, HPEN hPen ) ...@@ -233,21 +226,20 @@ static HPEN EMFDRV_CreatePenIndirect(DC *dc, HPEN hPen )
emr.emr.iType = EMR_CREATEPEN; emr.emr.iType = EMR_CREATEPEN;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ihPen = index = EMFDRV_AddHandleDC( dc ); emr.ihPen = index = EMFDRV_AddHandleDC( dev );
if(!EMFDRV_WriteRecord( dc, &emr.emr )) if(!EMFDRV_WriteRecord( dev, &emr.emr ))
index = 0; index = 0;
return index; return index;
} }
/****************************************************************** /******************************************************************
* EMFDRV_PEN_SelectObject * EMFDRV_SelectPen
*/ */
static HPEN EMFDRV_PEN_SelectObject(DC *dc, HPEN hPen ) HPEN EMFDRV_SelectPen(PHYSDEV dev, HPEN hPen )
{ {
EMRSELECTOBJECT emr; EMRSELECTOBJECT emr;
DWORD index; DWORD index;
HPEN hOldPen;
int i; int i;
/* If the object is a stock pen object, do not need to create it. /* If the object is a stock pen object, do not need to create it.
...@@ -264,48 +256,10 @@ static HPEN EMFDRV_PEN_SelectObject(DC *dc, HPEN hPen ) ...@@ -264,48 +256,10 @@ static HPEN EMFDRV_PEN_SelectObject(DC *dc, HPEN hPen )
goto found; goto found;
} }
} }
if (!(index = EMFDRV_CreatePenIndirect(dc, hPen ))) return 0; if (!(index = EMFDRV_CreatePenIndirect(dev, hPen ))) return 0;
found: found:
emr.emr.iType = EMR_SELECTOBJECT; emr.emr.iType = EMR_SELECTOBJECT;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ihObject = index; emr.ihObject = index;
if(!EMFDRV_WriteRecord( dc, &emr.emr )) return EMFDRV_WriteRecord( dev, &emr.emr ) ? hPen : 0;
return FALSE;
hOldPen = dc->hPen;
dc->hPen = hPen;
return hOldPen;
}
/***********************************************************************
* EMFDRV_SelectObject
*/
HGDIOBJ EMFDRV_SelectObject( DC *dc, HGDIOBJ handle )
{
GDIOBJHDR * ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
HGDIOBJ ret = 0;
if (!ptr) return 0;
TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
switch(GDIMAGIC(ptr->wMagic))
{
case PEN_MAGIC:
ret = EMFDRV_PEN_SelectObject( dc, handle );
break;
case BRUSH_MAGIC:
ret = EMFDRV_BRUSH_SelectObject( dc, handle );
break;
case FONT_MAGIC:
ret = EMFDRV_FONT_SelectObject( dc, handle );
break;
case BITMAP_MAGIC:
ret = EMFDRV_BITMAP_SelectObject( dc, handle );
break;
}
GDI_ReleaseObj( handle );
return ret;
} }
...@@ -30,11 +30,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile); ...@@ -30,11 +30,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile);
/*********************************************************************** /***********************************************************************
* MFDRV_PatBlt * MFDRV_PatBlt
*/ */
BOOL MFDRV_PatBlt( DC *dc, INT left, INT top, BOOL MFDRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, DWORD rop )
INT width, INT height, DWORD rop )
{ {
MFDRV_MetaParam6( dc, META_PATBLT, left, top, width, height, MFDRV_MetaParam6( dev, META_PATBLT, left, top, width, height, HIWORD(rop), LOWORD(rop) );
HIWORD(rop), LOWORD(rop) );
return TRUE; return TRUE;
} }
...@@ -42,13 +40,15 @@ BOOL MFDRV_PatBlt( DC *dc, INT left, INT top, ...@@ -42,13 +40,15 @@ BOOL MFDRV_PatBlt( DC *dc, INT left, INT top,
/*********************************************************************** /***********************************************************************
* MFDRV_BitBlt * MFDRV_BitBlt
*/ */
BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height, BOOL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height,
DC *dcSrc, INT xSrc, INT ySrc, DWORD rop ) PHYSDEV devSrc, INT xSrc, INT ySrc, DWORD rop )
{ {
BOOL ret; BOOL ret;
DWORD len; DWORD len;
METARECORD *mr; METARECORD *mr;
BITMAP16 BM; BITMAP16 BM;
METAFILEDRV_PDEVICE *physDevSrc = (METAFILEDRV_PDEVICE *)devSrc;
DC *dcSrc = physDevSrc->dc;
GetObject16(dcSrc->hBitmap, sizeof(BITMAP16), &BM); GetObject16(dcSrc->hBitmap, sizeof(BITMAP16), &BM);
len = sizeof(METARECORD) + 12 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight; len = sizeof(METARECORD) + 12 * sizeof(INT16) + BM.bmWidthBytes * BM.bmHeight;
...@@ -72,7 +72,7 @@ BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height, ...@@ -72,7 +72,7 @@ BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height,
*(mr->rdParm + 4) = width; *(mr->rdParm + 4) = width;
*(mr->rdParm + 5) = yDst; *(mr->rdParm + 5) = yDst;
*(mr->rdParm + 6) = xDst; *(mr->rdParm + 6) = xDst;
ret = MFDRV_WriteRecord( dcDst, mr, mr->rdSize * 2); ret = MFDRV_WriteRecord( devDst, mr, mr->rdSize * 2);
} }
else else
ret = FALSE; ret = FALSE;
...@@ -91,14 +91,16 @@ BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height, ...@@ -91,14 +91,16 @@ BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, INT height,
#define STRETCH_VIA_DIB #define STRETCH_VIA_DIB
#undef STRETCH_VIA_DIB #undef STRETCH_VIA_DIB
BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst, BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
INT heightDst, DC *dcSrc, INT xSrc, INT ySrc, INT heightDst, PHYSDEV devSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop ) INT widthSrc, INT heightSrc, DWORD rop )
{ {
BOOL ret; BOOL ret;
DWORD len; DWORD len;
METARECORD *mr; METARECORD *mr;
BITMAP16 BM; BITMAP16 BM;
METAFILEDRV_PDEVICE *physDevSrc = (METAFILEDRV_PDEVICE *)devSrc;
DC *dcSrc = physDevSrc->dc;
#ifdef STRETCH_VIA_DIB #ifdef STRETCH_VIA_DIB
LPBITMAPINFOHEADER lpBMI; LPBITMAPINFOHEADER lpBMI;
WORD nBPP; WORD nBPP;
...@@ -157,7 +159,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst, ...@@ -157,7 +159,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
*(mr->rdParm + 7) = widthDst; *(mr->rdParm + 7) = widthDst;
*(mr->rdParm + 8) = yDst; *(mr->rdParm + 8) = yDst;
*(mr->rdParm + 9) = xDst; *(mr->rdParm + 9) = xDst;
ret = MFDRV_WriteRecord( dcDst, mr, mr->rdSize * 2); ret = MFDRV_WriteRecord( devDst, mr, mr->rdSize * 2);
} }
else else
ret = FALSE; ret = FALSE;
...@@ -169,7 +171,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst, ...@@ -169,7 +171,7 @@ BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
/*********************************************************************** /***********************************************************************
* MFDRV_StretchDIBits * MFDRV_StretchDIBits
*/ */
INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, INT MFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
INT heightDst, INT xSrc, INT ySrc, INT widthSrc, INT heightDst, INT xSrc, INT ySrc, INT widthSrc,
INT heightSrc, const void *bits, INT heightSrc, const void *bits,
const BITMAPINFO *info, UINT wUsage, DWORD dwRop ) const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
...@@ -201,7 +203,7 @@ INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, ...@@ -201,7 +203,7 @@ INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
mr->rdParm[10] = (INT16)xDst; mr->rdParm[10] = (INT16)xDst;
memcpy(mr->rdParm + 11, info, infosize); memcpy(mr->rdParm + 11, info, infosize);
memcpy(mr->rdParm + 11 + infosize / 2, bits, imagesize); memcpy(mr->rdParm + 11 + infosize / 2, bits, imagesize);
MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 ); MFDRV_WriteRecord( dev, mr, mr->rdSize * 2 );
HeapFree( GetProcessHeap(), 0, mr ); HeapFree( GetProcessHeap(), 0, mr );
return heightSrc; return heightSrc;
} }
...@@ -210,7 +212,7 @@ INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, ...@@ -210,7 +212,7 @@ INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
/*********************************************************************** /***********************************************************************
* MFDRV_SetDIBitsToDeivce * MFDRV_SetDIBitsToDeivce
*/ */
INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDst, INT yDst, DWORD cx, INT MFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDst, INT yDst, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, UINT startscan, DWORD cy, INT xSrc, INT ySrc, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT lines, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse ) UINT coloruse )
...@@ -241,7 +243,7 @@ INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDst, INT yDst, DWORD cx, ...@@ -241,7 +243,7 @@ INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDst, INT yDst, DWORD cx,
mr->rdParm[8] = (INT16)xDst; mr->rdParm[8] = (INT16)xDst;
memcpy(mr->rdParm + 9, info, infosize); memcpy(mr->rdParm + 9, info, infosize);
memcpy(mr->rdParm + 9 + infosize / 2, bits, imagesize); memcpy(mr->rdParm + 9 + infosize / 2, bits, imagesize);
MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 ); MFDRV_WriteRecord( dev, mr, mr->rdSize * 2 );
HeapFree( GetProcessHeap(), 0, mr ); HeapFree( GetProcessHeap(), 0, mr );
return lines; return lines;
} }
......
...@@ -20,126 +20,126 @@ ...@@ -20,126 +20,126 @@
#include "mfdrv/metafiledrv.h" #include "mfdrv/metafiledrv.h"
INT MFDRV_SaveDC( DC *dc ) INT MFDRV_SaveDC( PHYSDEV dev )
{ {
return MFDRV_MetaParam0( dc, META_SAVEDC ); return MFDRV_MetaParam0( dev, META_SAVEDC );
} }
BOOL MFDRV_RestoreDC( DC *dc, INT level ) BOOL MFDRV_RestoreDC( PHYSDEV dev, INT level )
{ {
if(level != -1) return FALSE; if(level != -1) return FALSE;
return MFDRV_MetaParam1( dc, META_RESTOREDC, level ); return MFDRV_MetaParam1( dev, META_RESTOREDC, level );
} }
UINT MFDRV_SetTextAlign( DC *dc, UINT align ) UINT MFDRV_SetTextAlign( PHYSDEV dev, UINT align )
{ {
return MFDRV_MetaParam1( dc, META_SETTEXTALIGN, (WORD)align); return MFDRV_MetaParam1( dev, META_SETTEXTALIGN, (WORD)align);
} }
INT MFDRV_SetBkMode( DC *dc, INT mode ) INT MFDRV_SetBkMode( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dc, META_SETBKMODE, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETBKMODE, (WORD)mode);
} }
INT MFDRV_SetROP2( DC *dc, INT rop ) INT MFDRV_SetROP2( PHYSDEV dev, INT rop )
{ {
return MFDRV_MetaParam1( dc, META_SETROP2, (WORD)rop); return MFDRV_MetaParam1( dev, META_SETROP2, (WORD)rop);
} }
INT MFDRV_SetRelAbs( DC *dc, INT mode ) INT MFDRV_SetRelAbs( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dc, META_SETRELABS, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETRELABS, (WORD)mode);
} }
INT MFDRV_SetPolyFillMode( DC *dc, INT mode ) INT MFDRV_SetPolyFillMode( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dc, META_SETPOLYFILLMODE, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETPOLYFILLMODE, (WORD)mode);
} }
INT MFDRV_SetStretchBltMode( DC *dc, INT mode ) INT MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode )
{ {
return MFDRV_MetaParam1( dc, META_SETSTRETCHBLTMODE, (WORD)mode); return MFDRV_MetaParam1( dev, META_SETSTRETCHBLTMODE, (WORD)mode);
} }
INT MFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT bottom ) INT MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{ {
return MFDRV_MetaParam4( dc, META_INTERSECTCLIPRECT, left, top, right, return MFDRV_MetaParam4( dev, META_INTERSECTCLIPRECT, left, top, right,
bottom ); bottom );
} }
INT MFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT bottom ) INT MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{ {
return MFDRV_MetaParam4( dc, META_EXCLUDECLIPRECT, left, top, right, return MFDRV_MetaParam4( dev, META_EXCLUDECLIPRECT, left, top, right,
bottom ); bottom );
} }
INT MFDRV_OffsetClipRgn( DC *dc, INT x, INT y ) INT MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y )
{ {
return MFDRV_MetaParam2( dc, META_OFFSETCLIPRGN, x, y ); return MFDRV_MetaParam2( dev, META_OFFSETCLIPRGN, x, y );
} }
INT MFDRV_SetTextJustification( DC *dc, INT extra, INT breaks ) INT MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks )
{ {
return MFDRV_MetaParam2( dc, META_SETTEXTJUSTIFICATION, extra, breaks ); return MFDRV_MetaParam2( dev, META_SETTEXTJUSTIFICATION, extra, breaks );
} }
INT MFDRV_SetTextCharacterExtra( DC *dc, INT extra ) INT MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra )
{ {
return MFDRV_MetaParam1( dc, META_SETTEXTCHAREXTRA, extra ); return MFDRV_MetaParam1( dev, META_SETTEXTCHAREXTRA, extra );
} }
DWORD MFDRV_SetMapperFlags( DC *dc, DWORD flags ) DWORD MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags )
{ {
return MFDRV_MetaParam2( dc, META_SETMAPPERFLAGS, HIWORD(flags), return MFDRV_MetaParam2( dev, META_SETMAPPERFLAGS, HIWORD(flags),
LOWORD(flags) ); LOWORD(flags) );
} }
BOOL MFDRV_AbortPath( DC *dc ) BOOL MFDRV_AbortPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_BeginPath( DC *dc ) BOOL MFDRV_BeginPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_CloseFigure( DC *dc ) BOOL MFDRV_CloseFigure( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_EndPath( DC *dc ) BOOL MFDRV_EndPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_FillPath( DC *dc ) BOOL MFDRV_FillPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_FlattenPath( DC *dc ) BOOL MFDRV_FlattenPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_SelectClipPath( DC *dc, INT iMode ) BOOL MFDRV_SelectClipPath( PHYSDEV dev, INT iMode )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_StrokeAndFillPath( DC *dc ) BOOL MFDRV_StrokeAndFillPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_StrokePath( DC *dc ) BOOL MFDRV_StrokePath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
BOOL MFDRV_WidenPath( DC *dc ) BOOL MFDRV_WidenPath( PHYSDEV dev )
{ {
return FALSE; return FALSE;
} }
...@@ -25,10 +25,11 @@ ...@@ -25,10 +25,11 @@
/*********************************************************************** /***********************************************************************
* MFDRV_SetMapMode * MFDRV_SetMapMode
*/ */
INT MFDRV_SetMapMode( DC *dc, INT mode ) INT MFDRV_SetMapMode( PHYSDEV dev, INT mode )
{ {
INT prevMode = dc->MapMode; METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
MFDRV_MetaParam1( dc, META_SETMAPMODE, mode ); INT prevMode = GetMapMode( physDev->hdc );
MFDRV_MetaParam1( dev, META_SETMAPMODE, mode );
return prevMode; return prevMode;
} }
...@@ -36,9 +37,9 @@ INT MFDRV_SetMapMode( DC *dc, INT mode ) ...@@ -36,9 +37,9 @@ INT MFDRV_SetMapMode( DC *dc, INT mode )
/*********************************************************************** /***********************************************************************
* MFDRV_SetViewportExt * MFDRV_SetViewportExt
*/ */
BOOL MFDRV_SetViewportExt( DC *dc, INT x, INT y ) BOOL MFDRV_SetViewportExt( PHYSDEV dev, INT x, INT y )
{ {
MFDRV_MetaParam2( dc, META_SETVIEWPORTEXT, x, y ); MFDRV_MetaParam2( dev, META_SETVIEWPORTEXT, x, y );
return TRUE; return TRUE;
} }
...@@ -46,9 +47,9 @@ BOOL MFDRV_SetViewportExt( DC *dc, INT x, INT y ) ...@@ -46,9 +47,9 @@ BOOL MFDRV_SetViewportExt( DC *dc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* MFDRV_SetViewportOrg * MFDRV_SetViewportOrg
*/ */
BOOL MFDRV_SetViewportOrg( DC *dc, INT x, INT y ) BOOL MFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y )
{ {
MFDRV_MetaParam2( dc, META_SETVIEWPORTORG, x, y ); MFDRV_MetaParam2( dev, META_SETVIEWPORTORG, x, y );
return TRUE; return TRUE;
} }
...@@ -56,9 +57,9 @@ BOOL MFDRV_SetViewportOrg( DC *dc, INT x, INT y ) ...@@ -56,9 +57,9 @@ BOOL MFDRV_SetViewportOrg( DC *dc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* MFDRV_SetWindowExt * MFDRV_SetWindowExt
*/ */
BOOL MFDRV_SetWindowExt( DC *dc, INT x, INT y ) BOOL MFDRV_SetWindowExt( PHYSDEV dev, INT x, INT y )
{ {
MFDRV_MetaParam2( dc, META_SETWINDOWEXT, x, y ); MFDRV_MetaParam2( dev, META_SETWINDOWEXT, x, y );
return TRUE; return TRUE;
} }
...@@ -66,9 +67,9 @@ BOOL MFDRV_SetWindowExt( DC *dc, INT x, INT y ) ...@@ -66,9 +67,9 @@ BOOL MFDRV_SetWindowExt( DC *dc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* MFDRV_SetWindowOrg * MFDRV_SetWindowOrg
*/ */
BOOL MFDRV_SetWindowOrg( DC *dc, INT x, INT y ) BOOL MFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y )
{ {
MFDRV_MetaParam2( dc, META_SETWINDOWORG, x, y ); MFDRV_MetaParam2( dev, META_SETWINDOWORG, x, y );
return TRUE; return TRUE;
} }
...@@ -76,9 +77,9 @@ BOOL MFDRV_SetWindowOrg( DC *dc, INT x, INT y ) ...@@ -76,9 +77,9 @@ BOOL MFDRV_SetWindowOrg( DC *dc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* MFDRV_OffsetViewportOrg * MFDRV_OffsetViewportOrg
*/ */
BOOL MFDRV_OffsetViewportOrg( DC *dc, INT x, INT y ) BOOL MFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y )
{ {
MFDRV_MetaParam2( dc, META_OFFSETVIEWPORTORG, x, y ); MFDRV_MetaParam2( dev, META_OFFSETVIEWPORTORG, x, y );
return TRUE; return TRUE;
} }
...@@ -86,9 +87,9 @@ BOOL MFDRV_OffsetViewportOrg( DC *dc, INT x, INT y ) ...@@ -86,9 +87,9 @@ BOOL MFDRV_OffsetViewportOrg( DC *dc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* MFDRV_OffsetWindowOrg * MFDRV_OffsetWindowOrg
*/ */
BOOL MFDRV_OffsetWindowOrg( DC *dc, INT x, INT y ) BOOL MFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y )
{ {
MFDRV_MetaParam2( dc, META_OFFSETWINDOWORG, x, y ); MFDRV_MetaParam2( dev, META_OFFSETWINDOWORG, x, y );
return TRUE; return TRUE;
} }
...@@ -96,10 +97,9 @@ BOOL MFDRV_OffsetWindowOrg( DC *dc, INT x, INT y ) ...@@ -96,10 +97,9 @@ BOOL MFDRV_OffsetWindowOrg( DC *dc, INT x, INT y )
/*********************************************************************** /***********************************************************************
* MFDRV_ScaleViewportExt * MFDRV_ScaleViewportExt
*/ */
BOOL MFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, BOOL MFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom )
INT yNum, INT yDenom )
{ {
MFDRV_MetaParam4( dc, META_SCALEVIEWPORTEXT, xNum, xDenom, yNum, yDenom ); MFDRV_MetaParam4( dev, META_SCALEVIEWPORTEXT, xNum, xDenom, yNum, yDenom );
return TRUE; return TRUE;
} }
...@@ -107,10 +107,9 @@ BOOL MFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, ...@@ -107,10 +107,9 @@ BOOL MFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom,
/*********************************************************************** /***********************************************************************
* MFDRV_ScaleWindowExt * MFDRV_ScaleWindowExt
*/ */
BOOL MFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, BOOL MFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum, INT yDenom )
INT yNum, INT yDenom )
{ {
MFDRV_MetaParam4( dc, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom ); MFDRV_MetaParam4( dev, META_SCALEWINDOWEXT, xNum, xDenom, yNum, yDenom );
return TRUE; return TRUE;
} }
...@@ -31,9 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile); ...@@ -31,9 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile);
/*********************************************************************** /***********************************************************************
* MFDRV_BITMAP_SelectObject * MFDRV_SelectBitmap
*/ */
static HBITMAP MFDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap ) HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP hbitmap )
{ {
return 0; return 0;
} }
...@@ -43,12 +43,13 @@ static HBITMAP MFDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap ) ...@@ -43,12 +43,13 @@ static HBITMAP MFDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap )
* MFDRV_CreateBrushIndirect * MFDRV_CreateBrushIndirect
*/ */
INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush ) INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush )
{ {
INT16 index = -1; INT16 index = -1;
DWORD size; DWORD size;
METARECORD *mr; METARECORD *mr;
LOGBRUSH logbrush; LOGBRUSH logbrush;
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
if (!GetObjectA( hBrush, sizeof(logbrush), &logbrush )) return -1; if (!GetObjectA( hBrush, sizeof(logbrush), &logbrush )) return -1;
...@@ -103,7 +104,7 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush ) ...@@ -103,7 +104,7 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
info->bmiHeader.biBitCount = 1; info->bmiHeader.biBitCount = 1;
bits = ((BYTE *)info) + sizeof(BITMAPINFO) + sizeof(RGBQUAD); bits = ((BYTE *)info) + sizeof(BITMAPINFO) + sizeof(RGBQUAD);
GetDIBits(dc->hSelf, logbrush.lbHatch, 0, bm.bmHeight, GetDIBits(physDev->hdc, logbrush.lbHatch, 0, bm.bmHeight,
bits, info, DIB_RGB_COLORS); bits, info, DIB_RGB_COLORS);
*(DWORD *)info->bmiColors = 0; *(DWORD *)info->bmiColors = 0;
*(DWORD *)(info->bmiColors + 1) = 0xffffff; *(DWORD *)(info->bmiColors + 1) = 0xffffff;
...@@ -137,8 +138,8 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush ) ...@@ -137,8 +138,8 @@ INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
FIXME("Unkonwn brush style %x\n", logbrush.lbStyle); FIXME("Unkonwn brush style %x\n", logbrush.lbStyle);
return -1; return -1;
} }
index = MFDRV_AddHandleDC( dc ); index = MFDRV_AddHandleDC( dev );
if(!MFDRV_WriteRecord( dc, mr, mr->rdSize * 2)) if(!MFDRV_WriteRecord( dev, mr, mr->rdSize * 2))
index = -1; index = -1;
HeapFree(GetProcessHeap(), 0, mr); HeapFree(GetProcessHeap(), 0, mr);
done: done:
...@@ -147,27 +148,27 @@ done: ...@@ -147,27 +148,27 @@ done:
/*********************************************************************** /***********************************************************************
* MFDRV_BRUSH_SelectObject * MFDRV_SelectBrush
*/ */
static HBRUSH MFDRV_BRUSH_SelectObject( DC *dc, HBRUSH hbrush ) HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
{ {
INT16 index; INT16 index;
METARECORD mr; METARECORD mr;
index = MFDRV_CreateBrushIndirect( dc, hbrush ); index = MFDRV_CreateBrushIndirect( dev, hbrush );
if(index == -1) return 0; if(index == -1) return 0;
mr.rdSize = sizeof(mr) / 2; mr.rdSize = sizeof(mr) / 2;
mr.rdFunction = META_SELECTOBJECT; mr.rdFunction = META_SELECTOBJECT;
mr.rdParm[0] = index; mr.rdParm[0] = index;
return MFDRV_WriteRecord( dc, &mr, mr.rdSize * 2); return MFDRV_WriteRecord( dev, &mr, mr.rdSize * 2) ? hbrush : 0;
} }
/****************************************************************** /******************************************************************
* MFDRV_CreateFontIndirect * MFDRV_CreateFontIndirect
*/ */
static BOOL MFDRV_CreateFontIndirect(DC *dc, HFONT16 hFont, LOGFONT16 *logfont) static BOOL MFDRV_CreateFontIndirect(PHYSDEV dev, HFONT16 hFont, LOGFONT16 *logfont)
{ {
int index; int index;
char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)]; char buffer[sizeof(METARECORD) - 2 + sizeof(LOGFONT16)];
...@@ -176,34 +177,33 @@ static BOOL MFDRV_CreateFontIndirect(DC *dc, HFONT16 hFont, LOGFONT16 *logfont) ...@@ -176,34 +177,33 @@ static BOOL MFDRV_CreateFontIndirect(DC *dc, HFONT16 hFont, LOGFONT16 *logfont)
mr->rdSize = (sizeof(METARECORD) + sizeof(LOGFONT16) - 2) / 2; mr->rdSize = (sizeof(METARECORD) + sizeof(LOGFONT16) - 2) / 2;
mr->rdFunction = META_CREATEFONTINDIRECT; mr->rdFunction = META_CREATEFONTINDIRECT;
memcpy(&(mr->rdParm), logfont, sizeof(LOGFONT16)); memcpy(&(mr->rdParm), logfont, sizeof(LOGFONT16));
if (!(MFDRV_WriteRecord( dc, mr, mr->rdSize * 2))) return FALSE; if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * 2))) return FALSE;
mr->rdSize = sizeof(METARECORD) / 2; mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT; mr->rdFunction = META_SELECTOBJECT;
if ((index = MFDRV_AddHandleDC( dc )) == -1) return FALSE; if ((index = MFDRV_AddHandleDC( dev )) == -1) return FALSE;
*(mr->rdParm) = index; *(mr->rdParm) = index;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
/*********************************************************************** /***********************************************************************
* MFDRV_FONT_SelectObject * MFDRV_SelectFont
*/ */
static HFONT MFDRV_FONT_SelectObject( DC * dc, HFONT hfont ) HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT hfont )
{ {
LOGFONT16 lf16; LOGFONT16 lf16;
if (!GetObject16( hfont, sizeof(lf16), &lf16 )) return GDI_ERROR; if (!GetObject16( hfont, sizeof(lf16), &lf16 )) return GDI_ERROR;
if (MFDRV_CreateFontIndirect(dc, hfont, &lf16)) if (MFDRV_CreateFontIndirect(dev, hfont, &lf16)) return 0;
return FALSE;
return GDI_ERROR; return GDI_ERROR;
} }
/****************************************************************** /******************************************************************
* MFDRV_CreatePenIndirect * MFDRV_CreatePenIndirect
*/ */
static BOOL MFDRV_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen) static BOOL MFDRV_CreatePenIndirect(PHYSDEV dev, HPEN16 hPen, LOGPEN16 *logpen)
{ {
int index; int index;
char buffer[sizeof(METARECORD) - 2 + sizeof(*logpen)]; char buffer[sizeof(METARECORD) - 2 + sizeof(*logpen)];
...@@ -212,45 +212,25 @@ static BOOL MFDRV_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen) ...@@ -212,45 +212,25 @@ static BOOL MFDRV_CreatePenIndirect(DC *dc, HPEN16 hPen, LOGPEN16 *logpen)
mr->rdSize = (sizeof(METARECORD) + sizeof(*logpen) - 2) / 2; mr->rdSize = (sizeof(METARECORD) + sizeof(*logpen) - 2) / 2;
mr->rdFunction = META_CREATEPENINDIRECT; mr->rdFunction = META_CREATEPENINDIRECT;
memcpy(&(mr->rdParm), logpen, sizeof(*logpen)); memcpy(&(mr->rdParm), logpen, sizeof(*logpen));
if (!(MFDRV_WriteRecord( dc, mr, mr->rdSize * 2))) return FALSE; if (!(MFDRV_WriteRecord( dev, mr, mr->rdSize * 2))) return FALSE;
mr->rdSize = sizeof(METARECORD) / 2; mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT; mr->rdFunction = META_SELECTOBJECT;
if ((index = MFDRV_AddHandleDC( dc )) == -1) return FALSE; if ((index = MFDRV_AddHandleDC( dev )) == -1) return FALSE;
*(mr->rdParm) = index; *(mr->rdParm) = index;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
/*********************************************************************** /***********************************************************************
* MFDRV_PEN_SelectObject * MFDRV_SelectPen
*/ */
static HPEN MFDRV_PEN_SelectObject( DC * dc, HPEN hpen ) HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN hpen )
{ {
LOGPEN16 logpen; LOGPEN16 logpen;
HPEN prevHandle = dc->hPen;
if (!GetObject16( hpen, sizeof(logpen), &logpen )) return 0; if (!GetObject16( hpen, sizeof(logpen), &logpen )) return 0;
if (MFDRV_CreatePenIndirect( dc, hpen, &logpen )) return prevHandle; if (MFDRV_CreatePenIndirect( dev, hpen, &logpen )) return hpen;
return 0;
}
/***********************************************************************
* MFDRV_SelectObject
*/
HGDIOBJ MFDRV_SelectObject( DC *dc, HGDIOBJ handle )
{
TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
switch(GetObjectType( handle ))
{
case OBJ_PEN: return MFDRV_PEN_SelectObject( dc, handle );
case OBJ_BRUSH: return MFDRV_BRUSH_SelectObject( dc, handle );
case OBJ_BITMAP: return MFDRV_BITMAP_SelectObject( dc, handle );
case OBJ_FONT: return MFDRV_FONT_SelectObject( dc, handle );
case OBJ_REGION: return (HGDIOBJ)SelectClipRgn( dc->hSelf, handle );
}
return 0; return 0;
} }
...@@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile); ...@@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile);
/****************************************************************** /******************************************************************
* MFDRV_MetaExtTextOut * MFDRV_MetaExtTextOut
*/ */
static BOOL MFDRV_MetaExtTextOut(DC*dc, short x, short y, UINT16 flags, static BOOL MFDRV_MetaExtTextOut( PHYSDEV dev, short x, short y, UINT16 flags,
const RECT16 *rect, LPCSTR str, short count, const RECT16 *rect, LPCSTR str, short count,
const INT16 *lpDx) const INT16 *lpDx)
{ {
...@@ -60,7 +60,7 @@ static BOOL MFDRV_MetaExtTextOut(DC*dc, short x, short y, UINT16 flags, ...@@ -60,7 +60,7 @@ static BOOL MFDRV_MetaExtTextOut(DC*dc, short x, short y, UINT16 flags,
if (lpDx) if (lpDx)
memcpy(mr->rdParm + (rect ? 8 : 4) + ((count + 1) >> 1),lpDx, memcpy(mr->rdParm + (rect ? 8 : 4) + ((count + 1) >> 1),lpDx,
count*sizeof(INT16)); count*sizeof(INT16));
ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
HeapFree( GetProcessHeap(), 0, mr); HeapFree( GetProcessHeap(), 0, mr);
return ret; return ret;
} }
...@@ -71,7 +71,7 @@ static BOOL MFDRV_MetaExtTextOut(DC*dc, short x, short y, UINT16 flags, ...@@ -71,7 +71,7 @@ static BOOL MFDRV_MetaExtTextOut(DC*dc, short x, short y, UINT16 flags,
* MFDRV_ExtTextOut * MFDRV_ExtTextOut
*/ */
BOOL BOOL
MFDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count, const RECT *lprect, LPCWSTR str, UINT count,
const INT *lpDx ) const INT *lpDx )
{ {
...@@ -91,8 +91,7 @@ MFDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -91,8 +91,7 @@ MFDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, str, count, NULL, 0, NULL, NULL );
ascii = HeapAlloc( GetProcessHeap(), 0, len ); ascii = HeapAlloc( GetProcessHeap(), 0, len );
WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, str, count, ascii, len, NULL, NULL );
ret = MFDRV_MetaExtTextOut(dc,x,y,flags,lprect?&rect16:NULL,ascii,len, ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16);
lpdx16);
HeapFree( GetProcessHeap(), 0, ascii ); HeapFree( GetProcessHeap(), 0, ascii );
if (lpdx16) HeapFree( GetProcessHeap(), 0, lpdx16 ); if (lpdx16) HeapFree( GetProcessHeap(), 0, lpdx16 );
return ret; return ret;
......
...@@ -94,7 +94,7 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc) ...@@ -94,7 +94,7 @@ INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc)
if(!dc) return SP_ERROR; if(!dc) return SP_ERROR;
if (dc->funcs->pStartDoc) ret = dc->funcs->pStartDoc( dc, doc ); if (dc->funcs->pStartDoc) ret = dc->funcs->pStartDoc( dc->physDev, doc );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
} }
...@@ -148,7 +148,7 @@ INT WINAPI EndDoc(HDC hdc) ...@@ -148,7 +148,7 @@ INT WINAPI EndDoc(HDC hdc)
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR; if(!dc) return SP_ERROR;
if (dc->funcs->pEndDoc) ret = dc->funcs->pEndDoc( dc ); if (dc->funcs->pEndDoc) ret = dc->funcs->pEndDoc( dc->physDev );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
} }
...@@ -173,7 +173,7 @@ INT WINAPI StartPage(HDC hdc) ...@@ -173,7 +173,7 @@ INT WINAPI StartPage(HDC hdc)
if(!dc) return SP_ERROR; if(!dc) return SP_ERROR;
if(dc->funcs->pStartPage) if(dc->funcs->pStartPage)
ret = dc->funcs->pStartPage( dc ); ret = dc->funcs->pStartPage( dc->physDev );
else else
FIXME("stub\n"); FIXME("stub\n");
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
...@@ -199,7 +199,7 @@ INT WINAPI EndPage(HDC hdc) ...@@ -199,7 +199,7 @@ INT WINAPI EndPage(HDC hdc)
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR; if(!dc) return SP_ERROR;
if (dc->funcs->pEndPage) ret = dc->funcs->pEndPage( dc ); if (dc->funcs->pEndPage) ret = dc->funcs->pEndPage( dc->physDev );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
if (!QueryAbort16( hdc, 0 )) if (!QueryAbort16( hdc, 0 ))
{ {
...@@ -226,7 +226,7 @@ INT WINAPI AbortDoc(HDC hdc) ...@@ -226,7 +226,7 @@ INT WINAPI AbortDoc(HDC hdc)
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if(!dc) return SP_ERROR; if(!dc) return SP_ERROR;
if (dc->funcs->pAbortDoc) ret = dc->funcs->pAbortDoc( dc ); if (dc->funcs->pAbortDoc) ret = dc->funcs->pAbortDoc( dc->physDev );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
} }
......
/*
* GDI brush objects - win16drv
*
* Copyright 1997 John Harvey
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdlib.h>
#include "win16drv/win16drv.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
HBRUSH16 prevHandle = dc->hBrush;
int nSize;
LOGBRUSH16 lBrush16;
if (!GetObject16( hbrush, sizeof(lBrush16), &lBrush16 )) return 0;
dc->hBrush = hbrush;
if ( physDev->BrushInfo )
{
TRACE("UnRealizing BrushInfo\n");
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
physDev->BrushInfo,
physDev->BrushInfo, 0);
}
else
{
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH,
&lBrush16, 0, 0);
physDev->BrushInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
}
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_BRUSH,
&lBrush16,
physDev->BrushInfo,
win16drv_SegPtr_TextXForm);
return prevHandle;
}
...@@ -33,15 +33,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(win16drv); ...@@ -33,15 +33,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
/*********************************************************************** /***********************************************************************
* WIN16DRV_GetTextExtentPoint * WIN16DRV_GetTextExtentPoint
*/ */
BOOL WIN16DRV_GetTextExtentPoint( DC *dc, LPCWSTR wstr, INT count, BOOL WIN16DRV_GetTextExtentPoint( PHYSDEV dev, LPCWSTR wstr, INT count,
LPSIZE size ) LPSIZE size )
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
DWORD dwRet, len; DWORD dwRet, len;
char *str; char *str;
TRACE("%04x %s %d %p\n", TRACE("%04x %s %d %p\n", physDev->hdc, debugstr_wn(wstr, count), count, size);
dc->hSelf, debugstr_wn(wstr, count), count, size);
len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, wstr, count, NULL, 0, NULL, NULL );
...@@ -63,11 +63,11 @@ BOOL WIN16DRV_GetTextExtentPoint( DC *dc, LPCWSTR wstr, INT count, ...@@ -63,11 +63,11 @@ BOOL WIN16DRV_GetTextExtentPoint( DC *dc, LPCWSTR wstr, INT count,
/*********************************************************************** /***********************************************************************
* WIN16DRV_GetTextMetrics * WIN16DRV_GetTextMetrics
*/ */
BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics ) BOOL WIN16DRV_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
TRACE("%04x \n", dc->hSelf); TRACE("%04x \n", physDev->hdc);
FONT_TextMetric16ToW( &physDev->tm, metrics ); FONT_TextMetric16ToW( &physDev->tm, metrics );
...@@ -85,9 +85,13 @@ BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics ) ...@@ -85,9 +85,13 @@ BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics )
return TRUE; return TRUE;
} }
HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont) /***********************************************************************
* WIN16DRV_SelectFont
*/
HFONT WIN16DRV_SelectFont( PHYSDEV dev, HFONT hfont)
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
int nSize; int nSize;
if (!GetObject16( hfont, sizeof(physDev->lf), &physDev->lf )) if (!GetObject16( hfont, sizeof(physDev->lf), &physDev->lf ))
...@@ -163,16 +167,14 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont) ...@@ -163,16 +167,14 @@ HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont)
/*********************************************************************** /***********************************************************************
* WIN16DRV_GetCharWidth * WIN16DRV_GetCharWidth
*/ */
BOOL WIN16DRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar, BOOL WIN16DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar,
LPINT buffer ) LPINT buffer )
{ {
int i; int i;
WORD wRet; WORD wRet;
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; TRACE("%d - %d into %p\n", firstChar, lastChar, buffer );
TRACE("%d - %d into %p\n",
firstChar, lastChar, buffer );
wRet = PRTDRV_GetCharWidth( physDev->segptrPDEVICE, buffer, firstChar, wRet = PRTDRV_GetCharWidth( physDev->segptrPDEVICE, buffer, firstChar,
lastChar, physDev->FontInfo, lastChar, physDev->FontInfo,
......
...@@ -29,11 +29,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(win16drv); ...@@ -29,11 +29,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
* WIN16DRV_LineTo * WIN16DRV_LineTo
*/ */
BOOL BOOL
WIN16DRV_LineTo( DC *dc, INT x, INT y ) WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y )
{ {
BOOL bRet ; BOOL bRet ;
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
POINT16 points[2]; POINT16 points[2];
points[0].x = dc->DCOrgX + XLPTODP( dc, dc->CursPosX ); points[0].x = dc->DCOrgX + XLPTODP( dc, dc->CursPosX );
points[0].y = dc->DCOrgY + YLPTODP( dc, dc->CursPosY ); points[0].y = dc->DCOrgY + YLPTODP( dc, dc->CursPosY );
points[1].x = dc->DCOrgX + XLPTODP( dc, x ); points[1].x = dc->DCOrgX + XLPTODP( dc, x );
...@@ -54,9 +56,10 @@ WIN16DRV_LineTo( DC *dc, INT x, INT y ) ...@@ -54,9 +56,10 @@ WIN16DRV_LineTo( DC *dc, INT x, INT y )
* WIN16DRV_Rectangle * WIN16DRV_Rectangle
*/ */
BOOL BOOL
WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
BOOL bRet = 0; BOOL bRet = 0;
POINT16 points[2]; POINT16 points[2];
...@@ -84,9 +87,10 @@ WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) ...@@ -84,9 +87,10 @@ WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
* WIN16DRV_Polygon * WIN16DRV_Polygon
*/ */
BOOL BOOL
WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count ) WIN16DRV_Polygon(PHYSDEV dev, const POINT* pt, INT count )
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
BOOL bRet = 0; BOOL bRet = 0;
LPPOINT16 points; LPPOINT16 points;
int i; int i;
...@@ -119,9 +123,10 @@ WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count ) ...@@ -119,9 +123,10 @@ WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count )
* WIN16DRV_Polyline * WIN16DRV_Polyline
*/ */
BOOL BOOL
WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count ) WIN16DRV_Polyline(PHYSDEV dev, const POINT* pt, INT count )
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
BOOL bRet = 0; BOOL bRet = 0;
LPPOINT16 points; LPPOINT16 points;
int i; int i;
...@@ -151,15 +156,15 @@ WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count ) ...@@ -151,15 +156,15 @@ WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count )
* WIN16DRV_Ellipse * WIN16DRV_Ellipse
*/ */
BOOL BOOL
WIN16DRV_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom) WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
BOOL bRet = 0; BOOL bRet = 0;
POINT16 points[2]; POINT16 points[2];
TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n",
left, top, dc->DCOrgX, dc->DCOrgY); TRACE("In WIN16DRV_Ellipse, x %d y %d DCOrgX %d y %d\n", left, top, dc->DCOrgX, dc->DCOrgY);
TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", TRACE("In WIN16DRV_Ellipse, VPortOrgX %d y %d\n", dc->vportOrgX, dc->vportOrgY);
dc->vportOrgX, dc->vportOrgY);
points[0].x = XLPTODP(dc, left); points[0].x = XLPTODP(dc, left);
points[0].y = YLPTODP(dc, top); points[0].y = YLPTODP(dc, top);
......
...@@ -52,8 +52,8 @@ LPDRAWMODE win16drv_DrawModeP; ...@@ -52,8 +52,8 @@ LPDRAWMODE win16drv_DrawModeP;
static BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, static BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODEA* initData ); LPCSTR output, const DEVMODEA* initData );
static INT WIN16DRV_GetDeviceCaps( DC *dc, INT cap ); static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap );
static INT WIN16DRV_ExtEscape( DC *dc, INT escape, INT in_count, LPCVOID in_data, static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data ); INT out_count, LPVOID out_data );
static const DC_FUNCTIONS WIN16DRV_Funcs = static const DC_FUNCTIONS WIN16DRV_Funcs =
...@@ -92,6 +92,8 @@ static const DC_FUNCTIONS WIN16DRV_Funcs = ...@@ -92,6 +92,8 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pFrameRgn */ NULL, /* pFrameRgn */
WIN16DRV_GetCharWidth, /* pGetCharWidth */ WIN16DRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetDCOrgEx */ NULL, /* pGetDCOrgEx */
NULL, /* pGetDIBColorTable */
NULL, /* pGetDIBits */
WIN16DRV_GetDeviceCaps, /* pGetDeviceCaps */ WIN16DRV_GetDeviceCaps, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */ NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetPixel */ NULL, /* pGetPixel */
...@@ -123,15 +125,20 @@ static const DC_FUNCTIONS WIN16DRV_Funcs = ...@@ -123,15 +125,20 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
NULL, /* pSaveDC */ NULL, /* pSaveDC */
NULL, /* pScaleViewportExtEx */ NULL, /* pScaleViewportExtEx */
NULL, /* pScaleWindowExtEx */ NULL, /* pScaleWindowExtEx */
WIN16DRV_SelectBitmap, /* pSelectBitmap */
WIN16DRV_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */ NULL, /* pSelectClipPath */
NULL, /* pSelectClipRgn */ NULL, /* pSelectClipRgn */
WIN16DRV_SelectObject, /* pSelectObject */ WIN16DRV_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */ NULL, /* pSelectPalette */
WIN16DRV_SelectPen, /* pSelectPen */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */ NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
NULL, /* pSetDIBitsToDevice */
NULL, /* pSetMapMode */ NULL, /* pSetMapMode */
NULL, /* pSetMapperFlags */ NULL, /* pSetMapperFlags */
NULL, /* pSetPixel */ NULL, /* pSetPixel */
...@@ -242,7 +249,9 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, ...@@ -242,7 +249,9 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) ); physDev = (WIN16DRV_PDEVICE *)HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev) );
if (!physDev) return FALSE; if (!physDev) return FALSE;
dc->physDev = physDev; dc->physDev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
pLPD = LoadPrinterDriver(driver); pLPD = LoadPrinterDriver(driver);
if (pLPD == NULL) if (pLPD == NULL)
...@@ -305,11 +314,10 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, ...@@ -305,11 +314,10 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
return TRUE; return TRUE;
} }
BOOL WIN16DRV_PatBlt( struct tagDC *dc, INT left, INT top, BOOL WIN16DRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, DWORD rop )
INT width, INT height, DWORD rop )
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
BOOL bRet = 0; BOOL bRet = 0;
bRet = PRTDRV_StretchBlt( physDev->segptrPDEVICE, left, top, width, height, (SEGPTR)NULL, 0, 0, width, height, bRet = PRTDRV_StretchBlt( physDev->segptrPDEVICE, left, top, width, height, (SEGPTR)NULL, 0, 0, width, height,
...@@ -322,12 +330,12 @@ BOOL WIN16DRV_PatBlt( struct tagDC *dc, INT left, INT top, ...@@ -322,12 +330,12 @@ BOOL WIN16DRV_PatBlt( struct tagDC *dc, INT left, INT top,
/*********************************************************************** /***********************************************************************
* WIN16DRV_GetDeviceCaps * WIN16DRV_GetDeviceCaps
*/ */
static INT WIN16DRV_GetDeviceCaps( DC *dc, INT cap ) static INT WIN16DRV_GetDeviceCaps( PHYSDEV dev, INT cap )
{ {
WIN16DRV_PDEVICE *physDev = dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
if (cap >= PHYSICALWIDTH || (cap % 2)) if (cap >= PHYSICALWIDTH || (cap % 2))
{ {
FIXME("(%04x): unsupported capability %d, will return 0\n", dc->hSelf, cap ); FIXME("(%04x): unsupported capability %d, will return 0\n", physDev->hdc, cap );
return 0; return 0;
} }
return *((WORD *)&physDev->DevCaps + (cap / 2)); return *((WORD *)&physDev->DevCaps + (cap / 2));
...@@ -337,7 +345,7 @@ static INT WIN16DRV_GetDeviceCaps( DC *dc, INT cap ) ...@@ -337,7 +345,7 @@ static INT WIN16DRV_GetDeviceCaps( DC *dc, INT cap )
/*********************************************************************** /***********************************************************************
* WIN16DRV_ExtEscape * WIN16DRV_ExtEscape
*/ */
static INT WIN16DRV_ExtEscape( DC *dc, INT escape, INT in_count, LPCVOID in_data, static INT WIN16DRV_ExtEscape( PHYSDEV dev, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data ) INT out_count, LPVOID out_data )
{ {
#if 0 #if 0
......
...@@ -31,21 +31,70 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi); ...@@ -31,21 +31,70 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdi);
/*********************************************************************** /***********************************************************************
* WIN16DRV_SelectObject * WIN16DRV_SelectBitmap
*/ */
HGDIOBJ WIN16DRV_SelectObject( DC *dc, HGDIOBJ handle ) HBITMAP WIN16DRV_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
{ {
TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
switch(GetObjectType( handle ))
{
case OBJ_PEN: return WIN16DRV_PEN_SelectObject( dc, handle );
case OBJ_BRUSH: return WIN16DRV_BRUSH_SelectObject( dc, handle );
case OBJ_FONT: return WIN16DRV_FONT_SelectObject( dc, handle );
case OBJ_REGION: return (HGDIOBJ)SelectClipRgn( dc->hSelf, handle );
case OBJ_BITMAP:
FIXME("BITMAP not implemented\n"); FIXME("BITMAP not implemented\n");
return 1; return 1;
}
/***********************************************************************
* WIN16DRV_SelectBrush
*/
HBRUSH WIN16DRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
int nSize;
LOGBRUSH16 lBrush16;
if (!GetObject16( hbrush, sizeof(lBrush16), &lBrush16 )) return 0;
if ( physDev->BrushInfo )
{
TRACE("UnRealizing BrushInfo\n");
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_BRUSH,
physDev->BrushInfo,
physDev->BrushInfo, 0);
} }
return 0; else
{
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_BRUSH, &lBrush16, 0, 0);
physDev->BrushInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
}
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_BRUSH,
&lBrush16, physDev->BrushInfo, win16drv_SegPtr_TextXForm);
return hbrush;
}
/***********************************************************************
* WIN16DRV_SelectPen
*/
HPEN WIN16DRV_SelectPen( PHYSDEV dev, HPEN hpen )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
int nSize;
LOGPEN16 lPen16;
if (!GetObject16( hpen, sizeof(lPen16), &lPen16 )) return 0;
if ( physDev->PenInfo )
{
TRACE("UnRealizing PenInfo\n");
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
physDev->PenInfo,
physDev->PenInfo, 0);
}
else
{
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN, &lPen16, 0, 0);
physDev->PenInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
}
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
&lPen16, physDev->PenInfo, 0);
return hpen;
} }
/*
* GDI pen objects
*
* Copyright 1997 John Harvey
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "win16drv/win16drv.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
/***********************************************************************
* PEN_SelectObject
*/
HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen )
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
HPEN prevHandle = dc->hPen;
int nSize;
LOGPEN16 lPen16;
if (!GetObject16( hpen, sizeof(lPen16), &lPen16 )) return 0;
dc->hPen = hpen;
if ( physDev->PenInfo )
{
TRACE("UnRealizing PenInfo\n");
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, -DRVOBJ_PEN,
physDev->PenInfo,
physDev->PenInfo, 0);
}
else
{
nSize = PRTDRV_RealizeObject (physDev->segptrPDEVICE, DRVOBJ_PEN,
&lPen16, 0, 0);
physDev->PenInfo = HeapAlloc( GetProcessHeap(), 0, nSize );
}
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, DRVOBJ_PEN,
&lPen16,
physDev->PenInfo,
0);
return prevHandle;
}
...@@ -31,11 +31,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(win16drv); ...@@ -31,11 +31,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
/*********************************************************************** /***********************************************************************
* WIN16DRV_ExtTextOut * WIN16DRV_ExtTextOut
*/ */
BOOL WIN16DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count, const RECT *lprect, LPCWSTR wstr, UINT count,
const INT *lpDx ) const INT *lpDx )
{ {
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev; WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dev;
DC *dc = physDev->dc;
BOOL bRet = 1; BOOL bRet = 1;
RECT16 clipRect; RECT16 clipRect;
RECT16 opaqueRect; RECT16 opaqueRect;
......
...@@ -205,6 +205,8 @@ typedef struct ...@@ -205,6 +205,8 @@ typedef struct
LPFONTINFO16 FontInfo; /* Current font realized by printer driver */ LPFONTINFO16 FontInfo; /* Current font realized by printer driver */
LPLOGBRUSH16 BrushInfo; /* Current brush realized by printer driver */ LPLOGBRUSH16 BrushInfo; /* Current brush realized by printer driver */
LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */ LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */
HDC hdc;
DC *dc;
DeviceCaps DevCaps; /* Device caps */ DeviceCaps DevCaps; /* Device caps */
} WIN16DRV_PDEVICE; } WIN16DRV_PDEVICE;
...@@ -257,26 +259,27 @@ extern WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer, ...@@ -257,26 +259,27 @@ extern WORD PRTDRV_GetCharWidth(LPPDEVICE lpDestDev, LPINT lpBuffer,
/* Wine driver functions */ /* Wine driver functions */
extern const DC_FUNCTIONS *WIN16DRV_Init(void); extern const DC_FUNCTIONS *WIN16DRV_Init(void);
extern BOOL WIN16DRV_GetCharWidth( struct tagDC *dc, UINT firstChar, UINT lastChar, extern BOOL WIN16DRV_GetCharWidth( PHYSDEV dev, UINT firstChar, UINT lastChar, LPINT buffer );
LPINT buffer );
extern BOOL WIN16DRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count, extern BOOL WIN16DRV_GetTextExtentPoint( PHYSDEV dev, LPCWSTR str, INT count,
LPSIZE size ); LPSIZE size );
extern BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics ); extern BOOL WIN16DRV_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics );
extern BOOL WIN16DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, extern BOOL WIN16DRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count, const RECT *lprect, LPCWSTR str, UINT count,
const INT *lpDx ); const INT *lpDx );
extern BOOL WIN16DRV_LineTo( DC *dc, INT x, INT y ); extern BOOL WIN16DRV_LineTo( PHYSDEV dev, INT x, INT y );
extern BOOL WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count ); extern BOOL WIN16DRV_Polygon(PHYSDEV dev, const POINT* pt, INT count );
extern BOOL WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count ); extern BOOL WIN16DRV_Polyline(PHYSDEV dev, const POINT* pt, INT count );
extern BOOL WIN16DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom); extern BOOL WIN16DRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom);
extern HGDIOBJ WIN16DRV_SelectObject( DC *dc, HGDIOBJ handle ); extern HBITMAP WIN16DRV_SelectBitmap( PHYSDEV dev, HBITMAP handle );
extern BOOL WIN16DRV_PatBlt( struct tagDC *dc, INT left, INT top, extern HBRUSH WIN16DRV_SelectBrush( PHYSDEV dev, HBRUSH handle );
extern HFONT WIN16DRV_SelectFont( PHYSDEV dev, HFONT handle );
extern HPEN WIN16DRV_SelectPen( PHYSDEV dev, HPEN handle );
extern BOOL WIN16DRV_PatBlt( PHYSDEV dev, INT left, INT top,
INT width, INT height, DWORD rop ); INT width, INT height, DWORD rop );
extern BOOL WIN16DRV_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom); extern BOOL WIN16DRV_Ellipse(PHYSDEV dev, INT left, INT top, INT right, INT bottom);
extern BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, extern BOOL WIN16DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, DEVICEFONTENUMPROC proc, LPARAM lp );
DEVICEFONTENUMPROC proc, LPARAM lp );
extern INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, extern INT WIN16DRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd,
LPDEVMODEA lpdmOutput, LPDEVMODEA lpdmOutput,
...@@ -287,10 +290,6 @@ extern DWORD WIN16DRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, ...@@ -287,10 +290,6 @@ extern DWORD WIN16DRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
LPCSTR lpszPort, WORD fwCapability, LPCSTR lpszPort, WORD fwCapability,
LPSTR lpszOutput, LPDEVMODEA lpdm); LPSTR lpszOutput, LPDEVMODEA lpdm);
extern HBRUSH WIN16DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush );
extern HFONT WIN16DRV_FONT_SelectObject( DC * dc, HFONT hfont );
extern HPEN WIN16DRV_PEN_SelectObject( DC * dc, HPEN hpen );
/* /*
* Wine 16bit driver global variables * Wine 16bit driver global variables
*/ */
......
...@@ -136,23 +136,29 @@ static LONG TTYDRV_DC_GetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count) ...@@ -136,23 +136,29 @@ static LONG TTYDRV_DC_GetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count)
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_BITMAP_SelectObject * TTYDRV_SelectBitmap (TTYDRV.@)
*/ */
HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap) HBITMAP TTYDRV_SelectBitmap(TTYDRV_PDEVICE *physDev, HBITMAP hbitmap)
{ {
HBITMAP hPreviousBitmap; DC *dc = physDev->dc;
BITMAPOBJ *bitmap;
TRACE("(%p, 0x%04x, %p)\n", dc, hbitmap, bitmap); TRACE("(%p, 0x%04x)\n", dc, hbitmap);
if(!(dc->flags & DC_MEMORY)) if(!(dc->flags & DC_MEMORY))
return 0; return 0;
if (!(bitmap = GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return 0;
/* Assure that the bitmap device dependent */ /* Assure that the bitmap device dependent */
if(!bitmap->physBitmap && !TTYDRV_DC_CreateBitmap(hbitmap)) if(!bitmap->physBitmap && !TTYDRV_DC_CreateBitmap(hbitmap))
{
GDI_ReleaseObj( hbitmap );
return 0; return 0;
}
if(bitmap->funcs != dc->funcs) { if(bitmap->funcs != dc->funcs) {
ERR("Trying to select a non-TTY DDB into a TTY DC\n"); ERR("Trying to select a non-TTY DDB into a TTY DC\n");
GDI_ReleaseObj( hbitmap );
return 0; return 0;
} }
...@@ -169,15 +175,14 @@ HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap ...@@ -169,15 +175,14 @@ HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap
HRGN hrgn; HRGN hrgn;
if(!(hrgn = CreateRectRgn(0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight))) if(!(hrgn = CreateRectRgn(0, 0, bitmap->bitmap.bmWidth, bitmap->bitmap.bmHeight)))
{
GDI_ReleaseObj( hbitmap );
return 0; return 0;
}
dc->hVisRgn = hrgn; dc->hVisRgn = hrgn;
} }
GDI_ReleaseObj( hbitmap );
hPreviousBitmap = dc->hBitmap; return hbitmap;
dc->hBitmap = hbitmap;
return hPreviousBitmap;
} }
/*********************************************************************** /***********************************************************************
...@@ -194,95 +199,25 @@ static LONG TTYDRV_DC_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count) ...@@ -194,95 +199,25 @@ static LONG TTYDRV_DC_SetBitmapBits(BITMAPOBJ *bitmap, void *bits, LONG count)
* TTYDRV_BITMAP_CreateDIBSection * TTYDRV_BITMAP_CreateDIBSection
*/ */
HBITMAP TTYDRV_BITMAP_CreateDIBSection( HBITMAP TTYDRV_BITMAP_CreateDIBSection(
DC *dc, BITMAPINFO *bmi, UINT usage, TTYDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage,
LPVOID *bits, HANDLE section, DWORD offset) LPVOID *bits, HANDLE section, DWORD offset)
{ {
FIXME("(%p, %p, %u, %p, 0x%04x, %ld): stub\n", FIXME("(%x, %p, %u, %p, 0x%04x, %ld): stub\n",
dc, bmi, usage, bits, section, offset); physDev->hdc, bmi, usage, bits, section, offset);
return (HBITMAP) NULL; return (HBITMAP) NULL;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_BITMAP_DeleteDIBSection
*/
void TTYDRV_BITMAP_DeleteDIBSection(BITMAPOBJ *bmp)
{
FIXME("(%p): stub\n", bmp);
}
/***********************************************************************
* TTYDRV_BITMAP_SetDIBColorTable
*/
UINT TTYDRV_BITMAP_SetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count, const RGBQUAD *colors)
{
FIXME("(%p): stub\n", bmp);
return 0;
}
/***********************************************************************
* TTYDRV_BITMAP_GetDIBColorTable
*/
UINT TTYDRV_BITMAP_GetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count, RGBQUAD *colors)
{
FIXME("(%p): stub\n", bmp);
return 0;
}
/***********************************************************************
* TTYDRV_BITMAP_Lock
*/
INT TTYDRV_BITMAP_Lock(BITMAPOBJ *bmp, INT req, BOOL lossy)
{
FIXME("(%p): stub\n", bmp);
return DIB_Status_None;
}
/***********************************************************************
* TTYDRV_BITMAP_Unlock
*/
void TTYDRV_BITMAP_Unlock(BITMAPOBJ *bmp, BOOL commit)
{
FIXME("(%p): stub\n", bmp);
}
/***********************************************************************
* TTYDRV_BITMAP_GetDIBits
*/
INT TTYDRV_BITMAP_GetDIBits(
BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines,
LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
{
FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
return 0;
}
/***********************************************************************
* TTYDRV_BITMAP_SetDIBits
*/
INT TTYDRV_BITMAP_SetDIBits(
BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines,
LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap)
{
FIXME("(%p, %p, %u, %u, %p, %p, %u, 0x%04x): stub\n",
bmp, dc, startscan, lines, bits, info, coloruse, hbitmap);
return 0;
}
/***********************************************************************
* TTYDRV_DC_SetDIBitsToDevice * TTYDRV_DC_SetDIBitsToDevice
*/ */
INT TTYDRV_DC_SetDIBitsToDevice(DC *dc, INT xDest, INT yDest, DWORD cx, INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, DWORD cy, INT xSrc, INT ySrc,
UINT startscan, UINT lines, LPCVOID bits, UINT startscan, UINT lines, LPCVOID bits,
const BITMAPINFO *info, UINT coloruse) const BITMAPINFO *info, UINT coloruse)
{ {
FIXME("(%p, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n", FIXME("(%x, %d, %d, %ld, %ld, %d, %d, %u, %u, %p, %p, %u): stub\n",
dc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse); physDev->hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, bits, info, coloruse);
return 0; return 0;
} }
...@@ -31,17 +31,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv); ...@@ -31,17 +31,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/**********************************************************************/ /**********************************************************************/
BITMAP_DRIVER TTYDRV_BITMAP_Driver =
{
TTYDRV_BITMAP_SetDIBits,
TTYDRV_BITMAP_GetDIBits,
TTYDRV_BITMAP_DeleteDIBSection,
TTYDRV_BITMAP_SetDIBColorTable,
TTYDRV_BITMAP_GetDIBColorTable,
TTYDRV_BITMAP_Lock,
TTYDRV_BITMAP_Unlock
};
PALETTE_DRIVER TTYDRV_PALETTE_Driver = PALETTE_DRIVER TTYDRV_PALETTE_Driver =
{ {
TTYDRV_PALETTE_SetMapping, TTYDRV_PALETTE_SetMapping,
...@@ -56,7 +45,6 @@ const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */ ...@@ -56,7 +45,6 @@ const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
*/ */
BOOL TTYDRV_GDI_Initialize(void) BOOL TTYDRV_GDI_Initialize(void)
{ {
BITMAP_Driver = &TTYDRV_BITMAP_Driver;
PALETTE_Driver = &TTYDRV_PALETTE_Driver; PALETTE_Driver = &TTYDRV_PALETTE_Driver;
return TTYDRV_PALETTE_Initialize(); return TTYDRV_PALETTE_Initialize();
...@@ -84,6 +72,8 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, ...@@ -84,6 +72,8 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
return FALSE; return FALSE;
} }
physDev = (TTYDRV_PDEVICE *) dc->physDev; physDev = (TTYDRV_PDEVICE *) dc->physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
if(dc->flags & DC_MEMORY){ if(dc->flags & DC_MEMORY){
physDev->window = NULL; physDev->window = NULL;
...@@ -121,13 +111,12 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, ...@@ -121,13 +111,12 @@ BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device,
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_DeleteDC * TTYDRV_DC_DeleteDC
*/ */
BOOL TTYDRV_DC_DeleteDC(DC *dc) BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev)
{ {
TRACE("(%p)\n", dc); TRACE("(%x)\n", physDev->hdc);
HeapFree( GetProcessHeap(), 0, dc->physDev );
dc->physDev = NULL;
physDev->dc->physDev = NULL;
HeapFree( GetProcessHeap(), 0, physDev );
return TRUE; return TRUE;
} }
...@@ -135,7 +124,7 @@ BOOL TTYDRV_DC_DeleteDC(DC *dc) ...@@ -135,7 +124,7 @@ BOOL TTYDRV_DC_DeleteDC(DC *dc)
/*********************************************************************** /***********************************************************************
* GetDeviceCaps (TTYDRV.@) * GetDeviceCaps (TTYDRV.@)
*/ */
INT TTYDRV_GetDeviceCaps( DC *dc, INT cap ) INT TTYDRV_GetDeviceCaps( TTYDRV_PDEVICE *physDev, INT cap )
{ {
switch(cap) switch(cap)
{ {
...@@ -209,7 +198,7 @@ INT TTYDRV_GetDeviceCaps( DC *dc, INT cap ) ...@@ -209,7 +198,7 @@ INT TTYDRV_GetDeviceCaps( DC *dc, INT cap )
case BTLALIGNMENT: case BTLALIGNMENT:
return 0; return 0;
default: default:
FIXME("(%04x): unsupported capability %d, will return 0\n", dc->hSelf, cap ); FIXME("(%04x): unsupported capability %d, will return 0\n", physDev->hdc, cap );
return 0; return 0;
} }
} }
...@@ -218,7 +207,7 @@ INT TTYDRV_GetDeviceCaps( DC *dc, INT cap ) ...@@ -218,7 +207,7 @@ INT TTYDRV_GetDeviceCaps( DC *dc, INT cap )
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_SetDeviceClipping * TTYDRV_DC_SetDeviceClipping
*/ */
void TTYDRV_DC_SetDeviceClipping(DC *dc) void TTYDRV_DC_SetDeviceClipping(TTYDRV_PDEVICE *physDev)
{ {
TRACE("(%p)\n", dc); TRACE("(%x)\n", physDev->hdc);
} }
...@@ -29,89 +29,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv); ...@@ -29,89 +29,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/**********************************************************************/ /**********************************************************************/
extern HBITMAP TTYDRV_DC_BITMAP_SelectObject(DC *dc, HBITMAP hbitmap, BITMAPOBJ *bitmap);
extern BOOL TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap, BITMAPOBJ *bitmap); extern BOOL TTYDRV_DC_BITMAP_DeleteObject(HBITMAP hbitmap, BITMAPOBJ *bitmap);
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_BRUSH_SelectObject * TTYDRV_SelectFont (TTYDRV.@)
*/ */
static HBRUSH TTYDRV_DC_BRUSH_SelectObject(DC *dc, HBRUSH hbrush) HFONT TTYDRV_SelectFont(TTYDRV_PDEVICE *physDev, HFONT hfont)
{ {
HBRUSH hPreviousBrush; TRACE("(%x, 0x%04x)\n", physDev->hdc, hfont);
TRACE("(%p, 0x%04x)\n", dc, hbrush);
hPreviousBrush = dc->hBrush;
dc->hBrush = hbrush;
return hPreviousBrush;
}
/***********************************************************************
* TTYDRV_DC_FONT_SelectObject
*/
static HFONT TTYDRV_DC_FONT_SelectObject(DC* dc, HFONT hfont)
{
TRACE("(%p, 0x%04x)\n", dc, hfont);
return TRUE; /* Use device font */ return TRUE; /* Use device font */
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_PEN_SelectObject
*/
static HPEN TTYDRV_DC_PEN_SelectObject(DC *dc, HBRUSH hpen)
{
HPEN hPreviousPen;
TRACE("(%p, 0x%04x)\n", dc, hpen);
hPreviousPen = dc->hPen;
dc->hPen = hpen;
return hPreviousPen;
}
/***********************************************************************
* TTYDRV_DC_SelectObject
*/
HGDIOBJ TTYDRV_DC_SelectObject(DC *dc, HGDIOBJ handle)
{
GDIOBJHDR *ptr = GDI_GetObjPtr(handle, MAGIC_DONTCARE);
HGDIOBJ result = 0;
if(!ptr) return 0;
switch(GDIMAGIC(ptr->wMagic))
{
case BITMAP_MAGIC:
result = TTYDRV_DC_BITMAP_SelectObject(dc, handle, (BITMAPOBJ *) ptr);
break;
case BRUSH_MAGIC:
result = TTYDRV_DC_BRUSH_SelectObject(dc, handle);
break;
case FONT_MAGIC:
result = TTYDRV_DC_FONT_SelectObject(dc, handle);
break;
case PEN_MAGIC:
result = TTYDRV_DC_PEN_SelectObject(dc, handle);
break;
case REGION_MAGIC:
/* FIXME: Shouldn't be handled here */
result = (HGDIOBJ) SelectClipRgn(dc->hSelf, handle);
break;
default:
ERR("handle (0x%04x) has unknown magic (0x%04x)\n",
handle, GDIMAGIC(ptr->wMagic));
}
GDI_ReleaseObj(handle);
return result;
}
/***********************************************************************
* TTYDRV_DC_DeleteObject * TTYDRV_DC_DeleteObject
*/ */
BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle) BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle)
...@@ -133,8 +64,7 @@ BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle) ...@@ -133,8 +64,7 @@ BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle)
result = TRUE; result = TRUE;
break; break;
default: default:
ERR("handle (0x%04x) has unknown magic (0x%04x)\n", ERR("handle (0x%04x) has unknown magic (0x%04x)\n", handle, GDIMAGIC(ptr->wMagic));
handle, GDIMAGIC(ptr->wMagic));
result = FALSE; result = FALSE;
} }
......
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
struct tagCLASS; struct tagCLASS;
struct tagDC;
struct tagDESKTOP; struct tagDESKTOP;
struct tagPALETTEOBJ; struct tagPALETTEOBJ;
struct tagWND; struct tagWND;
...@@ -56,24 +55,9 @@ struct tagWINDOWPOS; ...@@ -56,24 +55,9 @@ struct tagWINDOWPOS;
* TTY GDI driver * TTY GDI driver
*/ */
extern BOOL TTYDRV_GDI_Initialize(void);
/* TTY GDI bitmap driver */
extern HBITMAP TTYDRV_BITMAP_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset);
extern INT TTYDRV_BITMAP_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
extern INT TTYDRV_BITMAP_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan, UINT lines, LPVOID bits, BITMAPINFO *info, UINT coloruse, HBITMAP hbitmap);
extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
extern UINT TTYDRV_BITMAP_SetDIBColorTable(struct tagBITMAPOBJ *,struct tagDC *,UINT,UINT,const RGBQUAD *);
extern UINT TTYDRV_BITMAP_GetDIBColorTable(struct tagBITMAPOBJ *,struct tagDC *,UINT,UINT,RGBQUAD *);
extern INT TTYDRV_BITMAP_Lock(struct tagBITMAPOBJ *,INT,BOOL);
extern void TTYDRV_BITMAP_Unlock(struct tagBITMAPOBJ *,BOOL);
#ifndef WINE_CURSES
typedef struct { int dummy; } WINDOW;
#endif
typedef struct { typedef struct {
HDC hdc;
DC *dc;
WINDOW *window; WINDOW *window;
int cellWidth; int cellWidth;
int cellHeight; int cellHeight;
...@@ -83,42 +67,50 @@ typedef struct { ...@@ -83,42 +67,50 @@ typedef struct {
int dummy; /* FIXME: Remove later */ int dummy; /* FIXME: Remove later */
} TTYDRV_PHYSBITMAP; } TTYDRV_PHYSBITMAP;
extern BOOL TTYDRV_GDI_Initialize(void);
/* TTY GDI bitmap driver */
extern HBITMAP TTYDRV_BITMAP_CreateDIBSection(TTYDRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage, LPVOID *bits, HANDLE section, DWORD offset);
extern void TTYDRV_BITMAP_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
#ifndef WINE_CURSES
typedef struct { int dummy; } WINDOW;
#endif
extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap); extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap);
extern BOOL TTYDRV_DC_Arc(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend); extern BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags); extern LONG TTYDRV_DC_BitmapBits(HBITMAP hbitmap, void *bits, LONG count, WORD flags);
extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap); extern BOOL TTYDRV_DC_CreateBitmap(HBITMAP hbitmap);
extern BOOL TTYDRV_DC_CreateDC(struct tagDC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODEA *initData); extern BOOL TTYDRV_DC_CreateDC(DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output, const DEVMODEA *initData);
extern BOOL TTYDRV_DC_DeleteDC(struct tagDC *dc); extern BOOL TTYDRV_DC_DeleteDC(TTYDRV_PDEVICE *physDev);
extern BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle); extern BOOL TTYDRV_DC_DeleteObject(HGDIOBJ handle);
extern BOOL TTYDRV_DC_BitBlt(struct tagDC *dcDst, INT xDst, INT yDst, INT width, INT height, struct tagDC *dcSrc, INT xSrc, INT ySrc, DWORD rop); extern BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT width, INT height, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, DWORD rop);
extern BOOL TTYDRV_DC_Chord(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend); extern BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern BOOL TTYDRV_DC_Ellipse(struct tagDC *dc, INT left, INT top, INT right, INT bottom); extern BOOL TTYDRV_DC_Ellipse(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom);
extern INT TTYDRV_DC_Escape(struct tagDC *dc, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData); extern INT TTYDRV_DC_Escape(TTYDRV_PDEVICE *physDev, INT nEscape, INT cbInput, SEGPTR lpInData, SEGPTR lpOutData);
extern BOOL TTYDRV_DC_ExtFloodFill(struct tagDC *dc, INT x, INT y, COLORREF color, UINT fillType); extern BOOL TTYDRV_DC_ExtFloodFill(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color, UINT fillType);
extern BOOL TTYDRV_DC_ExtTextOut(struct tagDC *dc, INT x, INT y, UINT flags, const RECT *lpRect, LPCWSTR str, UINT count, const INT *lpDx); extern BOOL TTYDRV_DC_ExtTextOut(TTYDRV_PDEVICE *physDev, INT x, INT y, UINT flags, const RECT *lpRect, LPCWSTR str, UINT count, const INT *lpDx);
extern BOOL TTYDRV_DC_GetCharWidth(struct tagDC *dc, UINT firstChar, UINT lastChar, LPINT buffer); extern BOOL TTYDRV_DC_GetCharWidth(TTYDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar, LPINT buffer);
extern COLORREF TTYDRV_DC_GetPixel(struct tagDC *dc, INT x, INT y); extern COLORREF TTYDRV_DC_GetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y);
extern BOOL TTYDRV_DC_GetTextExtentPoint(struct tagDC *dc, LPCWSTR str, INT count, LPSIZE size); extern BOOL TTYDRV_DC_GetTextExtentPoint(TTYDRV_PDEVICE *physDev, LPCWSTR str, INT count, LPSIZE size);
extern BOOL TTYDRV_DC_GetTextMetrics(struct tagDC *dc, TEXTMETRICW *metrics); extern BOOL TTYDRV_DC_GetTextMetrics(TTYDRV_PDEVICE *physDev, TEXTMETRICW *metrics);
extern BOOL TTYDRV_DC_LineTo(struct tagDC *dc, INT x, INT y); extern BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y);
extern BOOL TTYDRV_DC_PaintRgn(struct tagDC *dc, HRGN hrgn); extern BOOL TTYDRV_DC_PaintRgn(TTYDRV_PDEVICE *physDev, HRGN hrgn);
extern BOOL TTYDRV_DC_PatBlt(struct tagDC *dc, INT left, INT top, INT width, INT height, DWORD rop); extern BOOL TTYDRV_DC_PatBlt(TTYDRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop);
extern BOOL TTYDRV_DC_Pie(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend); extern BOOL TTYDRV_DC_Pie(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend);
extern BOOL TTYDRV_DC_Polygon(struct tagDC *dc, const POINT* pt, INT count); extern BOOL TTYDRV_DC_Polygon(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count);
extern BOOL TTYDRV_DC_Polyline(struct tagDC *dc, const POINT* pt, INT count); extern BOOL TTYDRV_DC_Polyline(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count);
extern BOOL TTYDRV_DC_PolyPolygon(struct tagDC *dc, const POINT* pt, const INT* counts, UINT polygons); extern BOOL TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons);
extern BOOL TTYDRV_DC_PolyPolyline(struct tagDC *dc, const POINT* pt, const DWORD* counts, DWORD polylines); extern BOOL TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines);
extern BOOL TTYDRV_DC_Rectangle(struct tagDC *dc, INT left, INT top, INT right, INT bottom); extern BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom);
extern BOOL TTYDRV_DC_RoundRect(struct tagDC *dc, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height); extern BOOL TTYDRV_DC_RoundRect(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom, INT ell_width, INT ell_height);
extern void TTYDRV_DC_SetDeviceClipping(struct tagDC *dc); extern void TTYDRV_DC_SetDeviceClipping(TTYDRV_PDEVICE *physDev);
extern HGDIOBJ TTYDRV_DC_SelectObject(struct tagDC *dc, HGDIOBJ handle); extern COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color);
extern COLORREF TTYDRV_DC_SetBkColor(struct tagDC *dc, COLORREF color); extern BOOL TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop);
extern COLORREF TTYDRV_DC_SetPixel(struct tagDC *dc, INT x, INT y, COLORREF color); INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse);
extern COLORREF TTYDRV_DC_SetTextColor(struct tagDC *dc, COLORREF color);
extern BOOL TTYDRV_DC_StretchBlt(struct tagDC *dcDst, INT xDst, INT yDst, INT widthDst, INT heightDst, struct tagDC *dcSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, DWORD rop);
INT TTYDRV_DC_SetDIBitsToDevice(struct tagDC *dc, INT xDest, INT yDest, DWORD cx, DWORD cy, INT xSrc, INT ySrc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse);
/* TTY GDI palette driver */ /* TTY GDI palette driver */
......
...@@ -37,12 +37,11 @@ debug_channels (ttydrv) ...@@ -37,12 +37,11 @@ debug_channels (ttydrv)
@ cdecl Polyline(ptr ptr long) TTYDRV_DC_Polyline @ cdecl Polyline(ptr ptr long) TTYDRV_DC_Polyline
@ cdecl Rectangle(ptr long long long long) TTYDRV_DC_Rectangle @ cdecl Rectangle(ptr long long long long) TTYDRV_DC_Rectangle
@ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect @ cdecl RoundRect(ptr long long long long long long) TTYDRV_DC_RoundRect
@ cdecl SelectObject(ptr long) TTYDRV_DC_SelectObject @ cdecl SelectBitmap(ptr long) TTYDRV_SelectBitmap
@ cdecl SetBkColor(ptr long) TTYDRV_DC_SetBkColor @ cdecl SelectFont(ptr long) TTYDRV_SelectFont
@ cdecl SetDeviceClipping(ptr) TTYDRV_DC_SetDeviceClipping
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice @ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) TTYDRV_DC_SetDIBitsToDevice
@ cdecl SetDeviceClipping(ptr) TTYDRV_DC_SetDeviceClipping
@ cdecl SetPixel(ptr long long long) TTYDRV_DC_SetPixel @ cdecl SetPixel(ptr long long long) TTYDRV_DC_SetPixel
@ cdecl SetTextColor(ptr long) TTYDRV_DC_SetTextColor
@ cdecl StretchBlt(ptr long long long long ptr long long long long long) TTYDRV_DC_StretchBlt @ cdecl StretchBlt(ptr long long long long ptr long long long long long) TTYDRV_DC_StretchBlt
# USER driver # USER driver
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "config.h" #include "config.h"
#include "dinput.h" #include "dinput.h"
#include "gdi.h"
#include "ttydrv.h" #include "ttydrv.h"
#include "wine/debug.h" #include "wine/debug.h"
......
...@@ -30,16 +30,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); ...@@ -30,16 +30,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
* *
* PSDRV_PatBlt * PSDRV_PatBlt
*/ */
BOOL PSDRV_PatBlt(DC *dc, INT x, INT y, INT width, INT height, DWORD dwRop) BOOL PSDRV_PatBlt(PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, DWORD dwRop)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
switch(dwRop) { switch(dwRop) {
case PATCOPY: case PATCOPY:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteRectangle(dc, XLPTODP(dc, x), YLPTODP(dc, y), PSDRV_WriteRectangle(physDev, XLPTODP(dc, x), YLPTODP(dc, y),
XLSTODS(dc, width), YLSTODS(dc, height)); XLSTODS(dc, width), YLSTODS(dc, height));
PSDRV_Brush(dc, FALSE); PSDRV_Brush(physDev, FALSE);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
return TRUE; return TRUE;
case BLACKNESS: case BLACKNESS:
...@@ -47,14 +48,14 @@ BOOL PSDRV_PatBlt(DC *dc, INT x, INT y, INT width, INT height, DWORD dwRop) ...@@ -47,14 +48,14 @@ BOOL PSDRV_PatBlt(DC *dc, INT x, INT y, INT width, INT height, DWORD dwRop)
{ {
PSCOLOR pscol; PSCOLOR pscol;
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteRectangle(dc, XLPTODP(dc, x), YLPTODP(dc, y), PSDRV_WriteRectangle(physDev, XLPTODP(dc, x), YLPTODP(dc, y),
XLSTODS(dc, width), YLSTODS(dc, height)); XLSTODS(dc, width), YLSTODS(dc, height));
PSDRV_CreateColor( physDev, &pscol, (dwRop == BLACKNESS) ? PSDRV_CreateColor( physDev, &pscol, (dwRop == BLACKNESS) ?
RGB(0,0,0) : RGB(0xff,0xff,0xff) ); RGB(0,0,0) : RGB(0xff,0xff,0xff) );
PSDRV_WriteSetColor(dc, &pscol); PSDRV_WriteSetColor(physDev, &pscol);
PSDRV_WriteFill(dc); PSDRV_WriteFill(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
return TRUE; return TRUE;
} }
default: default:
......
...@@ -19,13 +19,65 @@ ...@@ -19,13 +19,65 @@
*/ */
#include "psdrv.h" #include "psdrv.h"
#include "wine/debug.h"
#include "bitmap.h"
#include "winbase.h" #include "winbase.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/* Return the width of a DIB bitmap in bytes. DIB bitmap data is 32-bit aligned. */
inline static int get_dib_width_bytes( int width, int depth )
{
int words;
switch(depth)
{
case 1: words = (width + 31) / 32; break;
case 4: words = (width + 7) / 8; break;
case 8: words = (width + 3) / 4; break;
case 15:
case 16: words = (width + 1) / 2; break;
case 24: words = (width * 3 + 3)/4; break;
default:
WARN("(%d): Unsupported depth\n", depth );
/* fall through */
case 32: words = width; break;
}
return 4 * words;
}
/* get the bitmap info from either an INFOHEADER or COREHEADER bitmap */
static BOOL get_bitmap_info( const void *ptr, LONG *width, LONG *height, WORD *bpp, WORD *compr )
{
const BITMAPINFOHEADER *header = ptr;
switch(header->biSize)
{
case sizeof(BITMAPCOREHEADER):
{
const BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header;
*width = core->bcWidth;
*height = core->bcHeight;
*bpp = core->bcBitCount;
*compr = 0;
}
return TRUE;
case sizeof(BITMAPINFOHEADER):
case sizeof(BITMAPV4HEADER):
case sizeof(BITMAPV5HEADER):
/* V4 and V5 structures are a superset of the INFOHEADER structure */
*width = header->biWidth;
*height = header->biHeight;
*bpp = header->biBitCount;
*compr = header->biCompression;
return TRUE;
default:
ERR("(%ld): unknown/wrong size for header\n", header->biSize );
return FALSE;
}
}
/*************************************************************************** /***************************************************************************
* PSDRV_WriteImageHeader * PSDRV_WriteImageHeader
* *
...@@ -35,7 +87,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); ...@@ -35,7 +87,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
* Uses level 2 PostScript * Uses level 2 PostScript
*/ */
static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst, static BOOL PSDRV_WriteImageHeader(PSDRV_PDEVICE *physDev, const BITMAPINFO *info, INT xDst,
INT yDst, INT widthDst, INT heightDst, INT yDst, INT widthDst, INT heightDst,
INT widthSrc, INT heightSrc) INT widthSrc, INT heightSrc)
{ {
...@@ -44,36 +96,36 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst, ...@@ -44,36 +96,36 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst,
switch(info->bmiHeader.biBitCount) { switch(info->bmiHeader.biBitCount) {
case 8: case 8:
PSDRV_WriteIndexColorSpaceBegin(dc, 255); PSDRV_WriteIndexColorSpaceBegin(physDev, 255);
for(i = 0; i < 256; i++) { for(i = 0; i < 256; i++) {
map[i] = info->bmiColors[i].rgbRed | map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 | info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16; info->bmiColors[i].rgbBlue << 16;
} }
PSDRV_WriteRGB(dc, map, 256); PSDRV_WriteRGB(physDev, map, 256);
PSDRV_WriteIndexColorSpaceEnd(dc); PSDRV_WriteIndexColorSpaceEnd(physDev);
break; break;
case 4: case 4:
PSDRV_WriteIndexColorSpaceBegin(dc, 15); PSDRV_WriteIndexColorSpaceBegin(physDev, 15);
for(i = 0; i < 16; i++) { for(i = 0; i < 16; i++) {
map[i] = info->bmiColors[i].rgbRed | map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 | info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16; info->bmiColors[i].rgbBlue << 16;
} }
PSDRV_WriteRGB(dc, map, 16); PSDRV_WriteRGB(physDev, map, 16);
PSDRV_WriteIndexColorSpaceEnd(dc); PSDRV_WriteIndexColorSpaceEnd(physDev);
break; break;
case 1: case 1:
PSDRV_WriteIndexColorSpaceBegin(dc, 1); PSDRV_WriteIndexColorSpaceBegin(physDev, 1);
for(i = 0; i < 2; i++) { for(i = 0; i < 2; i++) {
map[i] = info->bmiColors[i].rgbRed | map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 | info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16; info->bmiColors[i].rgbBlue << 16;
} }
PSDRV_WriteRGB(dc, map, 2); PSDRV_WriteRGB(physDev, map, 2);
PSDRV_WriteIndexColorSpaceEnd(dc); PSDRV_WriteIndexColorSpaceEnd(physDev);
break; break;
case 15: case 15:
...@@ -84,7 +136,7 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst, ...@@ -84,7 +136,7 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst,
PSCOLOR pscol; PSCOLOR pscol;
pscol.type = PSCOLOR_RGB; pscol.type = PSCOLOR_RGB;
pscol.value.rgb.r = pscol.value.rgb.g = pscol.value.rgb.b = 0.0; pscol.value.rgb.r = pscol.value.rgb.g = pscol.value.rgb.b = 0.0;
PSDRV_WriteSetColor(dc, &pscol); PSDRV_WriteSetColor(physDev, &pscol);
break; break;
} }
...@@ -94,7 +146,7 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst, ...@@ -94,7 +146,7 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst,
break; break;
} }
PSDRV_WriteImageDict(dc, info->bmiHeader.biBitCount, xDst, yDst, PSDRV_WriteImageDict(physDev, info->bmiHeader.biBitCount, xDst, yDst,
widthDst, heightDst, widthSrc, heightSrc, NULL); widthDst, heightDst, widthSrc, heightSrc, NULL);
return TRUE; return TRUE;
} }
...@@ -109,26 +161,26 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst, ...@@ -109,26 +161,26 @@ static BOOL PSDRV_WriteImageHeader(DC *dc, const BITMAPINFO *info, INT xDst,
* bit depths. * bit depths.
* Compression not implemented. * Compression not implemented.
*/ */
INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst, INT widthDst,
INT heightDst, INT xSrc, INT ySrc, INT heightDst, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, const void *bits, INT widthSrc, INT heightSrc, const void *bits,
const BITMAPINFO *info, UINT wUsage, DWORD dwRop ) const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
{ {
DWORD fullSrcWidth; LONG fullSrcWidth, fullSrcHeight;
INT widthbytes, fullSrcHeight; INT widthbytes;
WORD bpp, compression; WORD bpp, compression;
const char *ptr; const char *ptr;
INT line; INT line;
DC *dc = physDev->dc;
TRACE("%08x (%d,%d %dx%d) -> (%d,%d %dx%d)\n", dc->hSelf, TRACE("%08x (%d,%d %dx%d) -> (%d,%d %dx%d)\n", physDev->hdc,
xSrc, ySrc, widthSrc, heightSrc, xDst, yDst, widthDst, heightDst); xSrc, ySrc, widthSrc, heightSrc, xDst, yDst, widthDst, heightDst);
DIB_GetBitmapInfo((const BITMAPINFOHEADER *)info, &fullSrcWidth, if (!get_bitmap_info( info, &fullSrcWidth, &fullSrcHeight, &bpp, &compression )) return FALSE;
&fullSrcHeight, &bpp, &compression);
widthbytes = DIB_GetDIBWidthBytes(fullSrcWidth, bpp); widthbytes = get_dib_width_bytes(fullSrcWidth, bpp);
TRACE("full size=%ldx%d bpp=%d compression=%d\n", fullSrcWidth, TRACE("full size=%ldx%ld bpp=%d compression=%d\n", fullSrcWidth,
fullSrcHeight, bpp, compression); fullSrcHeight, bpp, compression);
...@@ -145,71 +197,71 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, ...@@ -145,71 +197,71 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
switch(bpp) { switch(bpp) {
case 1: case 1:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
if(xSrc & 7) if(xSrc & 7)
FIXME("This won't work...\n"); FIXME("This won't work...\n");
for(line = 0; line < heightSrc; line++, ptr += widthbytes) for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteBytes(dc, ptr + xSrc/8, (widthSrc+7)/8); PSDRV_WriteBytes(physDev, ptr + xSrc/8, (widthSrc+7)/8);
break; break;
case 4: case 4:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
if(xSrc & 1) if(xSrc & 1)
FIXME("This won't work...\n"); FIXME("This won't work...\n");
for(line = 0; line < heightSrc; line++, ptr += widthbytes) for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteBytes(dc, ptr + xSrc/2, (widthSrc+1)/2); PSDRV_WriteBytes(physDev, ptr + xSrc/2, (widthSrc+1)/2);
break; break;
case 8: case 8:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes) for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteBytes(dc, ptr + xSrc, widthSrc); PSDRV_WriteBytes(physDev, ptr + xSrc, widthSrc);
break; break;
case 15: case 15:
case 16: case 16:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes) for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteDIBits16(dc, (WORD *)ptr + xSrc, widthSrc); PSDRV_WriteDIBits16(physDev, (WORD *)ptr + xSrc, widthSrc);
break; break;
case 24: case 24:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes) for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteDIBits24(dc, ptr + xSrc * 3, widthSrc); PSDRV_WriteDIBits24(physDev, ptr + xSrc * 3, widthSrc);
break; break;
case 32: case 32:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst, PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc); widthSrc, heightSrc);
ptr = bits; ptr = bits;
ptr += (ySrc * widthbytes); ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes) for(line = 0; line < heightSrc; line++, ptr += widthbytes)
PSDRV_WriteDIBits32(dc, ptr + xSrc * 3, widthSrc); PSDRV_WriteDIBits32(physDev, ptr + xSrc * 3, widthSrc);
break; break;
default: default:
...@@ -217,8 +269,8 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, ...@@ -217,8 +269,8 @@ INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst,
return FALSE; return FALSE;
} }
PSDRV_WriteSpool(dc, ">\n", 2); /* End-of-Data for /HexASCIIDecodeFilter */ PSDRV_WriteSpool(physDev, ">\n", 2); /* End-of-Data for /HexASCIIDecodeFilter */
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
return TRUE; return TRUE;
} }
......
...@@ -25,18 +25,15 @@ ...@@ -25,18 +25,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/*********************************************************************** /***********************************************************************
* PSDRV_BRUSH_SelectObject * PSDRV_SelectBrush (WINEPS.@)
*/ */
HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush ) HBRUSH PSDRV_SelectBrush( PSDRV_PDEVICE *physDev, HBRUSH hbrush )
{ {
LOGBRUSH logbrush; LOGBRUSH logbrush;
HBRUSH prevbrush = dc->hBrush;
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0; if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0;
TRACE("hbrush = %08x\n", hbrush); TRACE("hbrush = %08x\n", hbrush);
dc->hBrush = hbrush;
switch(logbrush.lbStyle) { switch(logbrush.lbStyle) {
...@@ -61,7 +58,7 @@ HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush ) ...@@ -61,7 +58,7 @@ HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
} }
physDev->brush.set = FALSE; physDev->brush.set = FALSE;
return prevbrush; return hbrush;
} }
...@@ -70,13 +67,12 @@ HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush ) ...@@ -70,13 +67,12 @@ HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
* PSDRV_SetBrush * PSDRV_SetBrush
* *
*/ */
static BOOL PSDRV_SetBrush(DC *dc) static BOOL PSDRV_SetBrush(PSDRV_PDEVICE *physDev)
{ {
LOGBRUSH logbrush; LOGBRUSH logbrush;
BOOL ret = TRUE; BOOL ret = TRUE;
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (!GetObjectA( dc->hBrush, sizeof(logbrush), &logbrush )) if (!GetObjectA( GetCurrentObject(physDev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush ))
{ {
ERR("Can't get BRUSHOBJ\n"); ERR("Can't get BRUSHOBJ\n");
return FALSE; return FALSE;
...@@ -85,7 +81,7 @@ static BOOL PSDRV_SetBrush(DC *dc) ...@@ -85,7 +81,7 @@ static BOOL PSDRV_SetBrush(DC *dc)
switch (logbrush.lbStyle) { switch (logbrush.lbStyle) {
case BS_SOLID: case BS_SOLID:
case BS_HATCHED: case BS_HATCHED:
PSDRV_WriteSetColor(dc, &physDev->brush.color); PSDRV_WriteSetColor(physDev, &physDev->brush.color);
break; break;
case BS_NULL: case BS_NULL:
...@@ -106,12 +102,12 @@ static BOOL PSDRV_SetBrush(DC *dc) ...@@ -106,12 +102,12 @@ static BOOL PSDRV_SetBrush(DC *dc)
* PSDRV_Fill * PSDRV_Fill
* *
*/ */
static BOOL PSDRV_Fill(DC *dc, BOOL EO) static BOOL PSDRV_Fill(PSDRV_PDEVICE *physDev, BOOL EO)
{ {
if(!EO) if(!EO)
return PSDRV_WriteFill(dc); return PSDRV_WriteFill(physDev);
else else
return PSDRV_WriteEOFill(dc); return PSDRV_WriteEOFill(physDev);
} }
...@@ -120,12 +116,12 @@ static BOOL PSDRV_Fill(DC *dc, BOOL EO) ...@@ -120,12 +116,12 @@ static BOOL PSDRV_Fill(DC *dc, BOOL EO)
* PSDRV_Clip * PSDRV_Clip
* *
*/ */
static BOOL PSDRV_Clip(DC *dc, BOOL EO) static BOOL PSDRV_Clip(PSDRV_PDEVICE *physDev, BOOL EO)
{ {
if(!EO) if(!EO)
return PSDRV_WriteClip(dc); return PSDRV_WriteClip(physDev);
else else
return PSDRV_WriteEOClip(dc); return PSDRV_WriteEOClip(physDev);
} }
/********************************************************************** /**********************************************************************
...@@ -133,13 +129,12 @@ static BOOL PSDRV_Clip(DC *dc, BOOL EO) ...@@ -133,13 +129,12 @@ static BOOL PSDRV_Clip(DC *dc, BOOL EO)
* PSDRV_Brush * PSDRV_Brush
* *
*/ */
BOOL PSDRV_Brush(DC *dc, BOOL EO) BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO)
{ {
LOGBRUSH logbrush; LOGBRUSH logbrush;
BOOL ret = TRUE; BOOL ret = TRUE;
PSDRV_PDEVICE *physDev = dc->physDev;
if (!GetObjectA( dc->hBrush, sizeof(logbrush), &logbrush )) if (!GetObjectA( GetCurrentObject(physDev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush ))
{ {
ERR("Can't get BRUSHOBJ\n"); ERR("Can't get BRUSHOBJ\n");
return FALSE; return FALSE;
...@@ -147,55 +142,55 @@ BOOL PSDRV_Brush(DC *dc, BOOL EO) ...@@ -147,55 +142,55 @@ BOOL PSDRV_Brush(DC *dc, BOOL EO)
switch (logbrush.lbStyle) { switch (logbrush.lbStyle) {
case BS_SOLID: case BS_SOLID:
PSDRV_SetBrush(dc); PSDRV_SetBrush(physDev);
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_Fill(dc, EO); PSDRV_Fill(physDev, EO);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
break; break;
case BS_HATCHED: case BS_HATCHED:
PSDRV_SetBrush(dc); PSDRV_SetBrush(physDev);
switch(logbrush.lbHatch) { switch(logbrush.lbHatch) {
case HS_VERTICAL: case HS_VERTICAL:
case HS_CROSS: case HS_CROSS:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_Clip(dc, EO); PSDRV_Clip(physDev, EO);
PSDRV_WriteHatch(dc); PSDRV_WriteHatch(physDev);
PSDRV_WriteStroke(dc); PSDRV_WriteStroke(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
if(logbrush.lbHatch == HS_VERTICAL) if(logbrush.lbHatch == HS_VERTICAL)
break; break;
/* else fallthrough for HS_CROSS */ /* else fallthrough for HS_CROSS */
case HS_HORIZONTAL: case HS_HORIZONTAL:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_Clip(dc, EO); PSDRV_Clip(physDev, EO);
PSDRV_WriteRotate(dc, 90.0); PSDRV_WriteRotate(physDev, 90.0);
PSDRV_WriteHatch(dc); PSDRV_WriteHatch(physDev);
PSDRV_WriteStroke(dc); PSDRV_WriteStroke(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
break; break;
case HS_FDIAGONAL: case HS_FDIAGONAL:
case HS_DIAGCROSS: case HS_DIAGCROSS:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_Clip(dc, EO); PSDRV_Clip(physDev, EO);
PSDRV_WriteRotate(dc, -45.0); PSDRV_WriteRotate(physDev, -45.0);
PSDRV_WriteHatch(dc); PSDRV_WriteHatch(physDev);
PSDRV_WriteStroke(dc); PSDRV_WriteStroke(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
if(logbrush.lbHatch == HS_FDIAGONAL) if(logbrush.lbHatch == HS_FDIAGONAL)
break; break;
/* else fallthrough for HS_DIAGCROSS */ /* else fallthrough for HS_DIAGCROSS */
case HS_BDIAGONAL: case HS_BDIAGONAL:
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_Clip(dc, EO); PSDRV_Clip(physDev, EO);
PSDRV_WriteRotate(dc, 45.0); PSDRV_WriteRotate(physDev, 45.0);
PSDRV_WriteHatch(dc); PSDRV_WriteHatch(physDev);
PSDRV_WriteStroke(dc); PSDRV_WriteStroke(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
break; break;
default: default:
...@@ -219,10 +214,10 @@ BOOL PSDRV_Brush(DC *dc, BOOL EO) ...@@ -219,10 +214,10 @@ BOOL PSDRV_Brush(DC *dc, BOOL EO)
GetBitmapBits(logbrush.lbHatch, bm.bmWidthBytes * bm.bmHeight, bits); GetBitmapBits(logbrush.lbHatch, bm.bmWidthBytes * bm.bmHeight, bits);
if(physDev->pi->ppd->LanguageLevel > 1) { if(physDev->pi->ppd->LanguageLevel > 1) {
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WritePatternDict(dc, &bm, bits); PSDRV_WritePatternDict(physDev, &bm, bits);
PSDRV_Fill(dc, EO); PSDRV_Fill(physDev, EO);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
} else { } else {
FIXME("Trying to set a pattern brush on a level 1 printer\n"); FIXME("Trying to set a pattern brush on a level 1 printer\n");
ret = FALSE; ret = FALSE;
......
...@@ -28,13 +28,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); ...@@ -28,13 +28,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/*********************************************************************** /***********************************************************************
* PSDRV_SetDeviceClipping * PSDRV_SetDeviceClipping
*/ */
VOID PSDRV_SetDeviceClipping( DC *dc ) VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev )
{ {
CHAR szArrayName[] = "clippath"; CHAR szArrayName[] = "clippath";
DWORD size; DWORD size;
RGNDATA *rgndata; RGNDATA *rgndata;
DC *dc = physDev->dc;
TRACE("hdc=%04x\n", dc->hSelf); TRACE("hdc=%04x\n", physDev->hdc);
if (dc->hGCClipRgn == 0) { if (dc->hGCClipRgn == 0) {
ERR("Rgn is 0. Please report this.\n"); ERR("Rgn is 0. Please report this.\n");
...@@ -55,20 +56,20 @@ VOID PSDRV_SetDeviceClipping( DC *dc ) ...@@ -55,20 +56,20 @@ VOID PSDRV_SetDeviceClipping( DC *dc )
GetRegionData(dc->hGCClipRgn, size, rgndata); GetRegionData(dc->hGCClipRgn, size, rgndata);
PSDRV_WriteInitClip(dc); PSDRV_WriteInitClip(physDev);
/* check for NULL region */ /* check for NULL region */
if (rgndata->rdh.nCount == 0) if (rgndata->rdh.nCount == 0)
{ {
/* set an empty clip path. */ /* set an empty clip path. */
PSDRV_WriteRectClip(dc, 0, 0, 0, 0); PSDRV_WriteRectClip(physDev, 0, 0, 0, 0);
} }
/* optimize when it is a simple region */ /* optimize when it is a simple region */
else if (rgndata->rdh.nCount == 1) else if (rgndata->rdh.nCount == 1)
{ {
RECT *pRect = (RECT *)rgndata->Buffer; RECT *pRect = (RECT *)rgndata->Buffer;
PSDRV_WriteRectClip(dc, pRect->left, pRect->top, PSDRV_WriteRectClip(physDev, pRect->left, pRect->top,
pRect->right - pRect->left, pRect->right - pRect->left,
pRect->bottom - pRect->top); pRect->bottom - pRect->top);
} }
...@@ -77,21 +78,21 @@ VOID PSDRV_SetDeviceClipping( DC *dc ) ...@@ -77,21 +78,21 @@ VOID PSDRV_SetDeviceClipping( DC *dc )
INT i; INT i;
RECT *pRect = (RECT *)rgndata->Buffer; RECT *pRect = (RECT *)rgndata->Buffer;
PSDRV_WriteArrayDef(dc, szArrayName, rgndata->rdh.nCount * 4); PSDRV_WriteArrayDef(physDev, szArrayName, rgndata->rdh.nCount * 4);
for (i = 0; i < rgndata->rdh.nCount; i++, pRect++) for (i = 0; i < rgndata->rdh.nCount; i++, pRect++)
{ {
PSDRV_WriteArrayPut(dc, szArrayName, i * 4, PSDRV_WriteArrayPut(physDev, szArrayName, i * 4,
pRect->left); pRect->left);
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 1, PSDRV_WriteArrayPut(physDev, szArrayName, i * 4 + 1,
pRect->top); pRect->top);
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 2, PSDRV_WriteArrayPut(physDev, szArrayName, i * 4 + 2,
pRect->right - pRect->left); pRect->right - pRect->left);
PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 3, PSDRV_WriteArrayPut(physDev, szArrayName, i * 4 + 3,
pRect->bottom - pRect->top); pRect->bottom - pRect->top);
} }
PSDRV_WriteRectClip2(dc, szArrayName); PSDRV_WriteRectClip2(physDev, szArrayName);
} }
HeapFree( GetProcessHeap(), 0, rgndata ); HeapFree( GetProcessHeap(), 0, rgndata );
......
...@@ -117,33 +117,20 @@ void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor, ...@@ -117,33 +117,20 @@ void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
/*********************************************************************** /***********************************************************************
* PSDRV_SetBkColor * PSDRV_SetBkColor
*/ */
COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color ) COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
COLORREF oldColor;
oldColor = dc->backgroundColor;
dc->backgroundColor = color;
PSDRV_CreateColor(physDev, &physDev->bkColor, color); PSDRV_CreateColor(physDev, &physDev->bkColor, color);
return color;
return oldColor;
} }
/*********************************************************************** /***********************************************************************
* PSDRV_SetTextColor * PSDRV_SetTextColor
*/ */
COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color ) COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
COLORREF oldColor;
oldColor = dc->textColor;
dc->textColor = color;
PSDRV_CreateColor(physDev, &physDev->font.color, color); PSDRV_CreateColor(physDev, &physDev->font.color, color);
physDev->font.set = FALSE; physDev->font.set = FALSE;
return oldColor; return color;
} }
...@@ -30,11 +30,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv); ...@@ -30,11 +30,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/********************************************************************** /**********************************************************************
* ExtEscape (WINEPS.@) * ExtEscape (WINEPS.@)
*/ */
INT PSDRV_ExtEscape( DC *dc, INT nEscape, INT cbInput, LPCVOID in_data, INT PSDRV_ExtEscape( PSDRV_PDEVICE *physDev, INT nEscape, INT cbInput, LPCVOID in_data,
INT cbOutput, LPVOID out_data ) INT cbOutput, LPVOID out_data )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
switch(nEscape) switch(nEscape)
{ {
case QUERYESCSUPPORT: case QUERYESCSUPPORT:
...@@ -84,7 +82,7 @@ INT PSDRV_ExtEscape( DC *dc, INT nEscape, INT cbInput, LPCVOID in_data, ...@@ -84,7 +82,7 @@ INT PSDRV_ExtEscape( DC *dc, INT nEscape, INT cbInput, LPCVOID in_data,
r->bottom = 0; r->bottom = 0;
TRACE("NEXTBAND rect to 0,0 - 0,0\n" ); TRACE("NEXTBAND rect to 0,0 - 0,0\n" );
physDev->job.banding = FALSE; physDev->job.banding = FALSE;
return EndPage( dc->hSelf ); return EndPage( physDev->hdc );
} }
case SETCOPYCOUNT: case SETCOPYCOUNT:
...@@ -223,16 +221,14 @@ INT PSDRV_ExtEscape( DC *dc, INT nEscape, INT cbInput, LPCVOID in_data, ...@@ -223,16 +221,14 @@ INT PSDRV_ExtEscape( DC *dc, INT nEscape, INT cbInput, LPCVOID in_data,
/************************************************************************ /************************************************************************
* PSDRV_StartPage * PSDRV_StartPage
*/ */
INT PSDRV_StartPage( DC *dc ) INT PSDRV_StartPage( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if(!physDev->job.OutOfPage) { if(!physDev->job.OutOfPage) {
FIXME("Already started a page?\n"); FIXME("Already started a page?\n");
return 1; return 1;
} }
physDev->job.PageNo++; physDev->job.PageNo++;
if(!PSDRV_WriteNewPage( dc )) if(!PSDRV_WriteNewPage( physDev ))
return 0; return 0;
physDev->job.OutOfPage = FALSE; physDev->job.OutOfPage = FALSE;
return 1; return 1;
...@@ -242,15 +238,13 @@ INT PSDRV_StartPage( DC *dc ) ...@@ -242,15 +238,13 @@ INT PSDRV_StartPage( DC *dc )
/************************************************************************ /************************************************************************
* PSDRV_EndPage * PSDRV_EndPage
*/ */
INT PSDRV_EndPage( DC *dc ) INT PSDRV_EndPage( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if(physDev->job.OutOfPage) { if(physDev->job.OutOfPage) {
FIXME("Already ended a page?\n"); FIXME("Already ended a page?\n");
return 1; return 1;
} }
if(!PSDRV_WriteEndPage( dc )) if(!PSDRV_WriteEndPage( physDev ))
return 0; return 0;
physDev->job.OutOfPage = TRUE; physDev->job.OutOfPage = TRUE;
return 1; return 1;
...@@ -260,10 +254,8 @@ INT PSDRV_EndPage( DC *dc ) ...@@ -260,10 +254,8 @@ INT PSDRV_EndPage( DC *dc )
/************************************************************************ /************************************************************************
* PSDRV_StartDoc * PSDRV_StartDoc
*/ */
INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc ) INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if(physDev->job.hJob) { if(physDev->job.hJob) {
FIXME("hJob != 0. Now what?\n"); FIXME("hJob != 0. Now what?\n");
return 0; return 0;
...@@ -274,8 +266,7 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc ) ...@@ -274,8 +266,7 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc )
physDev->job.output = HeapAlloc( PSDRV_Heap, 0, strlen(doc->lpszOutput)+1 ); physDev->job.output = HeapAlloc( PSDRV_Heap, 0, strlen(doc->lpszOutput)+1 );
strcpy( physDev->job.output, doc->lpszOutput ); strcpy( physDev->job.output, doc->lpszOutput );
} }
physDev->job.hJob = OpenJob16(physDev->job.output, doc->lpszDocName, physDev->job.hJob = OpenJob16(physDev->job.output, doc->lpszDocName, physDev->hdc );
dc->hSelf);
if(!physDev->job.hJob) { if(!physDev->job.hJob) {
WARN("OpenJob failed\n"); WARN("OpenJob failed\n");
return 0; return 0;
...@@ -283,7 +274,7 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc ) ...@@ -283,7 +274,7 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc )
physDev->job.banding = FALSE; physDev->job.banding = FALSE;
physDev->job.OutOfPage = TRUE; physDev->job.OutOfPage = TRUE;
physDev->job.PageNo = 0; physDev->job.PageNo = 0;
if(!PSDRV_WriteHeader( dc, doc->lpszDocName )) if(!PSDRV_WriteHeader( physDev, doc->lpszDocName ))
return 0; return 0;
return physDev->job.hJob; return physDev->job.hJob;
...@@ -293,10 +284,8 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc ) ...@@ -293,10 +284,8 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc )
/************************************************************************ /************************************************************************
* PSDRV_EndDoc * PSDRV_EndDoc
*/ */
INT PSDRV_EndDoc( DC *dc ) INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if(!physDev->job.hJob) { if(!physDev->job.hJob) {
FIXME("hJob == 0. Now what?\n"); FIXME("hJob == 0. Now what?\n");
return 0; return 0;
...@@ -304,9 +293,9 @@ INT PSDRV_EndDoc( DC *dc ) ...@@ -304,9 +293,9 @@ INT PSDRV_EndDoc( DC *dc )
if(!physDev->job.OutOfPage) { if(!physDev->job.OutOfPage) {
WARN("Somebody forgot a EndPage\n"); WARN("Somebody forgot a EndPage\n");
PSDRV_EndPage( dc ); PSDRV_EndPage( physDev );
} }
if(!PSDRV_WriteFooter( dc )) if(!PSDRV_WriteFooter( physDev ))
return 0; return 0;
if( CloseJob16( physDev->job.hJob ) == SP_ERROR ) { if( CloseJob16( physDev->job.hJob ) == SP_ERROR ) {
......
...@@ -138,12 +138,11 @@ static VOID ScaleFont(const AFM *afm, LONG lfHeight, PSFONT *font, ...@@ -138,12 +138,11 @@ static VOID ScaleFont(const AFM *afm, LONG lfHeight, PSFONT *font,
} }
/*********************************************************************** /***********************************************************************
* PSDRV_FONT_SelectObject * PSDRV_SelectFont (WINEPS.@)
*/ */
HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont ) HFONT PSDRV_SelectFont( PSDRV_PDEVICE *physDev, HFONT hfont )
{ {
LOGFONTW lf; LOGFONTW lf;
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
BOOL bd = FALSE, it = FALSE; BOOL bd = FALSE, it = FALSE;
AFMLISTENTRY *afmle; AFMLISTENTRY *afmle;
FONTFAMILY *family; FONTFAMILY *family;
...@@ -257,7 +256,7 @@ HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont ) ...@@ -257,7 +256,7 @@ HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont )
physDev->font.afm = afmle->afm; physDev->font.afm = afmle->afm;
/* stock fonts ignore the mapping mode */ /* stock fonts ignore the mapping mode */
if (!is_stock_font( hfont )) lf.lfHeight = INTERNAL_YWSTODS(dc, lf.lfHeight); if (!is_stock_font( hfont )) lf.lfHeight = INTERNAL_YWSTODS(physDev->dc, lf.lfHeight);
ScaleFont(physDev->font.afm, lf.lfHeight, ScaleFont(physDev->font.afm, lf.lfHeight,
&(physDev->font), &(physDev->font.tm)); &(physDev->font), &(physDev->font.tm));
...@@ -274,10 +273,8 @@ HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont ) ...@@ -274,10 +273,8 @@ HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont )
/*********************************************************************** /***********************************************************************
* PSDRV_GetTextMetrics * PSDRV_GetTextMetrics
*/ */
BOOL PSDRV_GetTextMetrics(DC *dc, TEXTMETRICW *metrics) BOOL PSDRV_GetTextMetrics(PSDRV_PDEVICE *physDev, TEXTMETRICW *metrics)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
memcpy(metrics, &(physDev->font.tm), sizeof(physDev->font.tm)); memcpy(metrics, &(physDev->font.tm), sizeof(physDev->font.tm));
return TRUE; return TRUE;
} }
...@@ -324,9 +321,9 @@ const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm) ...@@ -324,9 +321,9 @@ const AFMMETRICS *PSDRV_UVMetrics(LONG UV, const AFM *afm)
/*********************************************************************** /***********************************************************************
* PSDRV_GetTextExtentPoint * PSDRV_GetTextExtentPoint
*/ */
BOOL PSDRV_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count, LPSIZE size) BOOL PSDRV_GetTextExtentPoint(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count, LPSIZE size)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
int i; int i;
float width = 0.0; float width = 0.0;
...@@ -349,9 +346,8 @@ BOOL PSDRV_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count, LPSIZE size) ...@@ -349,9 +346,8 @@ BOOL PSDRV_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count, LPSIZE size)
/*********************************************************************** /***********************************************************************
* PSDRV_GetCharWidth * PSDRV_GetCharWidth
*/ */
BOOL PSDRV_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar, LPINT buffer) BOOL PSDRV_GetCharWidth(PSDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar, LPINT buffer)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
UINT i; UINT i;
TRACE("U+%.4X U+%.4X\n", firstChar, lastChar); TRACE("U+%.4X U+%.4X\n", firstChar, lastChar);
...@@ -376,14 +372,12 @@ BOOL PSDRV_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar, LPINT buffer) ...@@ -376,14 +372,12 @@ BOOL PSDRV_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar, LPINT buffer)
/*********************************************************************** /***********************************************************************
* PSDRV_SetFont * PSDRV_SetFont
*/ */
BOOL PSDRV_SetFont( DC *dc ) BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev; PSDRV_WriteSetColor(physDev, &physDev->font.color);
PSDRV_WriteSetColor(dc, &physDev->font.color);
if(physDev->font.set) return TRUE; if(physDev->font.set) return TRUE;
PSDRV_WriteSetFont(dc); PSDRV_WriteSetFont(physDev);
physDev->font.set = TRUE; physDev->font.set = TRUE;
return TRUE; return TRUE;
} }
......
...@@ -171,7 +171,9 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -171,7 +171,9 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
physDev = (PSDRV_PDEVICE *)HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, physDev = (PSDRV_PDEVICE *)HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY,
sizeof(*physDev) ); sizeof(*physDev) );
if (!physDev) return FALSE; if (!physDev) return FALSE;
dc->physDev = physDev; dc->physDev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
physDev->pi = pi; physDev->pi = pi;
...@@ -251,16 +253,14 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, ...@@ -251,16 +253,14 @@ BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
/********************************************************************** /**********************************************************************
* PSDRV_DeleteDC * PSDRV_DeleteDC
*/ */
BOOL PSDRV_DeleteDC( DC *dc ) BOOL PSDRV_DeleteDC( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
TRACE("\n"); TRACE("\n");
HeapFree( PSDRV_Heap, 0, physDev->Devmode ); HeapFree( PSDRV_Heap, 0, physDev->Devmode );
HeapFree( PSDRV_Heap, 0, physDev->job.output ); HeapFree( PSDRV_Heap, 0, physDev->job.output );
physDev->dc->physDev = NULL;
HeapFree( PSDRV_Heap, 0, physDev ); HeapFree( PSDRV_Heap, 0, physDev );
dc->physDev = NULL;
return TRUE; return TRUE;
} }
...@@ -342,9 +342,8 @@ static void get_phys_page_size( const PSDRV_PDEVICE *pdev, POINT *p ) ...@@ -342,9 +342,8 @@ static void get_phys_page_size( const PSDRV_PDEVICE *pdev, POINT *p )
/*********************************************************************** /***********************************************************************
* GetDeviceCaps (WINEPS.@) * GetDeviceCaps (WINEPS.@)
*/ */
INT PSDRV_GetDeviceCaps( DC *dc, INT cap ) INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap )
{ {
PSDRV_PDEVICE *physDev = dc->physDev;
POINT pt; POINT pt;
switch(cap) switch(cap)
...@@ -427,7 +426,7 @@ INT PSDRV_GetDeviceCaps( DC *dc, INT cap ) ...@@ -427,7 +426,7 @@ INT PSDRV_GetDeviceCaps( DC *dc, INT cap )
case BTLALIGNMENT: case BTLALIGNMENT:
return 0; return 0;
default: default:
FIXME("(%04x): unsupported capability %d, will return 0\n", dc->hSelf, cap ); FIXME("(%04x): unsupported capability %d, will return 0\n", physDev->hdc, cap );
return 0; return 0;
} }
} }
......
...@@ -24,46 +24,10 @@ ...@@ -24,46 +24,10 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/*********************************************************************** /***********************************************************************
* PSDRV_BITMAP_SelectObject * PSDRV_SelectBitmap (WINEPS.@)
*/ */
static HBITMAP PSDRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap ) HBITMAP PSDRV_SelectBitmap( PSDRV_PDEVICE *physDev, HBITMAP hbitmap )
{ {
FIXME("stub\n"); FIXME("stub\n");
return 0; return 0;
} }
/***********************************************************************
* PSDRV_SelectObject
*/
HGDIOBJ PSDRV_SelectObject( DC *dc, HGDIOBJ handle )
{
HGDIOBJ ret = 0;
TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
switch(GetObjectType( handle ))
{
case OBJ_PEN:
ret = PSDRV_PEN_SelectObject( dc, handle );
break;
case OBJ_BRUSH:
ret = PSDRV_BRUSH_SelectObject( dc, handle );
break;
case OBJ_BITMAP:
ret = PSDRV_BITMAP_SelectObject( dc, handle );
break;
case OBJ_FONT:
ret = PSDRV_FONT_SelectObject( dc, handle );
break;
case OBJ_REGION:
ret = (HGDIOBJ)SelectClipRgn( dc->hSelf, handle );
break;
case 0: /* invalid handle */
break;
default:
ERR("Unknown object type %ld\n", GetObjectType(handle) );
break;
}
return ret;
}
...@@ -30,21 +30,17 @@ static char PEN_dashdotdot[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */ ...@@ -30,21 +30,17 @@ static char PEN_dashdotdot[] = "40 20 20 20 20 20"; /* ---- -- -- ---- */
static char PEN_alternate[] = "1"; static char PEN_alternate[] = "1";
/*********************************************************************** /***********************************************************************
* PSDRV_PEN_SelectObject * PSDRV_SelectPen (WINEPS.@)
*/ */
HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen ) HPEN PSDRV_SelectPen( PSDRV_PDEVICE *physDev, HPEN hpen )
{ {
LOGPEN logpen; LOGPEN logpen;
HPEN prevpen = dc->hPen;
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0; if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0;
TRACE("hpen = %08x colour = %08lx\n", hpen, logpen.lopnColor); TRACE("hpen = %08x colour = %08lx\n", hpen, logpen.lopnColor);
dc->hPen = hpen; physDev->pen.width = INTERNAL_XWSTODS(physDev->dc, logpen.lopnWidth.x);
physDev->pen.width = INTERNAL_XWSTODS(dc, logpen.lopnWidth.x);
if(physDev->pen.width < 0) if(physDev->pen.width < 0)
physDev->pen.width = -physDev->pen.width; physDev->pen.width = -physDev->pen.width;
...@@ -82,7 +78,7 @@ HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen ) ...@@ -82,7 +78,7 @@ HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen )
} }
physDev->pen.set = FALSE; physDev->pen.set = FALSE;
return prevpen; return hpen;
} }
...@@ -91,15 +87,13 @@ HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen ) ...@@ -91,15 +87,13 @@ HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen )
* PSDRV_SetPen * PSDRV_SetPen
* *
*/ */
BOOL PSDRV_SetPen(DC *dc) BOOL PSDRV_SetPen(PSDRV_PDEVICE *physDev)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (physDev->pen.style != PS_NULL) { if (physDev->pen.style != PS_NULL) {
PSDRV_WriteSetColor(dc, &physDev->pen.color); PSDRV_WriteSetColor(physDev, &physDev->pen.color);
if(!physDev->pen.set) { if(!physDev->pen.set) {
PSDRV_WriteSetPen(dc); PSDRV_WriteSetPen(physDev);
physDev->pen.set = TRUE; physDev->pen.set = TRUE;
} }
} }
......
...@@ -24,27 +24,27 @@ ...@@ -24,27 +24,27 @@
WINE_DEFAULT_DEBUG_CHANNEL(psdrv); WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, static BOOL PSDRV_Text(PSDRV_PDEVICE *physDev, INT x, INT y, LPCWSTR str, UINT count,
BOOL bDrawBackground, const INT *lpDx); BOOL bDrawBackground, const INT *lpDx);
/*********************************************************************** /***********************************************************************
* PSDRV_ExtTextOut * PSDRV_ExtTextOut
*/ */
BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count, const RECT *lprect, LPCWSTR str, UINT count,
const INT *lpDx ) const INT *lpDx )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
BOOL bResult = TRUE; BOOL bResult = TRUE;
BOOL bClipped = FALSE; BOOL bClipped = FALSE;
BOOL bOpaque = FALSE; BOOL bOpaque = FALSE;
RECT rect; RECT rect;
DC *dc = physDev->dc;
TRACE("(x=%d, y=%d, flags=0x%08x, str=%s, count=%d, lpDx=%p)\n", x, y, TRACE("(x=%d, y=%d, flags=0x%08x, str=%s, count=%d, lpDx=%p)\n", x, y,
flags, debugstr_wn(str, count), count, lpDx); flags, debugstr_wn(str, count), count, lpDx);
/* write font if not already written */ /* write font if not already written */
PSDRV_SetFont(dc); PSDRV_SetFont(physDev);
/* set clipping and/or draw background */ /* set clipping and/or draw background */
if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL)) if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL))
...@@ -54,31 +54,31 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -54,31 +54,31 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
rect.top = INTERNAL_YWPTODP(dc, lprect->left, lprect->top); rect.top = INTERNAL_YWPTODP(dc, lprect->left, lprect->top);
rect.bottom = INTERNAL_YWPTODP(dc, lprect->right, lprect->bottom); rect.bottom = INTERNAL_YWPTODP(dc, lprect->right, lprect->bottom);
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteRectangle(dc, rect.left, rect.top, rect.right - rect.left, PSDRV_WriteRectangle(physDev, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top); rect.bottom - rect.top);
if (flags & ETO_OPAQUE) if (flags & ETO_OPAQUE)
{ {
bOpaque = TRUE; bOpaque = TRUE;
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteSetColor(dc, &physDev->bkColor); PSDRV_WriteSetColor(physDev, &physDev->bkColor);
PSDRV_WriteFill(dc); PSDRV_WriteFill(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
} }
if (flags & ETO_CLIPPED) if (flags & ETO_CLIPPED)
{ {
bClipped = TRUE; bClipped = TRUE;
PSDRV_WriteClip(dc); PSDRV_WriteClip(physDev);
} }
bResult = PSDRV_Text(dc, x, y, str, count, !(bClipped && bOpaque), lpDx); bResult = PSDRV_Text(physDev, x, y, str, count, !(bClipped && bOpaque), lpDx);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
} }
else else
{ {
bResult = PSDRV_Text(dc, x, y, str, count, TRUE, lpDx); bResult = PSDRV_Text(physDev, x, y, str, count, TRUE, lpDx);
} }
return bResult; return bResult;
...@@ -87,12 +87,13 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -87,12 +87,13 @@ BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
/*********************************************************************** /***********************************************************************
* PSDRV_Text * PSDRV_Text
*/ */
static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, static BOOL PSDRV_Text(PSDRV_PDEVICE *physDev, INT x, INT y, LPCWSTR str, UINT count,
BOOL bDrawBackground, const INT *lpDx) BOOL bDrawBackground, const INT *lpDx)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
LPWSTR strbuf; LPWSTR strbuf;
SIZE sz; SIZE sz;
DC *dc = physDev->dc;
UINT align = GetTextAlign( physDev->hdc );
if (!count) if (!count)
return TRUE; return TRUE;
...@@ -103,7 +104,7 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -103,7 +104,7 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
return FALSE; return FALSE;
} }
if(dc->textAlign & TA_UPDATECP) { if(align & TA_UPDATECP) {
x = dc->CursPosX; x = dc->CursPosX;
y = dc->CursPosY; y = dc->CursPosY;
} }
...@@ -111,12 +112,12 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -111,12 +112,12 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
x = INTERNAL_XWPTODP(dc, x, y); x = INTERNAL_XWPTODP(dc, x, y);
y = INTERNAL_YWPTODP(dc, x, y); y = INTERNAL_YWPTODP(dc, x, y);
GetTextExtentPoint32W(dc->hSelf, str, count, &sz); GetTextExtentPoint32W(physDev->hdc, str, count, &sz);
if(lpDx) { if(lpDx) {
SIZE tmpsz; SIZE tmpsz;
INT i; INT i;
/* Get the width of the last char and add on all the offsets */ /* Get the width of the last char and add on all the offsets */
GetTextExtentPoint32W(dc->hSelf, str + count - 1, 1, &tmpsz); GetTextExtentPoint32W(physDev->hdc, str + count - 1, 1, &tmpsz);
for(i = 0; i < count-1; i++) for(i = 0; i < count-1; i++)
tmpsz.cx += lpDx[i]; tmpsz.cx += lpDx[i];
sz.cx = tmpsz.cx; /* sz.cy remains untouched */ sz.cx = tmpsz.cx; /* sz.cy remains untouched */
...@@ -124,10 +125,10 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -124,10 +125,10 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
sz.cx = INTERNAL_XWSTODS(dc, sz.cx); sz.cx = INTERNAL_XWSTODS(dc, sz.cx);
sz.cy = INTERNAL_YWSTODS(dc, sz.cy); sz.cy = INTERNAL_YWSTODS(dc, sz.cy);
TRACE("textAlign = %x\n", dc->textAlign); TRACE("textAlign = %x\n", align);
switch(dc->textAlign & (TA_LEFT | TA_CENTER | TA_RIGHT) ) { switch(align & (TA_LEFT | TA_CENTER | TA_RIGHT) ) {
case TA_LEFT: case TA_LEFT:
if(dc->textAlign & TA_UPDATECP) { if(align & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP(dc, x + sz.cx, y); dc->CursPosX = INTERNAL_XDPTOWP(dc, x + sz.cx, y);
} }
break; break;
...@@ -138,13 +139,13 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -138,13 +139,13 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
case TA_RIGHT: case TA_RIGHT:
x -= sz.cx; x -= sz.cx;
if(dc->textAlign & TA_UPDATECP) { if(align & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP(dc, x, y); dc->CursPosX = INTERNAL_XDPTOWP(dc, x, y);
} }
break; break;
} }
switch(dc->textAlign & (TA_TOP | TA_BASELINE | TA_BOTTOM) ) { switch(align & (TA_TOP | TA_BASELINE | TA_BOTTOM) ) {
case TA_TOP: case TA_TOP:
y += physDev->font.tm.tmAscent; y += physDev->font.tm.tmAscent;
break; break;
...@@ -160,22 +161,22 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -160,22 +161,22 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
memcpy(strbuf, str, count * sizeof(WCHAR)); memcpy(strbuf, str, count * sizeof(WCHAR));
*(strbuf + count) = '\0'; *(strbuf + count) = '\0';
if ((dc->backgroundMode != TRANSPARENT) && (bDrawBackground != FALSE)) if ((GetBkMode( physDev->hdc ) != TRANSPARENT) && bDrawBackground)
{ {
PSDRV_WriteGSave(dc); PSDRV_WriteGSave(physDev);
PSDRV_WriteNewPath(dc); PSDRV_WriteNewPath(physDev);
PSDRV_WriteRectangle(dc, x, y - physDev->font.tm.tmAscent, sz.cx, PSDRV_WriteRectangle(physDev, x, y - physDev->font.tm.tmAscent, sz.cx,
physDev->font.tm.tmAscent + physDev->font.tm.tmAscent +
physDev->font.tm.tmDescent); physDev->font.tm.tmDescent);
PSDRV_WriteSetColor(dc, &physDev->bkColor); PSDRV_WriteSetColor(physDev, &physDev->bkColor);
PSDRV_WriteFill(dc); PSDRV_WriteFill(physDev);
PSDRV_WriteGRestore(dc); PSDRV_WriteGRestore(physDev);
} }
PSDRV_WriteMoveTo(dc, x, y); PSDRV_WriteMoveTo(physDev, x, y);
if(!lpDx) if(!lpDx)
PSDRV_WriteGlyphShow(dc, strbuf, lstrlenW(strbuf)); PSDRV_WriteGlyphShow(physDev, strbuf, lstrlenW(strbuf));
else { else {
INT i; INT i;
float dx = 0.0, dy = 0.0; float dx = 0.0, dy = 0.0;
...@@ -183,13 +184,13 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -183,13 +184,13 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
float sin_theta = sin(physDev->font.escapement * M_PI / 1800.0); float sin_theta = sin(physDev->font.escapement * M_PI / 1800.0);
for(i = 0; i < count-1; i++) { for(i = 0; i < count-1; i++) {
TRACE("lpDx[%d] = %d\n", i, lpDx[i]); TRACE("lpDx[%d] = %d\n", i, lpDx[i]);
PSDRV_WriteGlyphShow(dc, &strbuf[i], 1); PSDRV_WriteGlyphShow(physDev, &strbuf[i], 1);
dx += lpDx[i] * cos_theta; dx += lpDx[i] * cos_theta;
dy -= lpDx[i] * sin_theta; dy -= lpDx[i] * sin_theta;
PSDRV_WriteMoveTo(dc, x + INTERNAL_XWSTODS(dc, dx), PSDRV_WriteMoveTo(physDev, x + INTERNAL_XWSTODS(dc, dx),
y + INTERNAL_YWSTODS(dc, dy)); y + INTERNAL_YWSTODS(dc, dy));
} }
PSDRV_WriteGlyphShow(dc, &strbuf[i], 1); PSDRV_WriteGlyphShow(physDev, &strbuf[i], 1);
} }
/* /*
...@@ -210,56 +211,56 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count, ...@@ -210,56 +211,56 @@ static BOOL PSDRV_Text(DC *dc, INT x, INT y, LPCWSTR str, UINT count,
/* Get the width of the text */ /* Get the width of the text */
PSDRV_GetTextExtentPoint(dc, strbuf, lstrlenW(strbuf), &size); PSDRV_GetTextExtentPoint(physDev, strbuf, lstrlenW(strbuf), &size);
size.cx = INTERNAL_XWSTODS(dc, size.cx); size.cx = INTERNAL_XWSTODS(dc, size.cx);
/* Do the underline */ /* Do the underline */
if (physDev->font.tm.tmUnderlined) { if (physDev->font.tm.tmUnderlined) {
PSDRV_WriteNewPath(dc); /* will be closed by WriteRectangle */ PSDRV_WriteNewPath(physDev); /* will be closed by WriteRectangle */
if (escapement != 0) /* rotated text */ if (escapement != 0) /* rotated text */
{ {
PSDRV_WriteGSave(dc); /* save the graphics state */ PSDRV_WriteGSave(physDev); /* save the graphics state */
PSDRV_WriteMoveTo(dc, x, y); /* move to the start */ PSDRV_WriteMoveTo(physDev, x, y); /* move to the start */
/* temporarily rotate the coord system */ /* temporarily rotate the coord system */
PSDRV_WriteRotate(dc, -escapement/10); PSDRV_WriteRotate(physDev, -escapement/10);
/* draw the underline relative to the starting point */ /* draw the underline relative to the starting point */
PSDRV_WriteRRectangle(dc, 0, (INT)pos, size.cx, (INT)thick); PSDRV_WriteRRectangle(physDev, 0, (INT)pos, size.cx, (INT)thick);
} }
else else
PSDRV_WriteRectangle(dc, x, y + (INT)pos, size.cx, (INT)thick); PSDRV_WriteRectangle(physDev, x, y + (INT)pos, size.cx, (INT)thick);
PSDRV_WriteFill(dc); PSDRV_WriteFill(physDev);
if (escapement != 0) /* rotated text */ if (escapement != 0) /* rotated text */
PSDRV_WriteGRestore(dc); /* restore the graphics state */ PSDRV_WriteGRestore(physDev); /* restore the graphics state */
} }
/* Do the strikeout */ /* Do the strikeout */
if (physDev->font.tm.tmStruckOut) { if (physDev->font.tm.tmStruckOut) {
pos = -physDev->font.tm.tmAscent / 2; pos = -physDev->font.tm.tmAscent / 2;
PSDRV_WriteNewPath(dc); /* will be closed by WriteRectangle */ PSDRV_WriteNewPath(physDev); /* will be closed by WriteRectangle */
if (escapement != 0) /* rotated text */ if (escapement != 0) /* rotated text */
{ {
PSDRV_WriteGSave(dc); /* save the graphics state */ PSDRV_WriteGSave(physDev); /* save the graphics state */
PSDRV_WriteMoveTo(dc, x, y); /* move to the start */ PSDRV_WriteMoveTo(physDev, x, y); /* move to the start */
/* temporarily rotate the coord system */ /* temporarily rotate the coord system */
PSDRV_WriteRotate(dc, -escapement/10); PSDRV_WriteRotate(physDev, -escapement/10);
/* draw the underline relative to the starting point */ /* draw the underline relative to the starting point */
PSDRV_WriteRRectangle(dc, 0, (INT)pos, size.cx, (INT)thick); PSDRV_WriteRRectangle(physDev, 0, (INT)pos, size.cx, (INT)thick);
} }
else else
PSDRV_WriteRectangle(dc, x, y + (INT)pos, size.cx, (INT)thick); PSDRV_WriteRectangle(physDev, x, y + (INT)pos, size.cx, (INT)thick);
PSDRV_WriteFill(dc); PSDRV_WriteFill(physDev);
if (escapement != 0) /* rotated text */ if (escapement != 0) /* rotated text */
PSDRV_WriteGRestore(dc); /* restore the graphics state */ PSDRV_WriteGRestore(physDev); /* restore the graphics state */
} }
} }
......
...@@ -39,7 +39,10 @@ debug_channels (psdrv) ...@@ -39,7 +39,10 @@ debug_channels (psdrv)
@ cdecl Polyline(ptr ptr long) PSDRV_Polyline @ cdecl Polyline(ptr ptr long) PSDRV_Polyline
@ cdecl Rectangle(ptr long long long long) PSDRV_Rectangle @ cdecl Rectangle(ptr long long long long) PSDRV_Rectangle
@ cdecl RoundRect(ptr long long long long long long) PSDRV_RoundRect @ cdecl RoundRect(ptr long long long long long long) PSDRV_RoundRect
@ cdecl SelectObject(ptr long) PSDRV_SelectObject @ cdecl SelectBitmap(ptr long) PSDRV_SelectBitmap
@ cdecl SelectBrush(ptr long) PSDRV_SelectBrush
@ cdecl SelectFont(ptr long) PSDRV_SelectFont
@ cdecl SelectPen(ptr long) PSDRV_SelectPen
@ cdecl SetBkColor(ptr long) PSDRV_SetBkColor @ cdecl SetBkColor(ptr long) PSDRV_SetBkColor
@ cdecl SetDeviceClipping(ptr) PSDRV_SetDeviceClipping @ cdecl SetDeviceClipping(ptr) PSDRV_SetDeviceClipping
@ cdecl SetPixel(ptr long long long) PSDRV_SetPixel @ cdecl SetPixel(ptr long long long) PSDRV_SetPixel
......
...@@ -26,11 +26,13 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics ...@@ -26,11 +26,13 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat @ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat
@ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse @ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse
@ cdecl EnumDeviceFonts(long ptr ptr long) X11DRV_EnumDeviceFonts @ cdecl EnumDeviceFonts(long ptr ptr long) X11DRV_EnumDeviceFonts
@ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill
@ cdecl ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape @ cdecl ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape
@ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill
@ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut
@ cdecl GetCharWidth(ptr long long ptr) X11DRV_GetCharWidth @ cdecl GetCharWidth(ptr long long ptr) X11DRV_GetCharWidth
@ cdecl GetDCOrgEx(ptr ptr) X11DRV_GetDCOrgEx @ cdecl GetDCOrgEx(ptr ptr) X11DRV_GetDCOrgEx
@ cdecl GetDIBColorTable(ptr long long ptr) X11DRV_GetDIBColorTable
@ cdecl GetDIBits(ptr long long long ptr ptr long) X11DRV_GetDIBits
@ cdecl GetDeviceCaps(ptr long) X11DRV_GetDeviceCaps @ cdecl GetDeviceCaps(ptr long) X11DRV_GetDeviceCaps
@ cdecl GetDeviceGammaRamp(ptr ptr) X11DRV_GetDeviceGammaRamp @ cdecl GetDeviceGammaRamp(ptr ptr) X11DRV_GetDeviceGammaRamp
@ cdecl GetPixel(ptr long long) X11DRV_GetPixel @ cdecl GetPixel(ptr long long) X11DRV_GetPixel
...@@ -47,8 +49,13 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics ...@@ -47,8 +49,13 @@ debug_channels (bitblt bitmap clipboard cursor dinput event font gdi graphics
@ cdecl Polyline(ptr ptr long) X11DRV_Polyline @ cdecl Polyline(ptr ptr long) X11DRV_Polyline
@ cdecl Rectangle(ptr long long long long) X11DRV_Rectangle @ cdecl Rectangle(ptr long long long long) X11DRV_Rectangle
@ cdecl RoundRect(ptr long long long long long long) X11DRV_RoundRect @ cdecl RoundRect(ptr long long long long long long) X11DRV_RoundRect
@ cdecl SelectObject(ptr long) X11DRV_SelectObject @ cdecl SelectBitmap(ptr long) X11DRV_SelectBitmap
@ cdecl SelectBrush(ptr long) X11DRV_SelectBrush
@ cdecl SelectFont(ptr long) X11DRV_SelectFont
@ cdecl SelectPen(ptr long) X11DRV_SelectPen
@ cdecl SetBkColor(ptr long) X11DRV_SetBkColor @ cdecl SetBkColor(ptr long) X11DRV_SetBkColor
@ cdecl SetDIBColorTable(ptr long long ptr) X11DRV_SetDIBColorTable
@ cdecl SetDIBits(ptr long long long ptr ptr long) X11DRV_SetDIBits
@ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) X11DRV_SetDIBitsToDevice @ cdecl SetDIBitsToDevice(ptr long long long long long long long long ptr ptr long) X11DRV_SetDIBitsToDevice
@ cdecl SetDeviceClipping(ptr) X11DRV_SetDeviceClipping @ cdecl SetDeviceClipping(ptr) X11DRV_SetDeviceClipping
@ cdecl SetDeviceGammaRamp(ptr ptr) X11DRV_SetDeviceGammaRamp @ cdecl SetDeviceGammaRamp(ptr ptr) X11DRV_SetDeviceGammaRamp
......
...@@ -301,16 +301,15 @@ void X11DRV_XRender_Finalize(void) ...@@ -301,16 +301,15 @@ void X11DRV_XRender_Finalize(void)
/*********************************************************************** /***********************************************************************
* X11DRV_XRender_SelectFont * X11DRV_XRender_SelectFont
*/ */
BOOL X11DRV_XRender_SelectFont(DC *dc, HFONT hfont) BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
LFANDSIZE lfsz; LFANDSIZE lfsz;
GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf); GetObjectW(hfont, sizeof(lfsz.lf), &lfsz.lf);
TRACE("h=%ld w=%ld weight=%ld it=%d charset=%d name=%s\n", TRACE("h=%ld w=%ld weight=%ld it=%d charset=%d name=%s\n",
lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight, lfsz.lf.lfHeight, lfsz.lf.lfWidth, lfsz.lf.lfWeight,
lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName)); lfsz.lf.lfItalic, lfsz.lf.lfCharSet, debugstr_w(lfsz.lf.lfFaceName));
lfsz.xform = dc->xformWorld2Vport; lfsz.xform = physDev->dc->xformWorld2Vport;
lfsz_calc_hash(&lfsz); lfsz_calc_hash(&lfsz);
if(!physDev->xrender) if(!physDev->xrender)
...@@ -326,10 +325,8 @@ BOOL X11DRV_XRender_SelectFont(DC *dc, HFONT hfont) ...@@ -326,10 +325,8 @@ BOOL X11DRV_XRender_SelectFont(DC *dc, HFONT hfont)
/*********************************************************************** /***********************************************************************
* X11DRV_XRender_DeleteDC * X11DRV_XRender_DeleteDC
*/ */
void X11DRV_XRender_DeleteDC(DC *dc) void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev)
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if(physDev->xrender->tile_pict) if(physDev->xrender->tile_pict)
TSXRenderFreePicture(gdi_display, physDev->xrender->tile_pict); TSXRenderFreePicture(gdi_display, physDev->xrender->tile_pict);
...@@ -337,7 +334,7 @@ void X11DRV_XRender_DeleteDC(DC *dc) ...@@ -337,7 +334,7 @@ void X11DRV_XRender_DeleteDC(DC *dc)
TSXFreePixmap(gdi_display, physDev->xrender->tile_xpm); TSXFreePixmap(gdi_display, physDev->xrender->tile_xpm);
if(physDev->xrender->pict) { if(physDev->xrender->pict) {
TRACE("freeing pict = %lx dc = %p\n", physDev->xrender->pict, dc); TRACE("freeing pict = %lx dc = %p\n", physDev->xrender->pict, physDev->dc);
TSXRenderFreePicture(gdi_display, physDev->xrender->pict); TSXRenderFreePicture(gdi_display, physDev->xrender->pict);
} }
...@@ -356,21 +353,18 @@ void X11DRV_XRender_DeleteDC(DC *dc) ...@@ -356,21 +353,18 @@ void X11DRV_XRender_DeleteDC(DC *dc)
* drawable changes. However at the moment we delete the pict at the end of * drawable changes. However at the moment we delete the pict at the end of
* every ExtTextOut so this is basically a NOP. * every ExtTextOut so this is basically a NOP.
*/ */
void X11DRV_XRender_UpdateDrawable(DC *dc) void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if(physDev->xrender->pict) { if(physDev->xrender->pict) {
TRACE("freeing pict %08lx from dc %p\n", physDev->xrender->pict, dc); TRACE("freeing pict %08lx from dc %p\n", physDev->xrender->pict, physDev->dc);
TSXRenderFreePicture(gdi_display, physDev->xrender->pict); TSXRenderFreePicture(gdi_display, physDev->xrender->pict);
} }
physDev->xrender->pict = 0; physDev->xrender->pict = 0;
return; return;
} }
static BOOL UploadGlyph(DC *dc, WCHAR glyph) static BOOL UploadGlyph(X11DRV_PDEVICE *physDev, WCHAR glyph)
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
int buflen; int buflen;
char *buf; char *buf;
Glyph gid; Glyph gid;
...@@ -397,13 +391,13 @@ static BOOL UploadGlyph(DC *dc, WCHAR glyph) ...@@ -397,13 +391,13 @@ static BOOL UploadGlyph(DC *dc, WCHAR glyph)
ggo_format = GGO_BITMAP; ggo_format = GGO_BITMAP;
} }
buflen = GetGlyphOutlineW(dc->hSelf, glyph, ggo_format, &gm, 0, NULL, buflen = GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, 0, NULL,
NULL); NULL);
if(buflen == GDI_ERROR) if(buflen == GDI_ERROR)
return FALSE; return FALSE;
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen); buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, buflen);
GetGlyphOutlineW(dc->hSelf, glyph, ggo_format, &gm, buflen, buf, NULL); GetGlyphOutlineW(physDev->hdc, glyph, ggo_format, &gm, buflen, buf, NULL);
TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%ld,%ld\n", TRACE("buflen = %d. Got metrics: %dx%d adv=%d,%d origin=%ld,%ld\n",
buflen, buflen,
...@@ -477,14 +471,13 @@ static BOOL UploadGlyph(DC *dc, WCHAR glyph) ...@@ -477,14 +471,13 @@ static BOOL UploadGlyph(DC *dc, WCHAR glyph)
/*********************************************************************** /***********************************************************************
* X11DRV_XRender_ExtTextOut * X11DRV_XRender_ExtTextOut
*/ */
BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count, const RECT *lprect, LPCWSTR wstr, UINT count,
const INT *lpDx ) const INT *lpDx )
{ {
XRenderColor col; XRenderColor col;
int idx; int idx;
TEXTMETRICW tm; TEXTMETRICW tm;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
RGNOBJ *obj; RGNOBJ *obj;
XRectangle *pXrect; XRectangle *pXrect;
SIZE sz; SIZE sz;
...@@ -495,22 +488,22 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -495,22 +488,22 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
XGCValues xgcval; XGCValues xgcval;
LOGFONTW lf; LOGFONTW lf;
int render_op = PictOpOver; int render_op = PictOpOver;
HDC hdc = physDev->hdc;
DC *dc = physDev->dc;
TRACE("%04x, %d, %d, %08x, %p, %s, %d, %p)\n", dc->hSelf, x, y, flags, TRACE("%04x, %d, %d, %08x, %p, %s, %d, %p)\n", hdc, x, y, flags,
lprect, debugstr_wn(wstr, count), count, lpDx); lprect, debugstr_wn(wstr, count), count, lpDx);
if(lprect) if(lprect)
TRACE("rect: %d,%d - %d,%d\n", lprect->left, lprect->top, lprect->right, TRACE("rect: %d,%d - %d,%d\n", lprect->left, lprect->top, lprect->right,
lprect->bottom); lprect->bottom);
TRACE("align = %x bkmode = %x mapmode = %x\n", dc->textAlign, TRACE("align = %x bkmode = %x mapmode = %x\n", dc->textAlign, GetBkMode(hdc), dc->MapMode);
dc->backgroundMode,
dc->MapMode);
if(dc->textAlign & TA_UPDATECP) { if(dc->textAlign & TA_UPDATECP) {
x = dc->CursPosX; x = dc->CursPosX;
y = dc->CursPosY; y = dc->CursPosY;
} }
GetObjectW(GetCurrentObject(dc->hSelf, OBJ_FONT), sizeof(lf), &lf); GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
if(lf.lfEscapement != 0) { if(lf.lfEscapement != 0) {
cosEsc = cos(lf.lfEscapement * M_PI / 1800); cosEsc = cos(lf.lfEscapement * M_PI / 1800);
sinEsc = sin(lf.lfEscapement * M_PI / 1800); sinEsc = sin(lf.lfEscapement * M_PI / 1800);
...@@ -522,7 +515,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -522,7 +515,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
if(flags & (ETO_CLIPPED | ETO_OPAQUE)) { if(flags & (ETO_CLIPPED | ETO_OPAQUE)) {
if(!lprect) { if(!lprect) {
if(flags & ETO_CLIPPED) return FALSE; if(flags & ETO_CLIPPED) return FALSE;
GetTextExtentPointW(dc->hSelf, wstr, count, &sz); GetTextExtentPointW(hdc, wstr, count, &sz);
done_extents = TRUE; done_extents = TRUE;
rc.left = x; rc.left = x;
rc.top = y; rc.top = y;
...@@ -547,7 +540,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -547,7 +540,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
TSXChangeGC( gdi_display, physDev->gc, TSXChangeGC( gdi_display, physDev->gc,
GCFunction | GCBackground | GCFillStyle, &xgcval ); GCFunction | GCBackground | GCFillStyle, &xgcval );
X11DRV_LockDIBSection( dc, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
if(flags & ETO_OPAQUE) { if(flags & ETO_OPAQUE) {
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
...@@ -557,7 +550,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -557,7 +550,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
} }
if(count == 0) { if(count == 0) {
X11DRV_UnlockDIBSection( dc, TRUE ); X11DRV_UnlockDIBSection( physDev, TRUE );
return TRUE; return TRUE;
} }
...@@ -572,7 +565,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -572,7 +565,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
width += lpDx[idx]; width += lpDx[idx];
} else { } else {
if(!done_extents) { if(!done_extents) {
GetTextExtentPointW(dc->hSelf, wstr, count, &sz); GetTextExtentPointW(hdc, wstr, count, &sz);
done_extents = TRUE; done_extents = TRUE;
} }
width = sz.cx; width = sz.cx;
...@@ -581,7 +574,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -581,7 +574,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
xwidth = width * cosEsc; xwidth = width * cosEsc;
ywidth = width * sinEsc; ywidth = width * sinEsc;
GetTextMetricsW(dc->hSelf, &tm); GetTextMetricsW(hdc, &tm);
switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) { switch( dc->textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) ) {
case TA_LEFT: case TA_LEFT:
...@@ -623,7 +616,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -623,7 +616,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
if (flags & ETO_CLIPPED) if (flags & ETO_CLIPPED)
{ {
SaveVisRgn16( dc->hSelf ); SaveVisRgn16( hdc );
CLIPPING_IntersectVisRect( dc, rc.left, rc.top, rc.right, CLIPPING_IntersectVisRect( dc, rc.left, rc.top, rc.right,
rc.bottom, FALSE ); rc.bottom, FALSE );
} }
...@@ -691,7 +684,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -691,7 +684,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
GDI_ReleaseObj( dc->hGCClipRgn ); GDI_ReleaseObj( dc->hGCClipRgn );
if(dc->backgroundMode != TRANSPARENT) { if(GetBkMode(hdc) != TRANSPARENT) {
if(!((flags & ETO_CLIPPED) && (flags & ETO_OPAQUE))) { if(!((flags & ETO_CLIPPED) && (flags & ETO_OPAQUE))) {
if(!(flags & ETO_OPAQUE) || x < rc.left || x + width >= rc.right || if(!(flags & ETO_OPAQUE) || x < rc.left || x + width >= rc.right ||
y - tm.tmAscent < rc.top || y + tm.tmDescent >= rc.bottom) { y - tm.tmAscent < rc.top || y + tm.tmDescent >= rc.bottom) {
...@@ -751,7 +744,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -751,7 +744,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
for(idx = 0; idx < count; idx++) { for(idx = 0; idx < count; idx++) {
if(wstr[idx] >= physDev->xrender->cacheEntry->nrealized || if(wstr[idx] >= physDev->xrender->cacheEntry->nrealized ||
physDev->xrender->cacheEntry->realized[wstr[idx]] == FALSE) { physDev->xrender->cacheEntry->realized[wstr[idx]] == FALSE) {
UploadGlyph(dc, wstr[idx]); UploadGlyph(physDev, wstr[idx]);
} }
} }
...@@ -764,7 +757,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -764,7 +757,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
physDev->xrender->pict, physDev->xrender->pict,
physDev->xrender->cacheEntry->font_format, physDev->xrender->cacheEntry->font_format,
physDev->xrender->cacheEntry->glyphset, physDev->xrender->cacheEntry->glyphset,
0, 0, dc->DCOrgX + x, dc->DCOrgY + y, wstr, 0, 0, dc->DCOrgX + x, dc->DCOrgY + y, (unsigned short *)wstr,
count); count);
else { else {
...@@ -777,7 +770,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -777,7 +770,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
physDev->xrender->cacheEntry->glyphset, physDev->xrender->cacheEntry->glyphset,
0, 0, dc->DCOrgX + x + xoff, 0, 0, dc->DCOrgX + x + xoff,
dc->DCOrgY + y + yoff, dc->DCOrgY + y + yoff,
wstr + idx, 1); (unsigned short *)wstr + idx, 1);
offset += INTERNAL_XWSTODS(dc, lpDx[idx]); offset += INTERNAL_XWSTODS(dc, lpDx[idx]);
xoff = offset * cosEsc; xoff = offset * cosEsc;
yoff = offset * sinEsc; yoff = offset * sinEsc;
...@@ -791,9 +784,9 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -791,9 +784,9 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
if (flags & ETO_CLIPPED) if (flags & ETO_CLIPPED)
RestoreVisRgn16( dc->hSelf ); RestoreVisRgn16( hdc );
X11DRV_UnlockDIBSection( dc, TRUE ); X11DRV_UnlockDIBSection( physDev, TRUE );
return TRUE; return TRUE;
} }
...@@ -811,19 +804,19 @@ void X11DRV_XRender_Finalize(void) ...@@ -811,19 +804,19 @@ void X11DRV_XRender_Finalize(void)
return; return;
} }
BOOL X11DRV_XRender_SelectFont(DC *dc, HFONT hfont) BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE *physDev, HFONT hfont)
{ {
assert(0); assert(0);
return FALSE; return FALSE;
} }
void X11DRV_XRender_DeleteDC(DC *dc) void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev)
{ {
assert(0); assert(0);
return; return;
} }
BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, UINT count, const RECT *lprect, LPCWSTR wstr, UINT count,
const INT *lpDx ) const INT *lpDx )
{ {
...@@ -831,7 +824,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags, ...@@ -831,7 +824,7 @@ BOOL X11DRV_XRender_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
return FALSE; return FALSE;
} }
void X11DRV_XRender_UpdateDrawable(DC *dc) void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
{ {
assert(0); assert(0);
return; return;
......
...@@ -365,7 +365,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp) ...@@ -365,7 +365,7 @@ BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
* the stuff in graphics/x11drv/ has been moved to dlls/x11drv, so that * the stuff in graphics/x11drv/ has been moved to dlls/x11drv, so that
* they can include xvidmode.h directly * they can include xvidmode.h directly
*/ */
BOOL X11DRV_GetDeviceGammaRamp(DC *dc, LPVOID ramp) BOOL X11DRV_GetDeviceGammaRamp(X11DRV_PDEVICE *physDev, LPVOID ramp)
{ {
#ifdef HAVE_LIBXXF86VM #ifdef HAVE_LIBXXF86VM
return X11DRV_XF86VM_GetGammaRamp(ramp); return X11DRV_XF86VM_GetGammaRamp(ramp);
...@@ -381,7 +381,7 @@ BOOL X11DRV_GetDeviceGammaRamp(DC *dc, LPVOID ramp) ...@@ -381,7 +381,7 @@ BOOL X11DRV_GetDeviceGammaRamp(DC *dc, LPVOID ramp)
* the stuff in graphics/x11drv/ has been moved to dlls/x11drv, so that * the stuff in graphics/x11drv/ has been moved to dlls/x11drv, so that
* they can include xvidmode.h directly * they can include xvidmode.h directly
*/ */
BOOL X11DRV_SetDeviceGammaRamp(DC *dc, LPVOID ramp) BOOL X11DRV_SetDeviceGammaRamp(X11DRV_PDEVICE *physDev, LPVOID ramp)
{ {
#ifdef HAVE_LIBXXF86VM #ifdef HAVE_LIBXXF86VM
return X11DRV_XF86VM_SetGammaRamp(ramp); return X11DRV_XF86VM_SetGammaRamp(ramp);
......
...@@ -48,7 +48,7 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, ...@@ -48,7 +48,7 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top,
if (dc->funcs->pPatBlt) if (dc->funcs->pPatBlt)
{ {
TRACE("%04x %d,%d %dx%d %06lx\n", hdc, left, top, width, height, rop ); TRACE("%04x %d,%d %dx%d %06lx\n", hdc, left, top, width, height, rop );
bRet = dc->funcs->pPatBlt( dc, left, top, width, height, rop ); bRet = dc->funcs->pPatBlt( dc->physDev, left, top, width, height, rop );
} }
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return bRet; return bRet;
...@@ -84,8 +84,8 @@ BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, ...@@ -84,8 +84,8 @@ BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width,
hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->bitsPerPixel : 0, hdcSrc, xSrc, ySrc, dcSrc ? dcSrc->bitsPerPixel : 0,
hdcDst, xDst, yDst, width, height, dcDst->bitsPerPixel, rop); hdcDst, xDst, yDst, width, height, dcDst->bitsPerPixel, rop);
if (dcDst->funcs->pBitBlt) if (dcDst->funcs->pBitBlt)
ret = dcDst->funcs->pBitBlt( dcDst, xDst, yDst, width, height, ret = dcDst->funcs->pBitBlt( dcDst->physDev, xDst, yDst, width, height,
dcSrc, xSrc, ySrc, rop ); dcSrc->physDev, xSrc, ySrc, rop );
if (dcSrc) GDI_ReleaseObj( hdcSrc ); if (dcSrc) GDI_ReleaseObj( hdcSrc );
GDI_ReleaseObj( hdcDst ); GDI_ReleaseObj( hdcDst );
} }
...@@ -131,8 +131,9 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst, ...@@ -131,8 +131,9 @@ BOOL WINAPI StretchBlt( HDC hdcDst, INT xDst, INT yDst,
if (dcSrc) { if (dcSrc) {
if (dcDst->funcs->pStretchBlt) if (dcDst->funcs->pStretchBlt)
ret = dcDst->funcs->pStretchBlt( dcDst, xDst, yDst, widthDst, heightDst, ret = dcDst->funcs->pStretchBlt( dcDst->physDev, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); dcSrc->physDev, xSrc, ySrc, widthSrc, heightSrc,
rop );
GDI_ReleaseObj( hdcSrc ); GDI_ReleaseObj( hdcSrc );
} }
GDI_ReleaseObj( hdcDst ); GDI_ReleaseObj( hdcDst );
......
...@@ -348,7 +348,7 @@ INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData, ...@@ -348,7 +348,7 @@ INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
if (dc) if (dc)
{ {
if (dc->funcs->pExtEscape) if (dc->funcs->pExtEscape)
ret = dc->funcs->pExtEscape( dc, nEscape, cbInput, lpszInData, cbOutput, lpszOutData ); ret = dc->funcs->pExtEscape( dc->physDev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
......
...@@ -144,7 +144,7 @@ INT WINAPI SetMapMode( HDC hdc, INT mode ) ...@@ -144,7 +144,7 @@ INT WINAPI SetMapMode( HDC hdc, INT mode )
if (!dc) return 0; if (!dc) return 0;
if (dc->funcs->pSetMapMode) if (dc->funcs->pSetMapMode)
{ {
prevMode = dc->funcs->pSetMapMode( dc, mode ); prevMode = dc->funcs->pSetMapMode( dc->physDev, mode );
goto done; goto done;
} }
...@@ -240,7 +240,7 @@ BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size ) ...@@ -240,7 +240,7 @@ BOOL WINAPI SetViewportExtEx( HDC hdc, INT x, INT y, LPSIZE size )
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pSetViewportExt) if (dc->funcs->pSetViewportExt)
{ {
ret = dc->funcs->pSetViewportExt( dc, x, y ); ret = dc->funcs->pSetViewportExt( dc->physDev, x, y );
goto done; goto done;
} }
if (size) if (size)
...@@ -297,7 +297,7 @@ BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) ...@@ -297,7 +297,7 @@ BOOL WINAPI SetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt )
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pSetViewportOrg) if (dc->funcs->pSetViewportOrg)
ret = dc->funcs->pSetViewportOrg( dc, x, y ); ret = dc->funcs->pSetViewportOrg( dc->physDev, x, y );
else else
{ {
if (pt) if (pt)
...@@ -347,7 +347,7 @@ BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size ) ...@@ -347,7 +347,7 @@ BOOL WINAPI SetWindowExtEx( HDC hdc, INT x, INT y, LPSIZE size )
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pSetWindowExt) if (dc->funcs->pSetWindowExt)
{ {
ret = dc->funcs->pSetWindowExt( dc, x, y ); ret = dc->funcs->pSetWindowExt( dc->physDev, x, y );
goto done; goto done;
} }
if (size) if (size)
...@@ -403,7 +403,7 @@ BOOL WINAPI SetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) ...@@ -403,7 +403,7 @@ BOOL WINAPI SetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt )
BOOL ret = TRUE; BOOL ret = TRUE;
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pSetWindowOrg) ret = dc->funcs->pSetWindowOrg( dc, x, y ); if (dc->funcs->pSetWindowOrg) ret = dc->funcs->pSetWindowOrg( dc->physDev, x, y );
else else
{ {
if (pt) if (pt)
...@@ -452,7 +452,7 @@ BOOL WINAPI OffsetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt) ...@@ -452,7 +452,7 @@ BOOL WINAPI OffsetViewportOrgEx( HDC hdc, INT x, INT y, LPPOINT pt)
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pOffsetViewportOrg) if (dc->funcs->pOffsetViewportOrg)
ret = dc->funcs->pOffsetViewportOrg( dc, x, y ); ret = dc->funcs->pOffsetViewportOrg( dc->physDev, x, y );
else else
{ {
if (pt) if (pt)
...@@ -501,7 +501,7 @@ BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt ) ...@@ -501,7 +501,7 @@ BOOL WINAPI OffsetWindowOrgEx( HDC hdc, INT x, INT y, LPPOINT pt )
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pOffsetWindowOrg) if (dc->funcs->pOffsetWindowOrg)
ret = dc->funcs->pOffsetWindowOrg( dc, x, y ); ret = dc->funcs->pOffsetWindowOrg( dc->physDev, x, y );
else else
{ {
if (pt) if (pt)
...@@ -556,7 +556,7 @@ BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT xNum, INT xDenom, ...@@ -556,7 +556,7 @@ BOOL WINAPI ScaleViewportExtEx( HDC hdc, INT xNum, INT xDenom,
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pScaleViewportExt) if (dc->funcs->pScaleViewportExt)
{ {
ret = dc->funcs->pScaleViewportExt( dc, xNum, xDenom, yNum, yDenom ); ret = dc->funcs->pScaleViewportExt( dc->physDev, xNum, xDenom, yNum, yDenom );
goto done; goto done;
} }
if (size) if (size)
...@@ -621,7 +621,7 @@ BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT xNum, INT xDenom, ...@@ -621,7 +621,7 @@ BOOL WINAPI ScaleWindowExtEx( HDC hdc, INT xNum, INT xDenom,
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pScaleWindowExt) if (dc->funcs->pScaleWindowExt)
{ {
ret = dc->funcs->pScaleWindowExt( dc, xNum, xDenom, yNum, yDenom ); ret = dc->funcs->pScaleWindowExt( dc->physDev, xNum, xDenom, yNum, yDenom );
goto done; goto done;
} }
if (size) if (size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment