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.
This commit is contained in:
Alexandre Julliard 2002-03-28 22:22:05 +00:00
parent c4912ecd5f
commit e21c15e39d
78 changed files with 2123 additions and 2510 deletions

View File

@ -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

View File

@ -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 )
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);

View File

@ -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 )
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)
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 )
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 )
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 )
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 )
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 )
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 );
} }

View File

@ -29,109 +29,114 @@
typedef struct typedef struct
{ {
HDC hdc;
DC *dc;
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */ ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
UINT nextHandle; /* Next handle number */ UINT nextHandle; /* Next handle number */
HFILE hFile; /* HFILE for disk based MetaFile */ HFILE hFile; /* HFILE for disk based MetaFile */
} EMFDRV_PDEVICE; } EMFDRV_PDEVICE;
extern BOOL EMFDRV_WriteRecord( DC *dc, EMR *emr ); extern BOOL EMFDRV_WriteRecord( PHYSDEV dev, EMR *emr );
extern int EMFDRV_AddHandleDC( DC *dc ); extern int EMFDRV_AddHandleDC( PHYSDEV dev );
extern void EMFDRV_UpdateBBox( DC *dc, RECTL *rect ); extern void EMFDRV_UpdateBBox( PHYSDEV dev, RECTL *rect );
extern DWORD EMFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ); extern DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush );
/* Metafile driver functions */ /* Metafile driver functions */
extern BOOL EMFDRV_AbortPath( DC *dc ); extern BOOL EMFDRV_AbortPath( PHYSDEV dev );
extern BOOL EMFDRV_Arc( DC *dc, INT left, INT top, INT right, extern BOOL EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL EMFDRV_BeginPath( DC *dc ); extern BOOL EMFDRV_BeginPath( PHYSDEV dev );
extern BOOL EMFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, extern BOOL EMFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst,
INT width, INT height, DC *dcSrc, INT width, INT height, PHYSDEV devSrc,
INT xSrc, INT ySrc, DWORD rop ); INT xSrc, INT ySrc, DWORD rop );
extern BOOL EMFDRV_Chord( DC *dc, INT left, INT top, INT right, extern BOOL EMFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL EMFDRV_CloseFigure( DC *dc ); extern BOOL EMFDRV_CloseFigure( PHYSDEV dev );
extern BOOL EMFDRV_Ellipse( DC *dc, INT left, INT top, extern BOOL EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top,
INT right, INT bottom ); INT right, INT bottom );
extern BOOL EMFDRV_EndPath( DC *dc ); extern BOOL EMFDRV_EndPath( PHYSDEV dev );
extern INT EMFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, extern INT EMFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right,
INT bottom ); INT bottom );
extern BOOL EMFDRV_ExtFloodFill( DC *dc, INT x, INT y, extern BOOL EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y,
COLORREF color, UINT fillType ); COLORREF color, UINT fillType );
extern BOOL EMFDRV_ExtTextOut( DC *dc, INT x, INT y, extern BOOL EMFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y,
UINT flags, const RECT *lprect, LPCSTR str, UINT flags, const RECT *lprect, LPCSTR str,
UINT count, const INT *lpDx ); UINT count, const INT *lpDx );
extern BOOL EMFDRV_FillPath( DC *dc ); extern BOOL EMFDRV_FillPath( PHYSDEV dev );
extern BOOL EMFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush ); extern BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush );
extern BOOL EMFDRV_FlattenPath( DC *dc ); extern BOOL EMFDRV_FlattenPath( PHYSDEV dev );
extern BOOL EMFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT width, extern BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width,
INT height ); INT height );
extern INT EMFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, extern INT EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right,
INT bottom ); INT bottom );
extern BOOL EMFDRV_InvertRgn( DC *dc, HRGN hrgn ); extern BOOL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn );
extern BOOL EMFDRV_LineTo( DC *dc, INT x, INT y ); extern BOOL EMFDRV_LineTo( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_MoveTo( DC *dc, INT x, INT y ); extern BOOL EMFDRV_MoveTo( PHYSDEV dev, INT x, INT y );
extern INT EMFDRV_OffsetClipRgn( DC *dc, INT x, INT y ); extern INT EMFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_OffsetViewportOrg( DC *dc, INT x, INT y ); extern BOOL EMFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_OffsetWindowOrg( DC *dc, INT x, INT y ); extern BOOL EMFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_PaintRgn( DC *dc, HRGN hrgn ); extern BOOL EMFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn );
extern BOOL EMFDRV_PatBlt( DC *dc, INT left, INT top, extern BOOL EMFDRV_PatBlt( PHYSDEV dev, INT left, INT top,
INT width, INT height, DWORD rop ); INT width, INT height, DWORD rop );
extern BOOL EMFDRV_Pie( DC *dc, INT left, INT top, INT right, extern BOOL EMFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL EMFDRV_PolyPolygon( DC *dc, const POINT* pt, extern BOOL EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt,
const INT* counts, UINT polys); const INT* counts, UINT polys);
extern BOOL EMFDRV_PolyPolyline( DC *dc, const POINT* pt, extern BOOL EMFDRV_PolyPolyline( PHYSDEV dev, const POINT* pt,
const DWORD* counts, DWORD polys); const DWORD* counts, DWORD polys);
extern BOOL EMFDRV_Polygon( DC *dc, const POINT* pt, INT count ); extern BOOL EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count );
extern BOOL EMFDRV_Polyline( DC *dc, const POINT* pt,INT count); extern BOOL EMFDRV_Polyline( PHYSDEV dev, const POINT* pt,INT count);
extern BOOL EMFDRV_Rectangle( DC *dc, INT left, INT top, extern BOOL EMFDRV_Rectangle( PHYSDEV dev, INT left, INT top,
INT right, INT bottom); INT right, INT bottom);
extern BOOL EMFDRV_RestoreDC( DC *dc, INT level ); extern BOOL EMFDRV_RestoreDC( PHYSDEV dev, INT level );
extern BOOL EMFDRV_RoundRect( DC *dc, INT left, INT top, extern BOOL EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top,
INT right, INT bottom, INT ell_width, INT right, INT bottom, INT ell_width,
INT ell_height ); INT ell_height );
extern INT EMFDRV_SaveDC( DC *dc ); extern INT EMFDRV_SaveDC( PHYSDEV dev );
extern BOOL EMFDRV_ScaleViewportExt( DC *dc, INT xNum, extern BOOL EMFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum,
INT xDenom, INT yNum, INT yDenom ); INT xDenom, INT yNum, INT yDenom );
extern BOOL EMFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, extern BOOL EMFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom,
INT yNum, INT yDenom ); INT yNum, INT yDenom );
extern BOOL EMFDRV_SelectClipPath( DC *dc, INT iMode ); extern HBITMAP EMFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle );
extern HGDIOBJ EMFDRV_SelectObject( DC *dc, HGDIOBJ handle ); extern HBRUSH EMFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle );
extern COLORREF EMFDRV_SetBkColor( DC *dc, COLORREF color ); extern BOOL EMFDRV_SelectClipPath( PHYSDEV dev, INT iMode );
extern INT EMFDRV_SetBkMode( DC *dc, INT mode ); extern HFONT EMFDRV_SelectFont( PHYSDEV dev, HFONT handle );
extern INT EMFDRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, extern HPEN EMFDRV_SelectPen( PHYSDEV dev, HPEN handle );
extern COLORREF EMFDRV_SetBkColor( PHYSDEV dev, COLORREF color );
extern INT EMFDRV_SetBkMode( PHYSDEV dev, INT mode );
extern INT EMFDRV_SetDIBitsToDevice( PHYSDEV dev, INT xDest, INT yDest,
DWORD cx, DWORD cy, INT xSrc, DWORD cx, DWORD cy, INT xSrc,
INT ySrc, UINT startscan, UINT lines, INT ySrc, UINT startscan, UINT lines,
LPCVOID bits, const BITMAPINFO *info, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse ); UINT coloruse );
extern INT EMFDRV_SetMapMode( DC *dc, INT mode ); extern INT EMFDRV_SetMapMode( PHYSDEV dev, INT mode );
extern DWORD EMFDRV_SetMapperFlags( DC *dc, DWORD flags ); extern DWORD EMFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags );
extern COLORREF EMFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ); extern COLORREF EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color );
extern INT EMFDRV_SetPolyFillMode( DC *dc, INT mode ); extern INT EMFDRV_SetPolyFillMode( PHYSDEV dev, INT mode );
extern INT EMFDRV_SetROP2( DC *dc, INT rop ); extern INT EMFDRV_SetROP2( PHYSDEV dev, INT rop );
extern INT EMFDRV_SetStretchBltMode( DC *dc, INT mode ); extern INT EMFDRV_SetStretchBltMode( PHYSDEV dev, INT mode );
extern UINT EMFDRV_SetTextAlign( DC *dc, UINT align ); extern UINT EMFDRV_SetTextAlign( PHYSDEV dev, UINT align );
extern COLORREF EMFDRV_SetTextColor( DC *dc, COLORREF color ); extern COLORREF EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color );
extern BOOL EMFDRV_SetViewportExt( DC *dc, INT x, INT y ); extern BOOL EMFDRV_SetViewportExt( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_SetViewportOrg( DC *dc, INT x, INT y ); extern BOOL EMFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_SetWindowExt( DC *dc, INT x, INT y ); extern BOOL EMFDRV_SetWindowExt( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_SetWindowOrg( DC *dc, INT x, INT y ); extern BOOL EMFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y );
extern BOOL EMFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, extern BOOL EMFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthDst, INT heightDst,
DC *dcSrc, INT xSrc, INT ySrc, PHYSDEV devSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop ); INT widthSrc, INT heightSrc, DWORD rop );
extern INT EMFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, extern INT EMFDRV_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst,
INT heightDst, INT xSrc, INT ySrc, INT heightDst, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, INT widthSrc, INT heightSrc,
const void *bits, const BITMAPINFO *info, const void *bits, const BITMAPINFO *info,
UINT wUsage, DWORD dwRop ); UINT wUsage, DWORD dwRop );
extern BOOL EMFDRV_StrokeAndFillPath( DC *dc ); extern BOOL EMFDRV_StrokeAndFillPath( PHYSDEV dev );
extern BOOL EMFDRV_StrokePath( DC *dc ); extern BOOL EMFDRV_StrokePath( PHYSDEV dev );
extern BOOL EMFDRV_WidenPath( DC *dc ); extern BOOL EMFDRV_WidenPath( PHYSDEV dev );
#endif /* __WINE_METAFILEDRV_H */ #endif /* __WINE_METAFILEDRV_H */

View File

@ -31,7 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);
* EMFDRV_MoveTo * EMFDRV_MoveTo
*/ */
BOOL BOOL
EMFDRV_MoveTo(DC *dc, INT x, INT y) EMFDRV_MoveTo(PHYSDEV dev, INT x, INT y)
{ {
EMRMOVETOEX emr; EMRMOVETOEX emr;
@ -40,24 +40,26 @@ EMFDRV_MoveTo(DC *dc, INT x, INT y)
emr.ptl.x = x; emr.ptl.x = x;
emr.ptl.y = y; emr.ptl.y = y;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
/*********************************************************************** /***********************************************************************
* EMFDRV_LineTo * EMFDRV_LineTo
*/ */
BOOL BOOL
EMFDRV_LineTo( DC *dc, INT x, INT y ) EMFDRV_LineTo( PHYSDEV dev, INT x, INT y )
{ {
EMRLINETO emr; EMRLINETO emr;
RECTL bounds; RECTL bounds;
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
emr.emr.iType = EMR_LINETO; emr.emr.iType = EMR_LINETO;
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.ptl.x = x; emr.ptl.x = x;
emr.ptl.y = y; emr.ptl.y = y;
if(!EMFDRV_WriteRecord( dc, &emr.emr )) if(!EMFDRV_WriteRecord( dev, &emr.emr ))
return FALSE; return FALSE;
bounds.left = min(x, dc->CursPosX); bounds.left = min(x, dc->CursPosX);
@ -65,7 +67,7 @@ EMFDRV_LineTo( DC *dc, INT x, INT y )
bounds.right = max(x, dc->CursPosX); bounds.right = max(x, dc->CursPosX);
bounds.bottom = max(y, dc->CursPosY); bounds.bottom = max(y, dc->CursPosY);
EMFDRV_UpdateBBox( dc, &bounds ); EMFDRV_UpdateBBox( dev, &bounds );
return TRUE; return TRUE;
} }
@ -75,7 +77,7 @@ EMFDRV_LineTo( DC *dc, INT x, INT y )
* EMFDRV_ArcChordPie * EMFDRV_ArcChordPie
*/ */
static BOOL static BOOL
EMFDRV_ArcChordPie( DC *dc, INT left, INT top, INT right, INT bottom, EMFDRV_ArcChordPie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend, DWORD iType ) INT xstart, INT ystart, INT xend, INT yend, DWORD iType )
{ {
INT temp, xCentre, yCentre, i; INT temp, xCentre, yCentre, i;
@ -83,6 +85,8 @@ EMFDRV_ArcChordPie( DC *dc, INT left, INT top, INT right, INT bottom,
double xinterStart, yinterStart, xinterEnd, yinterEnd; double xinterStart, yinterStart, xinterEnd, yinterEnd;
EMRARC emr; EMRARC emr;
RECTL bounds; RECTL bounds;
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
if(left == right || top == bottom) return FALSE; if(left == right || top == bottom) return FALSE;
@ -167,9 +171,9 @@ EMFDRV_ArcChordPie( DC *dc, INT left, INT top, INT right, INT bottom,
if(bounds.top > yCentre) bounds.top = yCentre; if(bounds.top > yCentre) bounds.top = yCentre;
else if(bounds.bottom < yCentre) bounds.right = yCentre; else if(bounds.bottom < yCentre) bounds.right = yCentre;
} }
if(!EMFDRV_WriteRecord( dc, &emr.emr )) if(!EMFDRV_WriteRecord( dev, &emr.emr ))
return FALSE; return FALSE;
EMFDRV_UpdateBBox( dc, &bounds ); EMFDRV_UpdateBBox( dev, &bounds );
return TRUE; return TRUE;
} }
@ -178,10 +182,10 @@ EMFDRV_ArcChordPie( DC *dc, INT left, INT top, INT right, INT bottom,
* EMFDRV_Arc * EMFDRV_Arc
*/ */
BOOL BOOL
EMFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom, EMFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart, return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
xend, yend, EMR_ARC ); xend, yend, EMR_ARC );
} }
@ -189,10 +193,10 @@ EMFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom,
* EMFDRV_Pie * EMFDRV_Pie
*/ */
BOOL BOOL
EMFDRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom, EMFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart, return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
xend, yend, EMR_PIE ); xend, yend, EMR_PIE );
} }
@ -201,10 +205,10 @@ EMFDRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom,
* EMFDRV_Chord * EMFDRV_Chord
*/ */
BOOL BOOL
EMFDRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom, EMFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return EMFDRV_ArcChordPie( dc, left, top, right, bottom, xstart, ystart, return EMFDRV_ArcChordPie( dev, left, top, right, bottom, xstart, ystart,
xend, yend, EMR_CHORD ); xend, yend, EMR_CHORD );
} }
@ -212,10 +216,12 @@ EMFDRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom,
* EMFDRV_Ellipse * EMFDRV_Ellipse
*/ */
BOOL BOOL
EMFDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom ) EMFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{ {
EMRELLIPSE emr; EMRELLIPSE emr;
INT temp; INT temp;
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
TRACE("%d,%d - %d,%d\n", left, top, right, bottom); TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
@ -236,18 +242,20 @@ EMFDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom )
emr.rclBox.right = right; emr.rclBox.right = right;
emr.rclBox.bottom = bottom; emr.rclBox.bottom = bottom;
EMFDRV_UpdateBBox( dc, &emr.rclBox ); EMFDRV_UpdateBBox( dev, &emr.rclBox );
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
/*********************************************************************** /***********************************************************************
* EMFDRV_Rectangle * EMFDRV_Rectangle
*/ */
BOOL BOOL
EMFDRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) EMFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
{ {
EMRRECTANGLE emr; EMRRECTANGLE emr;
INT temp; INT temp;
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
TRACE("%d,%d - %d,%d\n", left, top, right, bottom); TRACE("%d,%d - %d,%d\n", left, top, right, bottom);
@ -268,19 +276,21 @@ EMFDRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
emr.rclBox.right = right; emr.rclBox.right = right;
emr.rclBox.bottom = bottom; emr.rclBox.bottom = bottom;
EMFDRV_UpdateBBox( dc, &emr.rclBox ); EMFDRV_UpdateBBox( dev, &emr.rclBox );
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
/*********************************************************************** /***********************************************************************
* EMFDRV_RoundRect * EMFDRV_RoundRect
*/ */
BOOL BOOL
EMFDRV_RoundRect( DC *dc, INT left, INT top, INT right, EMFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height ) INT bottom, INT ell_width, INT ell_height )
{ {
EMRROUNDRECT emr; EMRROUNDRECT emr;
INT temp; INT temp;
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
if(left == right || top == bottom) return FALSE; if(left == right || top == bottom) return FALSE;
@ -301,15 +311,15 @@ EMFDRV_RoundRect( DC *dc, INT left, INT top, INT right,
emr.szlCorner.cx = ell_width; emr.szlCorner.cx = ell_width;
emr.szlCorner.cy = ell_height; emr.szlCorner.cy = ell_height;
EMFDRV_UpdateBBox( dc, &emr.rclBox ); EMFDRV_UpdateBBox( dev, &emr.rclBox );
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
/*********************************************************************** /***********************************************************************
* EMFDRV_SetPixel * EMFDRV_SetPixel
*/ */
COLORREF COLORREF
EMFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ) EMFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
{ {
return TRUE; return TRUE;
} }
@ -321,7 +331,7 @@ EMFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color )
* Helper for EMFDRV_Poly{line|gon} * Helper for EMFDRV_Poly{line|gon}
*/ */
static BOOL static BOOL
EMFDRV_Polylinegon( DC *dc, const POINT* pt, INT count, DWORD iType ) EMFDRV_Polylinegon( PHYSDEV dev, const POINT* pt, INT count, DWORD iType )
{ {
EMRPOLYLINE *emr; EMRPOLYLINE *emr;
DWORD size; DWORD size;
@ -351,9 +361,9 @@ EMFDRV_Polylinegon( DC *dc, const POINT* pt, INT count, DWORD iType )
emr->cptl = count; emr->cptl = count;
memcpy(emr->aptl, pt, count * sizeof(POINTL)); memcpy(emr->aptl, pt, count * sizeof(POINTL));
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -363,19 +373,19 @@ EMFDRV_Polylinegon( DC *dc, const POINT* pt, INT count, DWORD iType )
* EMFDRV_Polyline * EMFDRV_Polyline
*/ */
BOOL BOOL
EMFDRV_Polyline( DC *dc, const POINT* pt, INT count ) EMFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
{ {
return EMFDRV_Polylinegon( dc, pt, count, EMR_POLYLINE ); return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYLINE );
} }
/********************************************************************** /**********************************************************************
* EMFDRV_Polygon * EMFDRV_Polygon
*/ */
BOOL BOOL
EMFDRV_Polygon( DC *dc, const POINT* pt, INT count ) EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
{ {
if(count < 2) return FALSE; if(count < 2) return FALSE;
return EMFDRV_Polylinegon( dc, pt, count, EMR_POLYGON ); return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYGON );
} }
@ -385,7 +395,7 @@ EMFDRV_Polygon( DC *dc, const POINT* pt, INT count )
* Helper for EMFDRV_PolyPoly{line|gon} * Helper for EMFDRV_PolyPoly{line|gon}
*/ */
static BOOL static BOOL
EMFDRV_PolyPolylinegon( DC *dc, const POINT* pt, const INT* counts, UINT polys, EMFDRV_PolyPolylinegon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys,
DWORD iType) DWORD iType)
{ {
EMRPOLYPOLYLINE *emr; EMRPOLYPOLYLINE *emr;
@ -421,9 +431,9 @@ EMFDRV_PolyPolylinegon( DC *dc, const POINT* pt, const INT* counts, UINT polys,
emr->cptl = cptl; emr->cptl = cptl;
memcpy(emr->aPolyCounts, counts, polys * sizeof(DWORD)); memcpy(emr->aPolyCounts, counts, polys * sizeof(DWORD));
memcpy(emr->aPolyCounts + polys, pt, cptl * sizeof(POINTL)); memcpy(emr->aPolyCounts + polys, pt, cptl * sizeof(POINTL));
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -432,9 +442,9 @@ EMFDRV_PolyPolylinegon( DC *dc, const POINT* pt, const INT* counts, UINT polys,
* EMFDRV_PolyPolyline * EMFDRV_PolyPolyline
*/ */
BOOL BOOL
EMFDRV_PolyPolyline(DC *dc, const POINT* pt, const DWORD* counts, DWORD polys) EMFDRV_PolyPolyline(PHYSDEV dev, const POINT* pt, const DWORD* counts, DWORD polys)
{ {
return EMFDRV_PolyPolylinegon( dc, pt, (INT *)counts, polys, return EMFDRV_PolyPolylinegon( dev, pt, (INT *)counts, polys,
EMR_POLYPOLYLINE ); EMR_POLYPOLYLINE );
} }
@ -442,9 +452,9 @@ EMFDRV_PolyPolyline(DC *dc, const POINT* pt, const DWORD* counts, DWORD polys)
* EMFDRV_PolyPolygon * EMFDRV_PolyPolygon
*/ */
BOOL BOOL
EMFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polys ) EMFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polys )
{ {
return EMFDRV_PolyPolylinegon( dc, pt, counts, polys, EMR_POLYPOLYGON ); return EMFDRV_PolyPolylinegon( dev, pt, counts, polys, EMR_POLYPOLYGON );
} }
@ -452,7 +462,7 @@ EMFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polys )
* EMFDRV_ExtFloodFill * EMFDRV_ExtFloodFill
*/ */
BOOL BOOL
EMFDRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, UINT fillType ) EMFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType )
{ {
EMREXTFLOODFILL emr; EMREXTFLOODFILL emr;
@ -463,20 +473,20 @@ EMFDRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, UINT fillType )
emr.crColor = color; emr.crColor = color;
emr.iMode = fillType; emr.iMode = fillType;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }
/********************************************************************* /*********************************************************************
* EMFDRV_FillRgn * EMFDRV_FillRgn
*/ */
BOOL EMFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush ) BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
{ {
EMRFILLRGN *emr; EMRFILLRGN *emr;
DWORD size, rgnsize, index; DWORD size, rgnsize, index;
BOOL ret; BOOL ret;
index = EMFDRV_CreateBrushIndirect( dc, hbrush ); index = EMFDRV_CreateBrushIndirect( dev, hbrush );
if(!index) return FALSE; if(!index) return FALSE;
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
@ -494,22 +504,22 @@ BOOL EMFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush )
emr->cbRgnData = rgnsize; emr->cbRgnData = rgnsize;
emr->ihBrush = index; emr->ihBrush = index;
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
/********************************************************************* /*********************************************************************
* EMFDRV_FrameRgn * EMFDRV_FrameRgn
*/ */
BOOL EMFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT width, INT height ) BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
{ {
EMRFRAMERGN *emr; EMRFRAMERGN *emr;
DWORD size, rgnsize, index; DWORD size, rgnsize, index;
BOOL ret; BOOL ret;
index = EMFDRV_CreateBrushIndirect( dc, hbrush ); index = EMFDRV_CreateBrushIndirect( dev, hbrush );
if(!index) return FALSE; if(!index) return FALSE;
rgnsize = GetRegionData( hrgn, 0, NULL ); rgnsize = GetRegionData( hrgn, 0, NULL );
@ -529,9 +539,9 @@ BOOL EMFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
emr->szlStroke.cx = width; emr->szlStroke.cx = width;
emr->szlStroke.cy = height; emr->szlStroke.cy = height;
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -541,7 +551,7 @@ BOOL EMFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT width, INT height )
* *
* Helper for EMFDRV_{Paint|Invert}Rgn * Helper for EMFDRV_{Paint|Invert}Rgn
*/ */
static BOOL EMFDRV_PaintInvertRgn( DC *dc, HRGN hrgn, DWORD iType ) static BOOL EMFDRV_PaintInvertRgn( PHYSDEV dev, HRGN hrgn, DWORD iType )
{ {
EMRINVERTRGN *emr; EMRINVERTRGN *emr;
DWORD size, rgnsize; DWORD size, rgnsize;
@ -562,9 +572,9 @@ static BOOL EMFDRV_PaintInvertRgn( DC *dc, HRGN hrgn, DWORD iType )
emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1; emr->rclBounds.bottom = ((RGNDATA *)&emr->RgnData)->rdh.rcBound.bottom - 1;
emr->cbRgnData = rgnsize; emr->cbRgnData = rgnsize;
ret = EMFDRV_WriteRecord( dc, &emr->emr ); ret = EMFDRV_WriteRecord( dev, &emr->emr );
if(ret) if(ret)
EMFDRV_UpdateBBox( dc, &emr->rclBounds ); EMFDRV_UpdateBBox( dev, &emr->rclBounds );
HeapFree( GetProcessHeap(), 0, emr ); HeapFree( GetProcessHeap(), 0, emr );
return ret; return ret;
} }
@ -573,25 +583,25 @@ static BOOL EMFDRV_PaintInvertRgn( DC *dc, HRGN hrgn, DWORD iType )
* EMFDRV_PaintRgn * EMFDRV_PaintRgn
*/ */
BOOL BOOL
EMFDRV_PaintRgn( DC *dc, HRGN hrgn ) EMFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
{ {
return EMFDRV_PaintInvertRgn( dc, hrgn, EMR_PAINTRGN ); return EMFDRV_PaintInvertRgn( dev, hrgn, EMR_PAINTRGN );
} }
/********************************************************************** /**********************************************************************
* EMFDRV_InvertRgn * EMFDRV_InvertRgn
*/ */
BOOL BOOL
EMFDRV_InvertRgn( DC *dc, HRGN hrgn ) EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
{ {
return EMFDRV_PaintInvertRgn( dc, hrgn, EMR_INVERTRGN ); return EMFDRV_PaintInvertRgn( dev, hrgn, EMR_INVERTRGN );
} }
/********************************************************************** /**********************************************************************
* EMFDRV_SetBkColor * EMFDRV_SetBkColor
*/ */
COLORREF COLORREF
EMFDRV_SetBkColor( DC *dc, COLORREF color ) EMFDRV_SetBkColor( PHYSDEV dev, COLORREF color )
{ {
EMRSETBKCOLOR emr; EMRSETBKCOLOR emr;
@ -599,7 +609,7 @@ EMFDRV_SetBkColor( DC *dc, COLORREF color )
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.crColor = color; emr.crColor = color;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
} }
@ -607,7 +617,7 @@ EMFDRV_SetBkColor( DC *dc, COLORREF color )
* EMFDRV_SetTextColor * EMFDRV_SetTextColor
*/ */
COLORREF COLORREF
EMFDRV_SetTextColor( DC *dc, COLORREF color ) EMFDRV_SetTextColor( PHYSDEV dev, COLORREF color )
{ {
EMRSETTEXTCOLOR emr; EMRSETTEXTCOLOR emr;
@ -615,5 +625,5 @@ EMFDRV_SetTextColor( DC *dc, COLORREF color )
emr.emr.nSize = sizeof(emr); emr.emr.nSize = sizeof(emr);
emr.crColor = color; emr.crColor = color;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr ) ? color : CLR_INVALID;
} }

View File

@ -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 =
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 =
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 =
/********************************************************************** /**********************************************************************
* 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 )
* *
* 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 )
/****************************************************************** /******************************************************************
* 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 )
* 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(
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(
{ {
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 */
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 */
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 */
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 */
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;
} }

View File

@ -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 )
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 )
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 )
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 )
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,
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,
emr.yNum = yNum; emr.yNum = yNum;
emr.yDenom = yDenom; emr.yDenom = yDenom;
return EMFDRV_WriteRecord( dc, &emr.emr ); return EMFDRV_WriteRecord( dev, &emr.emr );
} }

View File

@ -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 )
/*********************************************************************** /***********************************************************************
* 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 )
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 )
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 )
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 )
/*********************************************************************** /***********************************************************************
* 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 )
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 )
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 )
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 )
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 )
/****************************************************************** /******************************************************************
* 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 )
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 )
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;
}

View File

@ -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,
/*********************************************************************** /***********************************************************************
* 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,
*(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,
#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,
*(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,
/*********************************************************************** /***********************************************************************
* 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,
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,
/*********************************************************************** /***********************************************************************
* 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,
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;
} }

View File

@ -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;
} }

View File

@ -32,18 +32,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(metafile);
* MFDRV_MoveTo * MFDRV_MoveTo
*/ */
BOOL BOOL
MFDRV_MoveTo(DC *dc, INT x, INT y) MFDRV_MoveTo(PHYSDEV dev, INT x, INT y)
{ {
return MFDRV_MetaParam2(dc,META_MOVETO,x,y); return MFDRV_MetaParam2(dev,META_MOVETO,x,y);
} }
/*********************************************************************** /***********************************************************************
* MFDRV_LineTo * MFDRV_LineTo
*/ */
BOOL BOOL
MFDRV_LineTo( DC *dc, INT x, INT y ) MFDRV_LineTo( PHYSDEV dev, INT x, INT y )
{ {
return MFDRV_MetaParam2(dc, META_LINETO, x, y); return MFDRV_MetaParam2(dev, META_LINETO, x, y);
} }
@ -51,10 +51,10 @@ MFDRV_LineTo( DC *dc, INT x, INT y )
* MFDRV_Arc * MFDRV_Arc
*/ */
BOOL BOOL
MFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom, MFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return MFDRV_MetaParam8(dc, META_ARC, left, top, right, bottom, return MFDRV_MetaParam8(dev, META_ARC, left, top, right, bottom,
xstart, ystart, xend, yend); xstart, ystart, xend, yend);
} }
@ -63,10 +63,10 @@ MFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom,
* MFDRV_Pie * MFDRV_Pie
*/ */
BOOL BOOL
MFDRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom, MFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return MFDRV_MetaParam8(dc, META_PIE, left, top, right, bottom, return MFDRV_MetaParam8(dev, META_PIE, left, top, right, bottom,
xstart, ystart, xend, yend); xstart, ystart, xend, yend);
} }
@ -75,10 +75,10 @@ MFDRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom,
* MFDRV_Chord * MFDRV_Chord
*/ */
BOOL BOOL
MFDRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom, MFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return MFDRV_MetaParam8(dc, META_CHORD, left, top, right, bottom, return MFDRV_MetaParam8(dev, META_CHORD, left, top, right, bottom,
xstart, ystart, xend, yend); xstart, ystart, xend, yend);
} }
@ -86,28 +86,28 @@ MFDRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom,
* MFDRV_Ellipse * MFDRV_Ellipse
*/ */
BOOL BOOL
MFDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom ) MFDRV_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{ {
return MFDRV_MetaParam4(dc, META_ELLIPSE, left, top, right, bottom); return MFDRV_MetaParam4(dev, META_ELLIPSE, left, top, right, bottom);
} }
/*********************************************************************** /***********************************************************************
* MFDRV_Rectangle * MFDRV_Rectangle
*/ */
BOOL BOOL
MFDRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) MFDRV_Rectangle(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
{ {
return MFDRV_MetaParam4(dc, META_RECTANGLE, left, top, right, bottom); return MFDRV_MetaParam4(dev, META_RECTANGLE, left, top, right, bottom);
} }
/*********************************************************************** /***********************************************************************
* MFDRV_RoundRect * MFDRV_RoundRect
*/ */
BOOL BOOL
MFDRV_RoundRect( DC *dc, INT left, INT top, INT right, MFDRV_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height ) INT bottom, INT ell_width, INT ell_height )
{ {
return MFDRV_MetaParam6(dc, META_ROUNDRECT, left, top, right, bottom, return MFDRV_MetaParam6(dev, META_ROUNDRECT, left, top, right, bottom,
ell_width, ell_height); ell_width, ell_height);
} }
@ -115,9 +115,9 @@ MFDRV_RoundRect( DC *dc, INT left, INT top, INT right,
* MFDRV_SetPixel * MFDRV_SetPixel
*/ */
COLORREF COLORREF
MFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ) MFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
{ {
return MFDRV_MetaParam4(dc, META_SETPIXEL, x, y,HIWORD(color), return MFDRV_MetaParam4(dev, META_SETPIXEL, x, y,HIWORD(color),
LOWORD(color)); LOWORD(color));
} }
@ -125,7 +125,7 @@ MFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color )
/****************************************************************** /******************************************************************
* MFDRV_MetaPoly - implements Polygon and Polyline * MFDRV_MetaPoly - implements Polygon and Polyline
*/ */
static BOOL MFDRV_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count) static BOOL MFDRV_MetaPoly(PHYSDEV dev, short func, LPPOINT16 pt, short count)
{ {
BOOL ret; BOOL ret;
DWORD len; DWORD len;
@ -139,7 +139,7 @@ static BOOL MFDRV_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
mr->rdFunction = func; mr->rdFunction = func;
*(mr->rdParm) = count; *(mr->rdParm) = count;
memcpy(mr->rdParm + 1, pt, count * 4); memcpy(mr->rdParm + 1, pt, count * 4);
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;
} }
@ -149,7 +149,7 @@ static BOOL MFDRV_MetaPoly(DC *dc, short func, LPPOINT16 pt, short count)
* MFDRV_Polyline * MFDRV_Polyline
*/ */
BOOL BOOL
MFDRV_Polyline( DC *dc, const POINT* pt, INT count ) MFDRV_Polyline( PHYSDEV dev, const POINT* pt, INT count )
{ {
register int i; register int i;
LPPOINT16 pt16; LPPOINT16 pt16;
@ -158,7 +158,7 @@ MFDRV_Polyline( DC *dc, const POINT* pt, INT count )
pt16 = (LPPOINT16)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count ); pt16 = (LPPOINT16)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count );
if(!pt16) return FALSE; if(!pt16) return FALSE;
for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i])); for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i]));
ret = MFDRV_MetaPoly(dc, META_POLYLINE, pt16, count); ret = MFDRV_MetaPoly(dev, META_POLYLINE, pt16, count);
HeapFree( GetProcessHeap(), 0, pt16 ); HeapFree( GetProcessHeap(), 0, pt16 );
return ret; return ret;
@ -169,7 +169,7 @@ MFDRV_Polyline( DC *dc, const POINT* pt, INT count )
* MFDRV_Polygon * MFDRV_Polygon
*/ */
BOOL BOOL
MFDRV_Polygon( DC *dc, const POINT* pt, INT count ) MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count )
{ {
register int i; register int i;
LPPOINT16 pt16; LPPOINT16 pt16;
@ -178,7 +178,7 @@ MFDRV_Polygon( DC *dc, const POINT* pt, INT count )
pt16 = (LPPOINT16) HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count ); pt16 = (LPPOINT16) HeapAlloc( GetProcessHeap(), 0, sizeof(POINT16)*count );
if(!pt16) return FALSE; if(!pt16) return FALSE;
for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i])); for (i=count;i--;) CONV_POINT32TO16(&(pt[i]),&(pt16[i]));
ret = MFDRV_MetaPoly(dc, META_POLYGON, pt16, count); ret = MFDRV_MetaPoly(dev, META_POLYGON, pt16, count);
HeapFree( GetProcessHeap(), 0, pt16 ); HeapFree( GetProcessHeap(), 0, pt16 );
return ret; return ret;
@ -189,7 +189,7 @@ MFDRV_Polygon( DC *dc, const POINT* pt, INT count )
* MFDRV_PolyPolygon * MFDRV_PolyPolygon
*/ */
BOOL BOOL
MFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons) MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts, UINT polygons)
{ {
int i,j; int i,j;
LPPOINT16 pt16; LPPOINT16 pt16;
@ -201,7 +201,7 @@ MFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons)
sizeof(POINT16) * counts[i] ); sizeof(POINT16) * counts[i] );
if(!pt16) return FALSE; if(!pt16) return FALSE;
for (j=counts[i];j--;) CONV_POINT32TO16(&(curpt[j]),&(pt16[j])); for (j=counts[i];j--;) CONV_POINT32TO16(&(curpt[j]),&(pt16[j]));
ret = MFDRV_MetaPoly(dc, META_POLYGON, pt16, counts[i]); ret = MFDRV_MetaPoly(dev, META_POLYGON, pt16, counts[i]);
HeapFree( GetProcessHeap(), 0, pt16 ); HeapFree( GetProcessHeap(), 0, pt16 );
if (!ret) if (!ret)
return FALSE; return FALSE;
@ -215,9 +215,9 @@ MFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons)
* MFDRV_ExtFloodFill * MFDRV_ExtFloodFill
*/ */
BOOL BOOL
MFDRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, UINT fillType ) MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT fillType )
{ {
return MFDRV_MetaParam4(dc,META_FLOODFILL,x,y,HIWORD(color), return MFDRV_MetaParam4(dev,META_FLOODFILL,x,y,HIWORD(color),
LOWORD(color)); LOWORD(color));
} }
@ -228,7 +228,7 @@ MFDRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, UINT fillType )
* For explanation of the format of the record see MF_Play_MetaCreateRegion in * For explanation of the format of the record see MF_Play_MetaCreateRegion in
* objects/metafile.c * objects/metafile.c
*/ */
static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn) static INT16 MFDRV_CreateRegion(PHYSDEV dev, HRGN hrgn)
{ {
DWORD len; DWORD len;
METARECORD *mr; METARECORD *mr;
@ -298,7 +298,7 @@ static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn)
mr->rdParm[10] = rgndata->rdh.rcBound.bottom; mr->rdParm[10] = rgndata->rdh.rcBound.bottom;
mr->rdFunction = META_CREATEREGION; mr->rdFunction = META_CREATEREGION;
mr->rdSize = len / 2; mr->rdSize = len / 2;
ret = MFDRV_WriteRecord( dc, mr, mr->rdSize * 2 ); ret = MFDRV_WriteRecord( dev, mr, mr->rdSize * 2 );
HeapFree( GetProcessHeap(), 0, mr ); HeapFree( GetProcessHeap(), 0, mr );
HeapFree( GetProcessHeap(), 0, rgndata ); HeapFree( GetProcessHeap(), 0, rgndata );
if(!ret) if(!ret)
@ -306,7 +306,7 @@ static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn)
WARN("MFDRV_WriteRecord failed\n"); WARN("MFDRV_WriteRecord failed\n");
return -1; return -1;
} }
return MFDRV_AddHandleDC( dc ); return MFDRV_AddHandleDC( dev );
} }
@ -314,13 +314,13 @@ static INT16 MFDRV_CreateRegion(DC *dc, HRGN hrgn)
* MFDRV_PaintRgn * MFDRV_PaintRgn
*/ */
BOOL BOOL
MFDRV_PaintRgn( DC *dc, HRGN hrgn ) MFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn )
{ {
INT16 index; INT16 index;
index = MFDRV_CreateRegion( dc, hrgn ); index = MFDRV_CreateRegion( dev, hrgn );
if(index == -1) if(index == -1)
return FALSE; return FALSE;
return MFDRV_MetaParam1( dc, META_PAINTREGION, index ); return MFDRV_MetaParam1( dev, META_PAINTREGION, index );
} }
@ -328,13 +328,13 @@ MFDRV_PaintRgn( DC *dc, HRGN hrgn )
* MFDRV_InvertRgn * MFDRV_InvertRgn
*/ */
BOOL BOOL
MFDRV_InvertRgn( DC *dc, HRGN hrgn ) MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn )
{ {
INT16 index; INT16 index;
index = MFDRV_CreateRegion( dc, hrgn ); index = MFDRV_CreateRegion( dev, hrgn );
if(index == -1) if(index == -1)
return FALSE; return FALSE;
return MFDRV_MetaParam1( dc, META_INVERTREGION, index ); return MFDRV_MetaParam1( dev, META_INVERTREGION, index );
} }
@ -342,32 +342,32 @@ MFDRV_InvertRgn( DC *dc, HRGN hrgn )
* MFDRV_FillRgn * MFDRV_FillRgn
*/ */
BOOL BOOL
MFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush ) MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush )
{ {
INT16 iRgn, iBrush; INT16 iRgn, iBrush;
iRgn = MFDRV_CreateRegion( dc, hrgn ); iRgn = MFDRV_CreateRegion( dev, hrgn );
if(iRgn == -1) if(iRgn == -1)
return FALSE; return FALSE;
iBrush = MFDRV_CreateBrushIndirect( dc, hbrush ); iBrush = MFDRV_CreateBrushIndirect( dev, hbrush );
if(iBrush == -1) if(iBrush == -1)
return FALSE; return FALSE;
return MFDRV_MetaParam2( dc, META_FILLREGION, iRgn, iBrush ); return MFDRV_MetaParam2( dev, META_FILLREGION, iRgn, iBrush );
} }
/********************************************************************** /**********************************************************************
* MFDRV_FrameRgn * MFDRV_FrameRgn
*/ */
BOOL BOOL
MFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
{ {
INT16 iRgn, iBrush; INT16 iRgn, iBrush;
iRgn = MFDRV_CreateRegion( dc, hrgn ); iRgn = MFDRV_CreateRegion( dev, hrgn );
if(iRgn == -1) if(iRgn == -1)
return FALSE; return FALSE;
iBrush = MFDRV_CreateBrushIndirect( dc, hbrush ); iBrush = MFDRV_CreateBrushIndirect( dev, hbrush );
if(iBrush == -1) if(iBrush == -1)
return FALSE; return FALSE;
return MFDRV_MetaParam4( dc, META_FRAMEREGION, iRgn, iBrush, x, y ); return MFDRV_MetaParam4( dev, META_FRAMEREGION, iRgn, iBrush, x, y );
} }
@ -375,9 +375,10 @@ MFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
* MFDRV_SetBkColor * MFDRV_SetBkColor
*/ */
COLORREF COLORREF
MFDRV_SetBkColor( DC *dc, COLORREF color ) MFDRV_SetBkColor( PHYSDEV dev, COLORREF color )
{ {
return MFDRV_MetaParam2(dc, META_SETBKCOLOR, HIWORD(color), LOWORD(color)); return MFDRV_MetaParam2(dev, META_SETBKCOLOR, HIWORD(color),
LOWORD(color)) ? color : CLR_INVALID;
} }
@ -385,10 +386,10 @@ MFDRV_SetBkColor( DC *dc, COLORREF color )
* MFDRV_SetTextColor * MFDRV_SetTextColor
*/ */
COLORREF COLORREF
MFDRV_SetTextColor( DC *dc, COLORREF color ) MFDRV_SetTextColor( PHYSDEV dev, COLORREF color )
{ {
return MFDRV_MetaParam2(dc, META_SETTEXTCOLOR, HIWORD(color), return MFDRV_MetaParam2(dev, META_SETTEXTCOLOR, HIWORD(color),
LOWORD(color)); LOWORD(color)) ? color : CLR_INVALID;
} }
@ -398,7 +399,7 @@ MFDRV_SetTextColor( DC *dc, COLORREF color )
* approximations to them using lines, we need this stub function. * approximations to them using lines, we need this stub function.
*/ */
BOOL BOOL
MFDRV_PolyBezier( DC *dc, const POINT *pts, DWORD count ) MFDRV_PolyBezier( PHYSDEV dev, const POINT *pts, DWORD count )
{ {
return FALSE; return FALSE;
} }
@ -409,7 +410,7 @@ MFDRV_PolyBezier( DC *dc, const POINT *pts, DWORD count )
* approximations to them using lines, we need this stub function. * approximations to them using lines, we need this stub function.
*/ */
BOOL BOOL
MFDRV_PolyBezierTo( DC *dc, const POINT *pts, DWORD count ) MFDRV_PolyBezierTo( PHYSDEV dev, const POINT *pts, DWORD count )
{ {
return FALSE; return FALSE;
} }

View File

@ -43,9 +43,9 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_Chord, /* pChord */ MFDRV_Chord, /* pChord */
MFDRV_CloseFigure, /* pCloseFigure */ MFDRV_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 */
@ -65,9 +65,11 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_FrameRgn, /* pFrameRgn */ MFDRV_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 */
@ -96,15 +98,20 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_SaveDC, /* pSaveDC */ MFDRV_SaveDC, /* pSaveDC */
MFDRV_ScaleViewportExt, /* pScaleViewportExt */ MFDRV_ScaleViewportExt, /* pScaleViewportExt */
MFDRV_ScaleWindowExt, /* pScaleWindowExt */ MFDRV_ScaleWindowExt, /* pScaleWindowExt */
MFDRV_SelectBitmap, /* pSelectBitmap */
MFDRV_SelectBrush, /* pSelectBrush */
MFDRV_SelectClipPath, /* pSelectClipPath */ MFDRV_SelectClipPath, /* pSelectClipPath */
NULL, /* pSelectClipRgn */ NULL, /* pSelectClipRgn */
MFDRV_SelectObject, /* pSelectObject */ MFDRV_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */ NULL, /* pSelectPalette */
MFDRV_SelectPen, /* pSelectPen */
MFDRV_SetBkColor, /* pSetBkColor */ MFDRV_SetBkColor, /* pSetBkColor */
MFDRV_SetBkMode, /* pSetBkMode */ MFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
NULL, /* pSetDeviceClipping */ NULL, /* pSetDeviceClipping */
NULL, /* pSetDeviceGammaRamp */ NULL, /* pSetDeviceGammaRamp */
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
MFDRV_SetMapMode, /* pSetMapMode */ MFDRV_SetMapMode, /* pSetMapMode */
MFDRV_SetMapperFlags, /* pSetMapperFlags */ MFDRV_SetMapperFlags, /* pSetMapperFlags */
MFDRV_SetPixel, /* pSetPixel */ MFDRV_SetPixel, /* pSetPixel */
@ -150,7 +157,9 @@ static DC *MFDRV_AllocMetaFile(void)
GDI_FreeObject( dc->hSelf, dc ); GDI_FreeObject( dc->hSelf, dc );
return NULL; return NULL;
} }
dc->physDev = physDev; dc->physDev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc;
if (!(physDev->mh = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev->mh) ))) if (!(physDev->mh = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev->mh) )))
{ {
@ -176,9 +185,10 @@ static DC *MFDRV_AllocMetaFile(void)
/********************************************************************** /**********************************************************************
* MFDRV_DeleteDC * MFDRV_DeleteDC
*/ */
static BOOL MFDRV_DeleteDC( DC *dc ) static BOOL MFDRV_DeleteDC( PHYSDEV dev )
{ {
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
DC *dc = physDev->dc;
if (physDev->mh) HeapFree( GetProcessHeap(), 0, physDev->mh ); if (physDev->mh) HeapFree( GetProcessHeap(), 0, physDev->mh );
HeapFree( GetProcessHeap(), 0, physDev ); HeapFree( GetProcessHeap(), 0, physDev );
@ -216,12 +226,12 @@ HDC16 WINAPI CreateMetaFile16(
physDev->mh->mtType = METAFILE_DISK; physDev->mh->mtType = METAFILE_DISK;
if ((hFile = CreateFileA(filename, GENERIC_WRITE, 0, NULL, if ((hFile = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) { CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
if (!WriteFile( hFile, (LPSTR)physDev->mh, sizeof(*physDev->mh), NULL, if (!WriteFile( hFile, (LPSTR)physDev->mh, sizeof(*physDev->mh), NULL,
NULL )) { NULL )) {
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
physDev->hFile = hFile; physDev->hFile = hFile;
@ -286,23 +296,23 @@ static DC *MFDRV_CloseMetaFile( HDC hdc )
* in SDK Knowledgebase Q99334. * in SDK Knowledgebase Q99334.
*/ */
if (!MFDRV_MetaParam0(dc, META_EOF)) if (!MFDRV_MetaParam0(dc->physDev, META_EOF))
{ {
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
if (physDev->mh->mtType == METAFILE_DISK) /* disk based metafile */ if (physDev->mh->mtType == METAFILE_DISK) /* disk based metafile */
{ {
if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) { if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) {
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
physDev->mh->mtType = METAFILE_MEMORY; /* This is what windows does */ physDev->mh->mtType = METAFILE_MEMORY; /* This is what windows does */
if (!WriteFile(physDev->hFile, (LPSTR)physDev->mh, if (!WriteFile(physDev->hFile, (LPSTR)physDev->mh,
sizeof(*physDev->mh), NULL, NULL)) { sizeof(*physDev->mh), NULL, NULL)) {
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return 0; return 0;
} }
CloseHandle(physDev->hFile); CloseHandle(physDev->hFile);
@ -331,7 +341,7 @@ HMETAFILE16 WINAPI CloseMetaFile16(
hmf = MF_Create_HMETAFILE16( physDev->mh ); hmf = MF_Create_HMETAFILE16( physDev->mh );
physDev->mh = NULL; /* So it won't be deleted */ physDev->mh = NULL; /* So it won't be deleted */
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return hmf; return hmf;
} }
@ -359,7 +369,7 @@ HMETAFILE WINAPI CloseMetaFile(
hmf = MF_Create_HMETAFILE( physDev->mh ); hmf = MF_Create_HMETAFILE( physDev->mh );
physDev->mh = NULL; /* So it won't be deleted */ physDev->mh = NULL; /* So it won't be deleted */
MFDRV_DeleteDC( dc ); MFDRV_DeleteDC( dc->physDev );
return hmf; return hmf;
} }
@ -369,11 +379,11 @@ HMETAFILE WINAPI CloseMetaFile(
* *
* Warning: this function can change the pointer to the metafile header. * Warning: this function can change the pointer to the metafile header.
*/ */
BOOL MFDRV_WriteRecord( DC *dc, METARECORD *mr, DWORD rlen) BOOL MFDRV_WriteRecord( PHYSDEV dev, METARECORD *mr, DWORD rlen)
{ {
DWORD len; DWORD len;
METAHEADER *mh; METAHEADER *mh;
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
switch(physDev->mh->mtType) switch(physDev->mh->mtType)
{ {
@ -404,21 +414,21 @@ BOOL MFDRV_WriteRecord( DC *dc, METARECORD *mr, DWORD rlen)
* MFDRV_MetaParam0 * MFDRV_MetaParam0
*/ */
BOOL MFDRV_MetaParam0(DC *dc, short func) BOOL MFDRV_MetaParam0(PHYSDEV dev, short func)
{ {
char buffer[8]; char buffer[8];
METARECORD *mr = (METARECORD *)&buffer; METARECORD *mr = (METARECORD *)&buffer;
mr->rdSize = 3; mr->rdSize = 3;
mr->rdFunction = func; mr->rdFunction = func;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
/****************************************************************** /******************************************************************
* MFDRV_MetaParam1 * MFDRV_MetaParam1
*/ */
BOOL MFDRV_MetaParam1(DC *dc, short func, short param1) BOOL MFDRV_MetaParam1(PHYSDEV dev, short func, short param1)
{ {
char buffer[8]; char buffer[8];
METARECORD *mr = (METARECORD *)&buffer; METARECORD *mr = (METARECORD *)&buffer;
@ -426,14 +436,14 @@ BOOL MFDRV_MetaParam1(DC *dc, short func, short param1)
mr->rdSize = 4; mr->rdSize = 4;
mr->rdFunction = func; mr->rdFunction = func;
*(mr->rdParm) = param1; *(mr->rdParm) = param1;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
/****************************************************************** /******************************************************************
* MFDRV_MetaParam2 * MFDRV_MetaParam2
*/ */
BOOL MFDRV_MetaParam2(DC *dc, short func, short param1, short param2) BOOL MFDRV_MetaParam2(PHYSDEV dev, short func, short param1, short param2)
{ {
char buffer[10]; char buffer[10];
METARECORD *mr = (METARECORD *)&buffer; METARECORD *mr = (METARECORD *)&buffer;
@ -442,7 +452,7 @@ BOOL MFDRV_MetaParam2(DC *dc, short func, short param1, short param2)
mr->rdFunction = func; mr->rdFunction = func;
*(mr->rdParm) = param2; *(mr->rdParm) = param2;
*(mr->rdParm + 1) = param1; *(mr->rdParm + 1) = param1;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
@ -450,7 +460,7 @@ BOOL MFDRV_MetaParam2(DC *dc, short func, short param1, short param2)
* MFDRV_MetaParam4 * MFDRV_MetaParam4
*/ */
BOOL MFDRV_MetaParam4(DC *dc, short func, short param1, short param2, BOOL MFDRV_MetaParam4(PHYSDEV dev, short func, short param1, short param2,
short param3, short param4) short param3, short param4)
{ {
char buffer[14]; char buffer[14];
@ -462,7 +472,7 @@ BOOL MFDRV_MetaParam4(DC *dc, short func, short param1, short param2,
*(mr->rdParm + 1) = param3; *(mr->rdParm + 1) = param3;
*(mr->rdParm + 2) = param2; *(mr->rdParm + 2) = param2;
*(mr->rdParm + 3) = param1; *(mr->rdParm + 3) = param1;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
@ -470,7 +480,7 @@ BOOL MFDRV_MetaParam4(DC *dc, short func, short param1, short param2,
* MFDRV_MetaParam6 * MFDRV_MetaParam6
*/ */
BOOL MFDRV_MetaParam6(DC *dc, short func, short param1, short param2, BOOL MFDRV_MetaParam6(PHYSDEV dev, short func, short param1, short param2,
short param3, short param4, short param5, short param6) short param3, short param4, short param5, short param6)
{ {
char buffer[18]; char buffer[18];
@ -484,14 +494,14 @@ BOOL MFDRV_MetaParam6(DC *dc, short func, short param1, short param2,
*(mr->rdParm + 3) = param3; *(mr->rdParm + 3) = param3;
*(mr->rdParm + 4) = param2; *(mr->rdParm + 4) = param2;
*(mr->rdParm + 5) = param1; *(mr->rdParm + 5) = param1;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
/****************************************************************** /******************************************************************
* MFDRV_MetaParam8 * MFDRV_MetaParam8
*/ */
BOOL MFDRV_MetaParam8(DC *dc, short func, short param1, short param2, BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2,
short param3, short param4, short param5, short param3, short param4, short param5,
short param6, short param7, short param8) short param6, short param7, short param8)
{ {
@ -508,7 +518,7 @@ BOOL MFDRV_MetaParam8(DC *dc, short func, short param1, short param2,
*(mr->rdParm + 5) = param3; *(mr->rdParm + 5) = param3;
*(mr->rdParm + 6) = param2; *(mr->rdParm + 6) = param2;
*(mr->rdParm + 7) = param1; *(mr->rdParm + 7) = param1;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2); return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
} }
@ -519,9 +529,9 @@ BOOL MFDRV_MetaParam8(DC *dc, short func, short param1, short param2,
* 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 MFDRV_AddHandleDC( DC *dc ) int MFDRV_AddHandleDC( PHYSDEV dev )
{ {
METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dc->physDev; METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
physDev->mh->mtNoObjects++; physDev->mh->mtNoObjects++;
return physDev->nextHandle++; return physDev->nextHandle++;
} }

View File

@ -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 )
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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,
/*********************************************************************** /***********************************************************************
* 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;
} }

View File

@ -29,120 +29,125 @@
typedef struct typedef struct
{ {
HDC hdc;
DC *dc;
METAHEADER *mh; /* Pointer to metafile header */ METAHEADER *mh; /* Pointer to metafile header */
UINT nextHandle; /* Next handle number */ UINT nextHandle; /* Next handle number */
HFILE hFile; /* HFILE for disk based MetaFile */ HFILE hFile; /* HFILE for disk based MetaFile */
} METAFILEDRV_PDEVICE; } METAFILEDRV_PDEVICE;
extern BOOL MFDRV_MetaParam0(DC *dc, short func); extern BOOL MFDRV_MetaParam0(PHYSDEV dev, short func);
extern BOOL MFDRV_MetaParam1(DC *dc, short func, short param1); extern BOOL MFDRV_MetaParam1(PHYSDEV dev, short func, short param1);
extern BOOL MFDRV_MetaParam2(DC *dc, short func, short param1, short param2); extern BOOL MFDRV_MetaParam2(PHYSDEV dev, short func, short param1, short param2);
extern BOOL MFDRV_MetaParam4(DC *dc, short func, short param1, short param2, extern BOOL MFDRV_MetaParam4(PHYSDEV dev, short func, short param1, short param2,
short param3, short param4); short param3, short param4);
extern BOOL MFDRV_MetaParam6(DC *dc, short func, short param1, short param2, extern BOOL MFDRV_MetaParam6(PHYSDEV dev, short func, short param1, short param2,
short param3, short param4, short param5, short param3, short param4, short param5,
short param6); short param6);
extern BOOL MFDRV_MetaParam8(DC *dc, short func, short param1, short param2, extern BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2,
short param3, short param4, short param5, short param3, short param4, short param5,
short param6, short param7, short param8); short param6, short param7, short param8);
extern BOOL MFDRV_WriteRecord(DC *dc, METARECORD *mr, DWORD rlen); extern BOOL MFDRV_WriteRecord(PHYSDEV dev, METARECORD *mr, DWORD rlen);
extern int MFDRV_AddHandleDC( DC *dc ); extern int MFDRV_AddHandleDC( PHYSDEV dev );
extern INT16 MFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush ); extern INT16 MFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush );
/* Metafile driver functions */ /* Metafile driver functions */
extern BOOL MFDRV_AbortPath( DC *dc ); extern BOOL MFDRV_AbortPath( PHYSDEV dev );
extern BOOL MFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom, extern BOOL MFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ); INT xstart, INT ystart, INT xend, INT yend );
extern BOOL MFDRV_BeginPath( DC *dc ); extern BOOL MFDRV_BeginPath( PHYSDEV dev );
extern BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width, extern BOOL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width,
INT height, DC *dcSrc, INT xSrc, INT ySrc, INT height, PHYSDEV devSrc, INT xSrc, INT ySrc,
DWORD rop ); DWORD rop );
extern BOOL MFDRV_Chord( DC *dc, INT left, INT top, INT right, extern BOOL MFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL MFDRV_CloseFigure( DC *dc ); extern BOOL MFDRV_CloseFigure( PHYSDEV dev );
extern BOOL MFDRV_Ellipse( DC *dc, INT left, INT top, extern BOOL MFDRV_Ellipse( PHYSDEV dev, INT left, INT top,
INT right, INT bottom ); INT right, INT bottom );
extern BOOL MFDRV_EndPath( DC *dc ); extern BOOL MFDRV_EndPath( PHYSDEV dev );
extern INT MFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT extern INT MFDRV_ExcludeClipRect( PHYSDEV dev, INT left, INT top, INT right, INT
bottom ); bottom );
extern BOOL MFDRV_ExtFloodFill( DC *dc, INT x, INT y, extern BOOL MFDRV_ExtFloodFill( PHYSDEV dev, INT x, INT y,
COLORREF color, UINT fillType ); COLORREF color, UINT fillType );
extern BOOL MFDRV_ExtTextOut( DC *dc, INT x, INT y, extern BOOL MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y,
UINT flags, const RECT *lprect, LPCWSTR str, UINT flags, const RECT *lprect, LPCWSTR str,
UINT count, const INT *lpDx ); UINT count, const INT *lpDx );
extern BOOL MFDRV_FillPath( DC *dc ); extern BOOL MFDRV_FillPath( PHYSDEV dev );
extern BOOL MFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush ); extern BOOL MFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush );
extern BOOL MFDRV_FlattenPath( DC *dc ); extern BOOL MFDRV_FlattenPath( PHYSDEV dev );
extern BOOL MFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT x, INT y ); extern BOOL MFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT x, INT y );
extern INT MFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT extern INT MFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT
bottom ); bottom );
extern BOOL MFDRV_InvertRgn( DC *dc, HRGN hrgn ); extern BOOL MFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn );
extern BOOL MFDRV_LineTo( DC *dc, INT x, INT y ); extern BOOL MFDRV_LineTo( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_MoveTo( DC *dc, INT x, INT y ); extern BOOL MFDRV_MoveTo( PHYSDEV dev, INT x, INT y );
extern INT MFDRV_OffsetClipRgn( DC *dc, INT x, INT y ); extern INT MFDRV_OffsetClipRgn( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_OffsetViewportOrg( DC *dc, INT x, INT y ); extern BOOL MFDRV_OffsetViewportOrg( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_OffsetWindowOrg( DC *dc, INT x, INT y ); extern BOOL MFDRV_OffsetWindowOrg( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_PaintRgn( DC *dc, HRGN hrgn ); extern BOOL MFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn );
extern BOOL MFDRV_PatBlt( DC *dc, INT left, INT top, INT width, INT height, extern BOOL MFDRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height,
DWORD rop ); DWORD rop );
extern BOOL MFDRV_Pie( DC *dc, INT left, INT top, INT right, extern BOOL MFDRV_Pie( PHYSDEV dev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL MFDRV_PolyBezier( DC *dc, const POINT* pt, DWORD count ); extern BOOL MFDRV_PolyBezier( PHYSDEV dev, const POINT* pt, DWORD count );
extern BOOL MFDRV_PolyBezierTo( DC *dc, const POINT* pt, DWORD count ); extern BOOL MFDRV_PolyBezierTo( PHYSDEV dev, const POINT* pt, DWORD count );
extern BOOL MFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, extern BOOL MFDRV_PolyPolygon( PHYSDEV dev, const POINT* pt, const INT* counts,
UINT polygons); UINT polygons);
extern BOOL MFDRV_Polygon( DC *dc, const POINT* pt, INT count ); extern BOOL MFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count );
extern BOOL MFDRV_Polyline( DC *dc, const POINT* pt,INT count); extern BOOL MFDRV_Polyline( PHYSDEV dev, const POINT* pt,INT count);
extern BOOL MFDRV_Rectangle( DC *dc, INT left, INT top, extern BOOL MFDRV_Rectangle( PHYSDEV dev, INT left, INT top,
INT right, INT bottom); INT right, INT bottom);
extern BOOL MFDRV_RestoreDC( DC *dc, INT level ); extern BOOL MFDRV_RestoreDC( PHYSDEV dev, INT level );
extern BOOL MFDRV_RoundRect( DC *dc, INT left, INT top, extern BOOL MFDRV_RoundRect( PHYSDEV dev, INT left, INT top,
INT right, INT bottom, INT ell_width, INT right, INT bottom, INT ell_width,
INT ell_height ); INT ell_height );
extern INT MFDRV_SaveDC( DC *dc ); extern INT MFDRV_SaveDC( PHYSDEV dev );
extern BOOL MFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, INT yNum, extern BOOL MFDRV_ScaleViewportExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum,
INT yDenom ); INT yDenom );
extern BOOL MFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, INT yNum, extern BOOL MFDRV_ScaleWindowExt( PHYSDEV dev, INT xNum, INT xDenom, INT yNum,
INT yDenom ); INT yDenom );
extern BOOL MFDRV_SelectClipPath( DC *dc, INT iMode ); extern HBITMAP MFDRV_SelectBitmap( PHYSDEV dev, HBITMAP handle );
extern HGDIOBJ MFDRV_SelectObject( DC *dc, HGDIOBJ handle ); extern HBRUSH MFDRV_SelectBrush( PHYSDEV dev, HBRUSH handle );
extern COLORREF MFDRV_SetBkColor( DC *dc, COLORREF color ); extern BOOL MFDRV_SelectClipPath( PHYSDEV dev, INT iMode );
extern INT MFDRV_SetBkMode( DC *dc, INT mode ); extern HFONT MFDRV_SelectFont( PHYSDEV dev, HFONT handle );
extern INT MFDRV_SetMapMode( DC *dc, INT mode ); extern HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN handle );
extern DWORD MFDRV_SetMapperFlags( DC *dc, DWORD flags ); extern COLORREF MFDRV_SetBkColor( PHYSDEV dev, COLORREF color );
extern COLORREF MFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ); extern INT MFDRV_SetBkMode( PHYSDEV dev, INT mode );
extern INT MFDRV_SetPolyFillMode( DC *dc, INT mode ); extern INT MFDRV_SetMapMode( PHYSDEV dev, INT mode );
extern INT MFDRV_SetROP2( DC *dc, INT rop ); extern DWORD MFDRV_SetMapperFlags( PHYSDEV dev, DWORD flags );
extern INT MFDRV_SetRelAbs( DC *dc, INT mode ); extern COLORREF MFDRV_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color );
extern INT MFDRV_SetStretchBltMode( DC *dc, INT mode ); extern INT MFDRV_SetPolyFillMode( PHYSDEV dev, INT mode );
extern UINT MFDRV_SetTextAlign( DC *dc, UINT align ); extern INT MFDRV_SetROP2( PHYSDEV dev, INT rop );
extern INT MFDRV_SetTextCharacterExtra( DC *dc, INT extra ); extern INT MFDRV_SetRelAbs( PHYSDEV dev, INT mode );
extern COLORREF MFDRV_SetTextColor( DC *dc, COLORREF color ); extern INT MFDRV_SetStretchBltMode( PHYSDEV dev, INT mode );
extern INT MFDRV_SetTextJustification( DC *dc, INT extra, INT breaks ); extern UINT MFDRV_SetTextAlign( PHYSDEV dev, UINT align );
extern BOOL MFDRV_SetViewportExt( DC *dc, INT x, INT y ); extern INT MFDRV_SetTextCharacterExtra( PHYSDEV dev, INT extra );
extern BOOL MFDRV_SetViewportOrg( DC *dc, INT x, INT y ); extern COLORREF MFDRV_SetTextColor( PHYSDEV dev, COLORREF color );
extern BOOL MFDRV_SetWindowExt( DC *dc, INT x, INT y ); extern INT MFDRV_SetTextJustification( PHYSDEV dev, INT extra, INT breaks );
extern BOOL MFDRV_SetWindowOrg( DC *dc, INT x, INT y ); extern BOOL MFDRV_SetViewportExt( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst, extern BOOL MFDRV_SetViewportOrg( PHYSDEV dev, INT x, INT y );
INT heightDst, DC *dcSrc, INT xSrc, INT ySrc, extern BOOL MFDRV_SetWindowExt( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_SetWindowOrg( PHYSDEV dev, INT x, INT y );
extern BOOL MFDRV_StretchBlt( PHYSDEV devDst, INT xDst, INT yDst, INT widthDst,
INT heightDst, PHYSDEV devSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop ); INT widthSrc, INT heightSrc, DWORD rop );
extern BOOL MFDRV_PaintRgn( DC *dc, HRGN hrgn ); extern BOOL MFDRV_PaintRgn( PHYSDEV dev, HRGN hrgn );
extern INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx, extern INT MFDRV_SetDIBitsToDevice( PHYSDEV dev, 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 );
extern INT MFDRV_StretchDIBits( DC *dc, INT xDst, INT yDst, INT widthDst, extern INT MFDRV_StretchDIBits( PHYSDEV dev, 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, const BITMAPINFO *info, UINT wUsage,
DWORD dwRop ); DWORD dwRop );
extern BOOL MFDRV_StrokeAndFillPath( DC *dc ); extern BOOL MFDRV_StrokeAndFillPath( PHYSDEV dev );
extern BOOL MFDRV_StrokePath( DC *dc ); extern BOOL MFDRV_StrokePath( PHYSDEV dev );
extern BOOL MFDRV_WidenPath( DC *dc ); extern BOOL MFDRV_WidenPath( PHYSDEV dev );
#endif /* __WINE_METAFILEDRV_H */ #endif /* __WINE_METAFILEDRV_H */

View File

@ -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 )
* 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 )
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 )
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:
/*********************************************************************** /***********************************************************************
* 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)
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)
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;
} }

View File

@ -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,
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,
* 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,
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;

View File

@ -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)
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)
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)
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)
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;
} }

View File

@ -1,58 +0,0 @@
/*
* 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;
}

View File

@ -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,
/*********************************************************************** /***********************************************************************
* 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 )
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)
/*********************************************************************** /***********************************************************************
* 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,

View File

@ -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 )
* 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)
* 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 )
* 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 )
* 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);

View File

@ -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 =
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 =
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,
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,
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,
/*********************************************************************** /***********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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

View File

@ -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;
} }
return 0;
/***********************************************************************
* 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);
}
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;
} }

View File

@ -1,61 +0,0 @@
/*
* 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;
}

View File

@ -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;

View File

@ -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,
/* 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,
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
*/ */

View File

@ -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
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)
* 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;
} }

View File

@ -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 */
*/ */
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,
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,
/*********************************************************************** /***********************************************************************
* 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)
/*********************************************************************** /***********************************************************************
* 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 )
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 )
/*********************************************************************** /***********************************************************************
* 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);
} }

View File

@ -30,69 +30,63 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Arc * TTYDRV_DC_Arc
*/ */
BOOL TTYDRV_DC_Arc(DC *dc, INT left, INT top, INT right, INT bottom, BOOL TTYDRV_DC_Arc(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend) INT xstart, INT ystart, INT xend, INT yend)
{ {
FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n", FIXME("(%x, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
dc, left, top, right, bottom, xstart, ystart, xend, yend); physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Chord * TTYDRV_DC_Chord
*/ */
BOOL TTYDRV_DC_Chord(DC *dc, INT left, INT top, INT right, INT bottom, BOOL TTYDRV_DC_Chord(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend) INT xstart, INT ystart, INT xend, INT yend)
{ {
FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n", FIXME("(%x, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
dc, left, top, right, bottom, xstart, ystart, xend, yend); physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Ellipse * TTYDRV_DC_Ellipse
*/ */
BOOL TTYDRV_DC_Ellipse(DC *dc, INT left, INT top, INT right, INT bottom) BOOL TTYDRV_DC_Ellipse(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
{ {
FIXME("(%p, %d, %d, %d, %d): stub\n", FIXME("(%x, %d, %d, %d, %d): stub\n", physDev->hdc, left, top, right, bottom);
dc, left, top, right, bottom);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_ExtFloodFill * TTYDRV_DC_ExtFloodFill
*/ */
BOOL TTYDRV_DC_ExtFloodFill(DC *dc, INT x, INT y, BOOL TTYDRV_DC_ExtFloodFill(TTYDRV_PDEVICE *physDev, INT x, INT y,
COLORREF color, UINT fillType) COLORREF color, UINT fillType)
{ {
FIXME("(%p, %d, %d, 0x%08lx, %u): stub\n", dc, x, y, color, fillType); FIXME("(%x, %d, %d, 0x%08lx, %u): stub\n", physDev->hdc, x, y, color, fillType);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_GetPixel * TTYDRV_DC_GetPixel
*/ */
COLORREF TTYDRV_DC_GetPixel(DC *dc, INT x, INT y) COLORREF TTYDRV_DC_GetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y)
{ {
FIXME("(%p, %d, %d): stub\n", dc, x, y); FIXME("(%x, %d, %d): stub\n", physDev->hdc, x, y);
return RGB(0,0,0); /* FIXME: Always returns black */ return RGB(0,0,0); /* FIXME: Always returns black */
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_LineTo * TTYDRV_DC_LineTo
*/ */
BOOL TTYDRV_DC_LineTo(DC *dc, INT x, INT y) BOOL TTYDRV_DC_LineTo(TTYDRV_PDEVICE *physDev, INT x, INT y)
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
INT row1, col1, row2, col2; INT row1, col1, row2, col2;
DC *dc = physDev->dc;
TRACE("(%p, %d, %d)\n", dc, x, y); TRACE("(%x, %d, %d)\n", physDev->hdc, x, y);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
@ -126,7 +120,7 @@ BOOL TTYDRV_DC_LineTo(DC *dc, INT x, INT y)
return TRUE; return TRUE;
#else /* defined(WINE_CURSES) */ #else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d): stub\n", dc, x, y); FIXME("(%x, %d, %d): stub\n", physDev->hdc, x, y);
return TRUE; return TRUE;
#endif /* defined(WINE_CURSES) */ #endif /* defined(WINE_CURSES) */
@ -135,61 +129,56 @@ BOOL TTYDRV_DC_LineTo(DC *dc, INT x, INT y)
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_PaintRgn * TTYDRV_DC_PaintRgn
*/ */
BOOL TTYDRV_DC_PaintRgn(DC *dc, HRGN hrgn) BOOL TTYDRV_DC_PaintRgn(TTYDRV_PDEVICE *physDev, HRGN hrgn)
{ {
FIXME("(%p, 0x%04x): stub\n", dc, hrgn); FIXME("(%x, 0x%04x): stub\n", physDev->hdc, hrgn);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Pie * TTYDRV_DC_Pie
*/ */
BOOL TTYDRV_DC_Pie(DC *dc, INT left, INT top, INT right, INT bottom, BOOL TTYDRV_DC_Pie(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend) INT xstart, INT ystart, INT xend, INT yend)
{ {
FIXME("(%p, %d, %d, %d, %d, %d, %d, %d, %d): stub\n", FIXME("(%x, %d, %d, %d, %d, %d, %d, %d, %d): stub\n",
dc, left, top, right, bottom, xstart, ystart, xend, yend); physDev->hdc, left, top, right, bottom, xstart, ystart, xend, yend);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Polygon * TTYDRV_DC_Polygon
*/ */
BOOL TTYDRV_DC_Polygon(DC *dc, const POINT* pt, INT count) BOOL TTYDRV_DC_Polygon(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count)
{ {
FIXME("(%p, %p, %d): stub\n", dc, pt, count); FIXME("(%x, %p, %d): stub\n", physDev->hdc, pt, count);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Polyline * TTYDRV_DC_Polyline
*/ */
BOOL TTYDRV_DC_Polyline(DC *dc, const POINT* pt, INT count) BOOL TTYDRV_DC_Polyline(TTYDRV_PDEVICE *physDev, const POINT* pt, INT count)
{ {
FIXME("(%p, %p, %d): stub\n", dc, pt, count); FIXME("(%x, %p, %d): stub\n", physDev->hdc, pt, count);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_PolyPolygon * TTYDRV_DC_PolyPolygon
*/ */
BOOL TTYDRV_DC_PolyPolygon(DC *dc, const POINT* pt, const INT* counts, UINT polygons) BOOL TTYDRV_DC_PolyPolygon(TTYDRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons)
{ {
FIXME("(%p, %p, %p, %u): stub\n", dc, pt, counts, polygons); FIXME("(%x, %p, %p, %u): stub\n", physDev->hdc, pt, counts, polygons);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_PolyPolyline * TTYDRV_DC_PolyPolyline
*/ */
BOOL TTYDRV_DC_PolyPolyline(DC *dc, const POINT* pt, const DWORD* counts, DWORD polylines) BOOL TTYDRV_DC_PolyPolyline(TTYDRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines)
{ {
FIXME("(%p, %p, %p, %lu): stub\n", dc, pt, counts, polylines); FIXME("(%x, %p, %p, %lu): stub\n", physDev->hdc, pt, counts, polylines);
return TRUE; return TRUE;
} }
@ -197,13 +186,13 @@ BOOL TTYDRV_DC_PolyPolyline(DC *dc, const POINT* pt, const DWORD* counts, DWORD
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_Rectangle * TTYDRV_DC_Rectangle
*/ */
BOOL TTYDRV_DC_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) BOOL TTYDRV_DC_Rectangle(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
INT row1, col1, row2, col2; INT row1, col1, row2, col2;
DC *dc = physDev->dc;
TRACE("(%p, %d, %d, %d, %d)\n", dc, left, top, right, bottom); TRACE("(%x, %d, %d, %d, %d)\n", physDev->hdc, left, top, right, bottom);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
@ -245,7 +234,7 @@ BOOL TTYDRV_DC_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
return TRUE; return TRUE;
#else /* defined(WINE_CURSES) */ #else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d, %d, %d): stub\n", dc, left, top, right, bottom); FIXME("(%x, %d, %d, %d, %d): stub\n", physDev->hdc, left, top, right, bottom);
return TRUE; return TRUE;
#endif /* defined(WINE_CURSES) */ #endif /* defined(WINE_CURSES) */
@ -254,40 +243,25 @@ BOOL TTYDRV_DC_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_RoundRect * TTYDRV_DC_RoundRect
*/ */
BOOL TTYDRV_DC_RoundRect(DC *dc, INT left, INT top, INT right, BOOL TTYDRV_DC_RoundRect(TTYDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height) INT bottom, INT ell_width, INT ell_height)
{ {
FIXME("(%p, %d, %d, %d, %d, %d, %d): stub\n", FIXME("(%x, %d, %d, %d, %d, %d, %d): stub\n",
dc, left, top, right, bottom, ell_width, ell_height); physDev->hdc, left, top, right, bottom, ell_width, ell_height);
return TRUE; return TRUE;
} }
/***********************************************************************
* TTYDRV_DC_SetBkColor
*/
COLORREF TTYDRV_DC_SetBkColor(DC *dc, COLORREF color)
{
COLORREF oldColor;
TRACE("(%p, 0x%08lx)\n", dc, color);
oldColor = dc->backgroundColor;
dc->backgroundColor = color;
return oldColor;
}
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_SetPixel * TTYDRV_DC_SetPixel
*/ */
COLORREF TTYDRV_DC_SetPixel(DC *dc, INT x, INT y, COLORREF color) COLORREF TTYDRV_DC_SetPixel(TTYDRV_PDEVICE *physDev, INT x, INT y, COLORREF color)
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
INT row, col; INT row, col;
DC *dc = physDev->dc;
TRACE("(%p, %d, %d, 0x%08lx)\n", dc, x, y, color); TRACE("(%x, %d, %d, 0x%08lx)\n", physDev->hdc, x, y, color);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
@ -300,69 +274,45 @@ COLORREF TTYDRV_DC_SetPixel(DC *dc, INT x, INT y, COLORREF color)
return RGB(0,0,0); /* FIXME: Always returns black */ return RGB(0,0,0); /* FIXME: Always returns black */
#else /* defined(WINE_CURSES) */ #else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d, 0x%08lx): stub\n", dc, x, y, color); FIXME("(%x, %d, %d, 0x%08lx): stub\n", physDev->hdc, x, y, color);
return RGB(0,0,0); /* FIXME: Always returns black */ return RGB(0,0,0); /* FIXME: Always returns black */
#endif /* defined(WINE_CURSES) */ #endif /* defined(WINE_CURSES) */
} }
/***********************************************************************
* TTYDRV_DC_SetTextColor
*/
COLORREF TTYDRV_DC_SetTextColor(DC *dc, COLORREF color)
{
COLORREF oldColor;
TRACE("(%p, 0x%08lx)\n", dc, color);
oldColor = dc->textColor;
dc->textColor = color;
return oldColor;
}
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_BitBlt * TTYDRV_DC_BitBlt
*/ */
BOOL TTYDRV_DC_BitBlt(DC *dcDst, INT xDst, INT yDst, BOOL TTYDRV_DC_BitBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT width, INT height, DC *dcSrc, INT width, INT height, TTYDRV_PDEVICE *physDevSrc,
INT xSrc, INT ySrc, DWORD rop) INT xSrc, INT ySrc, DWORD rop)
{ {
FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %lu): stub\n", FIXME("(%x, %d, %d, %d, %d, %x, %d, %d, %lu): stub\n",
dcDst, xDst, yDst, width, height, physDevDst->hdc, xDst, yDst, width, height, physDevSrc->hdc, xSrc, ySrc, rop );
dcSrc, xSrc, ySrc, rop
);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_PatBlt * TTYDRV_DC_PatBlt
*/ */
BOOL TTYDRV_DC_PatBlt(DC *dc, INT left, INT top, BOOL TTYDRV_DC_PatBlt(TTYDRV_PDEVICE *physDev, INT left, INT top,
INT width, INT height, DWORD rop) INT width, INT height, DWORD rop)
{ {
FIXME("(%p, %d, %d, %d, %d, %lu): stub\n", FIXME("(%x, %d, %d, %d, %d, %lu): stub\n", physDev->hdc, left, top, width, height, rop );
dc, left, top, width, height, rop
);
return TRUE; return TRUE;
} }
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_StretchBlt * TTYDRV_DC_StretchBlt
*/ */
BOOL TTYDRV_DC_StretchBlt(DC *dcDst, INT xDst, INT yDst, BOOL TTYDRV_DC_StretchBlt(TTYDRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthDst, INT heightDst,
DC *dcSrc, INT xSrc, INT ySrc, TTYDRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop) INT widthSrc, INT heightSrc, DWORD rop)
{ {
FIXME("(%p, %d, %d, %d, %d, %p, %d, %d, %d, %d, %lu): stub\n", FIXME("(%x, %d, %d, %d, %d, %x, %d, %d, %d, %d, %lu): stub\n",
dcDst, xDst, yDst, widthDst, heightDst, physDevDst->hdc, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop physDevSrc->hdc, xSrc, ySrc, widthSrc, heightSrc, rop );
);
return TRUE; return TRUE;
} }
@ -370,18 +320,18 @@ BOOL TTYDRV_DC_StretchBlt(DC *dcDst, INT xDst, INT yDst,
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_ExtTextOut * TTYDRV_DC_ExtTextOut
*/ */
BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags, BOOL TTYDRV_DC_ExtTextOut(TTYDRV_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)
{ {
#ifdef WINE_CURSES #ifdef WINE_CURSES
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
INT row, col; INT row, col;
LPSTR ascii; LPSTR ascii;
DWORD len; DWORD len;
DC *dc = physDev->dc;
TRACE("(%p, %d, %d, 0x%08x, %p, %s, %d, %p)\n", TRACE("(%x, %d, %d, 0x%08x, %p, %s, %d, %p)\n",
dc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx); physDev->hdc, x, y, flags, lpRect, debugstr_wn(str, count), count, lpDx);
if(!physDev->window) if(!physDev->window)
return FALSE; return FALSE;
@ -411,8 +361,8 @@ BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
return TRUE; return TRUE;
#else /* defined(WINE_CURSES) */ #else /* defined(WINE_CURSES) */
FIXME("(%p, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n", FIXME("(%x, %d, %d, 0x%08x, %p, %s, %d, %p): stub\n",
dc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx); physDev->hdc, x, y, flags, lpRect, debugstr_wn(str,count), count, lpDx);
return TRUE; return TRUE;
#endif /* defined(WINE_CURSES) */ #endif /* defined(WINE_CURSES) */
@ -421,13 +371,12 @@ BOOL TTYDRV_DC_ExtTextOut(DC *dc, INT x, INT y, UINT flags,
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_GetCharWidth * TTYDRV_DC_GetCharWidth
*/ */
BOOL TTYDRV_DC_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar, BOOL TTYDRV_DC_GetCharWidth(TTYDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
LPINT buffer) LPINT buffer)
{ {
UINT c; UINT c;
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
FIXME("(%p, %u, %u, %p): semistub\n", dc, firstChar, lastChar, buffer); FIXME("(%x, %u, %u, %p): semistub\n", physDev->hdc, firstChar, lastChar, buffer);
for(c=firstChar; c<=lastChar; c++) { for(c=firstChar; c<=lastChar; c++) {
buffer[c-firstChar] = physDev->cellWidth; buffer[c-firstChar] = physDev->cellWidth;
@ -439,12 +388,10 @@ BOOL TTYDRV_DC_GetCharWidth(DC *dc, UINT firstChar, UINT lastChar,
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_GetTextExtentPoint * TTYDRV_DC_GetTextExtentPoint
*/ */
BOOL TTYDRV_DC_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count, BOOL TTYDRV_DC_GetTextExtentPoint(TTYDRV_PDEVICE *physDev, LPCWSTR str, INT count,
LPSIZE size) LPSIZE size)
{ {
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev; TRACE("(%x, %s, %d, %p)\n", physDev->hdc, debugstr_wn(str, count), count, size);
TRACE("(%p, %s, %d, %p)\n", dc, debugstr_wn(str, count), count, size);
size->cx = count * physDev->cellWidth; size->cx = count * physDev->cellWidth;
size->cy = physDev->cellHeight; size->cy = physDev->cellHeight;
@ -455,11 +402,9 @@ BOOL TTYDRV_DC_GetTextExtentPoint(DC *dc, LPCWSTR str, INT count,
/*********************************************************************** /***********************************************************************
* TTYDRV_DC_GetTextMetrics * TTYDRV_DC_GetTextMetrics
*/ */
BOOL TTYDRV_DC_GetTextMetrics(DC *dc, LPTEXTMETRICW lptm) BOOL TTYDRV_DC_GetTextMetrics(TTYDRV_PDEVICE *physDev, LPTEXTMETRICW lptm)
{ {
TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev; TRACE("(%x, %p)\n", physDev->hdc, lptm);
TRACE("(%p, %p)\n", dc, lptm);
lptm->tmHeight = physDev->cellHeight; lptm->tmHeight = physDev->cellHeight;
lptm->tmAscent = 0; lptm->tmAscent = 0;

View File

@ -29,88 +29,19 @@ 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
*/ */
@ -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;
} }

View File

@ -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;
* 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 {
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 */

View File

@ -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

View File

@ -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"

View File

@ -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)
{ {
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:

View File

@ -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);
* 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,
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,
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,
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,
* 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,
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,
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;
} }

View File

@ -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 )
} }
physDev->brush.set = FALSE; physDev->brush.set = FALSE;
return prevbrush; return 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)
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)
* 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)
* 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)
* 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)
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)
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;

View File

@ -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 )
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 )
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 );

View File

@ -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;
} }

View File

@ -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,
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,
/************************************************************************ /************************************************************************
* 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 )
/************************************************************************ /************************************************************************
* 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 )
/************************************************************************ /************************************************************************
* 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 )
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 )
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 )
/************************************************************************ /************************************************************************
* 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 )
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 ) {

View File

@ -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 )
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 )
/*********************************************************************** /***********************************************************************
* 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)
/*********************************************************************** /***********************************************************************
* 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)
/*********************************************************************** /***********************************************************************
* 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)
/*********************************************************************** /***********************************************************************
* 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;
} }

View File

@ -38,16 +38,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(psdrv);
/*********************************************************************** /***********************************************************************
* PSDRV_LineTo * PSDRV_LineTo
*/ */
BOOL PSDRV_LineTo(DC *dc, INT x, INT y) BOOL PSDRV_LineTo(PSDRV_PDEVICE *physDev, INT x, INT y)
{ {
DC *dc = physDev->dc;
TRACE("%d %d\n", x, y); TRACE("%d %d\n", x, y);
PSDRV_SetPen(dc); PSDRV_SetPen(physDev);
PSDRV_WriteMoveTo(dc, INTERNAL_XWPTODP(dc, dc->CursPosX, dc->CursPosY), PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, dc->CursPosX, dc->CursPosY),
INTERNAL_YWPTODP(dc, dc->CursPosX, dc->CursPosY)); INTERNAL_YWPTODP(dc, dc->CursPosX, dc->CursPosY));
PSDRV_WriteLineTo(dc, INTERNAL_XWPTODP(dc, x, y), PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, x, y),
INTERNAL_YWPTODP(dc, x, y)); INTERNAL_YWPTODP(dc, x, y));
PSDRV_DrawLine(dc); PSDRV_DrawLine(physDev);
return TRUE; return TRUE;
} }
@ -56,21 +58,20 @@ BOOL PSDRV_LineTo(DC *dc, INT x, INT y)
/*********************************************************************** /***********************************************************************
* PSDRV_Rectangle * PSDRV_Rectangle
*/ */
BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right, BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom )
INT bottom )
{ {
INT width; INT width;
INT height; INT height;
DC *dc = physDev->dc;
TRACE("%d %d - %d %d\n", left, top, right, bottom); TRACE("%d %d - %d %d\n", left, top, right, bottom);
width = INTERNAL_XWSTODS(dc, right - left); width = INTERNAL_XWSTODS(dc, right - left);
height = INTERNAL_YWSTODS(dc, bottom - top); height = INTERNAL_YWSTODS(dc, bottom - top);
PSDRV_WriteRectangle(dc, INTERNAL_XWPTODP(dc, left, top), PSDRV_WriteRectangle(physDev, INTERNAL_XWPTODP(dc, left, top),
INTERNAL_YWPTODP(dc, left, top), INTERNAL_YWPTODP(dc, left, top), width, height);
width, height); PSDRV_Brush(physDev,0);
PSDRV_Brush(dc,0); PSDRV_SetPen(physDev);
PSDRV_SetPen(dc); PSDRV_DrawLine(physDev);
PSDRV_DrawLine(dc);
return TRUE; return TRUE;
} }
@ -78,9 +79,11 @@ BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right,
/*********************************************************************** /***********************************************************************
* PSDRV_RoundRect * PSDRV_RoundRect
*/ */
BOOL PSDRV_RoundRect( DC *dc, INT left, INT top, INT right, BOOL PSDRV_RoundRect( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height ) INT bottom, INT ell_width, INT ell_height )
{ {
DC *dc = physDev->dc;
left = XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = XLPTODP( dc, right ); right = XLPTODP( dc, right );
top = YLPTODP( dc, top ); top = YLPTODP( dc, top );
@ -94,23 +97,23 @@ BOOL PSDRV_RoundRect( DC *dc, INT left, INT top, INT right,
if(ell_width > right - left) ell_width = right - left; if(ell_width > right - left) ell_width = right - left;
if(ell_height > bottom - top) ell_height = bottom - top; if(ell_height > bottom - top) ell_height = bottom - top;
PSDRV_WriteMoveTo( dc, left, top + ell_height/2 ); PSDRV_WriteMoveTo( physDev, left, top + ell_height/2 );
PSDRV_WriteArc( dc, left + ell_width/2, top + ell_height/2, ell_width, PSDRV_WriteArc( physDev, left + ell_width/2, top + ell_height/2, ell_width,
ell_height, 90.0, 180.0); ell_height, 90.0, 180.0);
PSDRV_WriteLineTo( dc, right - ell_width/2, top ); PSDRV_WriteLineTo( physDev, right - ell_width/2, top );
PSDRV_WriteArc( dc, right - ell_width/2, top + ell_height/2, ell_width, PSDRV_WriteArc( physDev, right - ell_width/2, top + ell_height/2, ell_width,
ell_height, 0.0, 90.0); ell_height, 0.0, 90.0);
PSDRV_WriteLineTo( dc, right, bottom - ell_height/2 ); PSDRV_WriteLineTo( physDev, right, bottom - ell_height/2 );
PSDRV_WriteArc( dc, right - ell_width/2, bottom - ell_height/2, ell_width, PSDRV_WriteArc( physDev, right - ell_width/2, bottom - ell_height/2, ell_width,
ell_height, -90.0, 0.0); ell_height, -90.0, 0.0);
PSDRV_WriteLineTo( dc, right - ell_width/2, bottom); PSDRV_WriteLineTo( physDev, right - ell_width/2, bottom);
PSDRV_WriteArc( dc, left + ell_width/2, bottom - ell_height/2, ell_width, PSDRV_WriteArc( physDev, left + ell_width/2, bottom - ell_height/2, ell_width,
ell_height, 180.0, -90.0); ell_height, 180.0, -90.0);
PSDRV_WriteClosePath( dc ); PSDRV_WriteClosePath( physDev );
PSDRV_Brush(dc,0); PSDRV_Brush(physDev,0);
PSDRV_SetPen(dc); PSDRV_SetPen(physDev);
PSDRV_DrawLine(dc); PSDRV_DrawLine(physDev);
return TRUE; return TRUE;
} }
@ -119,12 +122,11 @@ BOOL PSDRV_RoundRect( DC *dc, INT left, INT top, INT right,
* *
* Does the work of Arc, Chord and Pie. lines is 0, 1 or 2 respectively. * Does the work of Arc, Chord and Pie. lines is 0, 1 or 2 respectively.
*/ */
static BOOL PSDRV_DrawArc( DC *dc, INT left, INT top, static BOOL PSDRV_DrawArc( PSDRV_PDEVICE *physDev, INT left, INT top,
INT right, INT bottom, INT right, INT bottom, INT xstart, INT ystart,
INT xstart, INT ystart, INT xend, INT yend, int lines )
INT xend, INT yend,
int lines )
{ {
DC *dc = physDev->dc;
INT x, y, h, w; INT x, y, h, w;
double start_angle, end_angle, ratio; double start_angle, end_angle, ratio;
@ -148,17 +150,17 @@ static BOOL PSDRV_DrawArc( DC *dc, INT left, INT top,
end_angle *= 180.0 / PI; end_angle *= 180.0 / PI;
if(lines == 2) /* pie */ if(lines == 2) /* pie */
PSDRV_WriteMoveTo(dc, x, y); PSDRV_WriteMoveTo(physDev, x, y);
else else
PSDRV_WriteNewPath( dc ); PSDRV_WriteNewPath( physDev );
PSDRV_WriteArc(dc, x, y, w, h, start_angle, end_angle); PSDRV_WriteArc(physDev, x, y, w, h, start_angle, end_angle);
if(lines == 1 || lines == 2) { /* chord or pie */ if(lines == 1 || lines == 2) { /* chord or pie */
PSDRV_WriteClosePath(dc); PSDRV_WriteClosePath(physDev);
PSDRV_Brush(dc,0); PSDRV_Brush(physDev,0);
} }
PSDRV_SetPen(dc); PSDRV_SetPen(physDev);
PSDRV_DrawLine(dc); PSDRV_DrawLine(physDev);
return TRUE; return TRUE;
} }
@ -166,41 +168,39 @@ static BOOL PSDRV_DrawArc( DC *dc, INT left, INT top,
/*********************************************************************** /***********************************************************************
* PSDRV_Arc * PSDRV_Arc
*/ */
BOOL PSDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom, BOOL PSDRV_Arc( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return PSDRV_DrawArc( dc, left, top, right, bottom, xstart, ystart, return PSDRV_DrawArc( physDev, left, top, right, bottom, xstart, ystart, xend, yend, 0 );
xend, yend, 0 );
} }
/*********************************************************************** /***********************************************************************
* PSDRV_Chord * PSDRV_Chord
*/ */
BOOL PSDRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom, BOOL PSDRV_Chord( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return PSDRV_DrawArc( dc, left, top, right, bottom, xstart, ystart, return PSDRV_DrawArc( physDev, left, top, right, bottom, xstart, ystart, xend, yend, 1 );
xend, yend, 1 );
} }
/*********************************************************************** /***********************************************************************
* PSDRV_Pie * PSDRV_Pie
*/ */
BOOL PSDRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom, BOOL PSDRV_Pie( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return PSDRV_DrawArc( dc, left, top, right, bottom, xstart, ystart, return PSDRV_DrawArc( physDev, left, top, right, bottom, xstart, ystart, xend, yend, 2 );
xend, yend, 2 );
} }
/*********************************************************************** /***********************************************************************
* PSDRV_Ellipse * PSDRV_Ellipse
*/ */
BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom) BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
{ {
INT x, y, w, h; INT x, y, w, h;
DC *dc = physDev->dc;
TRACE("%d %d - %d %d\n", left, top, right, bottom); TRACE("%d %d - %d %d\n", left, top, right, bottom);
@ -210,12 +210,12 @@ BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom)
w = XLSTODS(dc, (right - left)); w = XLSTODS(dc, (right - left));
h = YLSTODS(dc, (bottom - top)); h = YLSTODS(dc, (bottom - top));
PSDRV_WriteNewPath(dc); PSDRV_WriteNewPath(physDev);
PSDRV_WriteArc(dc, x, y, w, h, 0.0, 360.0); PSDRV_WriteArc(physDev, x, y, w, h, 0.0, 360.0);
PSDRV_WriteClosePath(dc); PSDRV_WriteClosePath(physDev);
PSDRV_Brush(dc,0); PSDRV_Brush(physDev,0);
PSDRV_SetPen(dc); PSDRV_SetPen(physDev);
PSDRV_DrawLine(dc); PSDRV_DrawLine(physDev);
return TRUE; return TRUE;
} }
@ -223,24 +223,26 @@ BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom)
/*********************************************************************** /***********************************************************************
* PSDRV_PolyPolyline * PSDRV_PolyPolyline
*/ */
BOOL PSDRV_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts, BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD* counts,
DWORD polylines ) DWORD polylines )
{ {
DWORD polyline, line; DWORD polyline, line;
const POINT* pt; const POINT* pt;
DC *dc = physDev->dc;
TRACE("\n"); TRACE("\n");
pt = pts; pt = pts;
for(polyline = 0; polyline < polylines; polyline++) { for(polyline = 0; polyline < polylines; polyline++) {
PSDRV_WriteMoveTo(dc, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y));
pt++; pt++;
for(line = 1; line < counts[polyline]; line++) { for(line = 1; line < counts[polyline]; line++) {
PSDRV_WriteLineTo(dc, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y));
pt++; pt++;
} }
} }
PSDRV_SetPen(dc); PSDRV_SetPen(physDev);
PSDRV_DrawLine(dc); PSDRV_DrawLine(physDev);
return TRUE; return TRUE;
} }
@ -248,39 +250,41 @@ BOOL PSDRV_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts,
/*********************************************************************** /***********************************************************************
* PSDRV_Polyline * PSDRV_Polyline
*/ */
BOOL PSDRV_Polyline( DC *dc, const POINT* pt, INT count ) BOOL PSDRV_Polyline( PSDRV_PDEVICE *physDev, const POINT* pt, INT count )
{ {
return PSDRV_PolyPolyline( dc, pt, (LPDWORD) &count, 1 ); return PSDRV_PolyPolyline( physDev, pt, (LPDWORD) &count, 1 );
} }
/*********************************************************************** /***********************************************************************
* PSDRV_PolyPolygon * PSDRV_PolyPolygon
*/ */
BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts, BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* counts,
UINT polygons ) UINT polygons )
{ {
DWORD polygon, line; DWORD polygon, line;
const POINT* pt; const POINT* pt;
DC *dc = physDev->dc;
TRACE("\n"); TRACE("\n");
pt = pts; pt = pts;
for(polygon = 0; polygon < polygons; polygon++) { for(polygon = 0; polygon < polygons; polygon++) {
PSDRV_WriteMoveTo(dc, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y));
pt++; pt++;
for(line = 1; line < counts[polygon]; line++) { for(line = 1; line < counts[polygon]; line++) {
PSDRV_WriteLineTo(dc, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y)); PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, pt->x, pt->y), INTERNAL_YWPTODP(dc, pt->x, pt->y));
pt++; pt++;
} }
PSDRV_WriteClosePath(dc); PSDRV_WriteClosePath(physDev);
} }
if(dc->polyFillMode == ALTERNATE) if(GetPolyFillMode( physDev->hdc ) == ALTERNATE)
PSDRV_Brush(dc, 1); PSDRV_Brush(physDev, 1);
else /* WINDING */ else /* WINDING */
PSDRV_Brush(dc, 0); PSDRV_Brush(physDev, 0);
PSDRV_SetPen(dc); PSDRV_SetPen(physDev);
PSDRV_DrawLine(dc); PSDRV_DrawLine(physDev);
return TRUE; return TRUE;
} }
@ -288,27 +292,27 @@ BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts,
/*********************************************************************** /***********************************************************************
* PSDRV_Polygon * PSDRV_Polygon
*/ */
BOOL PSDRV_Polygon( DC *dc, const POINT* pt, INT count ) BOOL PSDRV_Polygon( PSDRV_PDEVICE *physDev, const POINT* pt, INT count )
{ {
return PSDRV_PolyPolygon( dc, pt, &count, 1 ); return PSDRV_PolyPolygon( physDev, pt, &count, 1 );
} }
/*********************************************************************** /***********************************************************************
* PSDRV_SetPixel * PSDRV_SetPixel
*/ */
COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ) COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
PSCOLOR pscolor; PSCOLOR pscolor;
DC *dc = physDev->dc;
x = INTERNAL_XWPTODP(dc, x, y); x = INTERNAL_XWPTODP(dc, x, y);
y = INTERNAL_YWPTODP(dc, x, y); y = INTERNAL_YWPTODP(dc, x, y);
PSDRV_WriteRectangle( dc, x, y, 0, 0 ); PSDRV_WriteRectangle( physDev, x, y, 0, 0 );
PSDRV_CreateColor( physDev, &pscolor, color ); PSDRV_CreateColor( physDev, &pscolor, color );
PSDRV_WriteSetColor( dc, &pscolor ); PSDRV_WriteSetColor( physDev, &pscolor );
PSDRV_WriteFill( dc ); PSDRV_WriteFill( physDev );
return color; return color;
} }
@ -316,12 +320,10 @@ COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color )
/*********************************************************************** /***********************************************************************
* PSDRV_DrawLine * PSDRV_DrawLine
*/ */
VOID PSDRV_DrawLine( DC *dc ) VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (physDev->pen.style == PS_NULL) if (physDev->pen.style == PS_NULL)
PSDRV_WriteNewPath(dc); PSDRV_WriteNewPath(physDev);
else else
PSDRV_WriteStroke(dc); PSDRV_WriteStroke(physDev);
} }

View File

@ -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,
/********************************************************************** /**********************************************************************
* 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 )
/*********************************************************************** /***********************************************************************
* 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 )
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;
} }
} }

View File

@ -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;
}

View File

@ -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 )
} }
physDev->pen.set = FALSE; physDev->pen.set = FALSE;
return prevpen; return 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;
} }
} }

View File

@ -188,12 +188,10 @@ static char psarraydef[] =
"/%s %d array def\n"; "/%s %d array def\n";
int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch) int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if(physDev->job.OutOfPage) { /* Will get here after NEWFRAME Escape */ if(physDev->job.OutOfPage) { /* Will get here after NEWFRAME Escape */
if( !PSDRV_StartPage(dc) ) if( !PSDRV_StartPage(physDev) )
return FALSE; return FALSE;
} }
return WriteSpool16( physDev->job.hJob, lpData, cch ); return WriteSpool16( physDev->job.hJob, lpData, cch );
@ -221,9 +219,8 @@ INT PSDRV_WriteFeature(HANDLE16 hJob, char *feature, char *value,
INT PSDRV_WriteHeader( DC *dc, LPCSTR title ) INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf, *orient; char *buf, *orient;
INPUTSLOT *slot; INPUTSLOT *slot;
PAGESIZE *page; PAGESIZE *page;
@ -296,9 +293,8 @@ INT PSDRV_WriteHeader( DC *dc, LPCSTR title )
} }
INT PSDRV_WriteFooter( DC *dc ) INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf; char *buf;
buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psfooter) + 100 ); buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psfooter) + 100 );
@ -321,10 +317,8 @@ INT PSDRV_WriteFooter( DC *dc )
INT PSDRV_WriteEndPage( DC *dc ) INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if( WriteSpool16( physDev->job.hJob, psendpage, sizeof(psendpage)-1 ) != if( WriteSpool16( physDev->job.hJob, psendpage, sizeof(psendpage)-1 ) !=
sizeof(psendpage)-1 ) { sizeof(psendpage)-1 ) {
WARN("WriteSpool error\n"); WARN("WriteSpool error\n");
@ -336,9 +330,8 @@ INT PSDRV_WriteEndPage( DC *dc )
INT PSDRV_WriteNewPage( DC *dc ) INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev )
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf; char *buf;
char name[100]; char name[100];
signed int xtrans, ytrans, rotation; signed int xtrans, ytrans, rotation;
@ -382,49 +375,49 @@ INT PSDRV_WriteNewPage( DC *dc )
} }
BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y) BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y)
{ {
char buf[100]; char buf[100];
sprintf(buf, psmoveto, x, y); sprintf(buf, psmoveto, x, y);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y) BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y)
{ {
char buf[100]; char buf[100];
sprintf(buf, pslineto, x, y); sprintf(buf, pslineto, x, y);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteStroke(DC *dc) BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psstroke, sizeof(psstroke)-1); return PSDRV_WriteSpool(physDev, psstroke, sizeof(psstroke)-1);
} }
BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width, BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
INT height) INT height)
{ {
char buf[100]; char buf[100];
sprintf(buf, psrectangle, x, y, width, height, -width); sprintf(buf, psrectangle, x, y, width, height, -width);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteRRectangle(DC *dc, INT x, INT y, INT width, BOOL PSDRV_WriteRRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
INT height) INT height)
{ {
char buf[100]; char buf[100];
sprintf(buf, psrrectangle, x, y, width, height, -width); sprintf(buf, psrrectangle, x, y, width, height, -width);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h, double ang1, BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h, double ang1,
double ang2) double ang2)
{ {
char buf[256]; char buf[256];
@ -432,12 +425,11 @@ BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h, double ang1,
/* Make angles -ve and swap order because we're working with an upside /* Make angles -ve and swap order because we're working with an upside
down y-axis */ down y-axis */
sprintf(buf, psarc, x, y, w, h, -ang2, -ang1); sprintf(buf, psarc, x, y, w, h, -ang2, -ang1);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteSetFont(DC *dc) BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf; char *buf;
buf = (char *)HeapAlloc( PSDRV_Heap, 0, buf = (char *)HeapAlloc( PSDRV_Heap, 0,
@ -452,14 +444,13 @@ BOOL PSDRV_WriteSetFont(DC *dc)
physDev->font.size, -physDev->font.size, physDev->font.size, -physDev->font.size,
-physDev->font.escapement); -physDev->font.escapement);
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color) BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char buf[256]; char buf[256];
PSDRV_CopyColor(&physDev->inkColor, color); PSDRV_CopyColor(&physDev->inkColor, color);
@ -467,11 +458,11 @@ BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color)
case PSCOLOR_RGB: case PSCOLOR_RGB:
sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g, sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
color->value.rgb.b); color->value.rgb.b);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
case PSCOLOR_GRAY: case PSCOLOR_GRAY:
sprintf(buf, pssetgray, color->value.gray.i); sprintf(buf, pssetgray, color->value.gray.i);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
default: default:
ERR("Unkonwn colour type %d\n", color->type); ERR("Unkonwn colour type %d\n", color->type);
@ -481,23 +472,22 @@ BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color)
return FALSE; return FALSE;
} }
BOOL PSDRV_WriteSetPen(DC *dc) BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev)
{ {
PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char buf[256]; char buf[256];
sprintf(buf, pssetlinewidth, physDev->pen.width); sprintf(buf, pssetlinewidth, physDev->pen.width);
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(physDev->pen.dash) { if(physDev->pen.dash) {
sprintf(buf, pssetdash, physDev->pen.dash, 0); sprintf(buf, pssetdash, physDev->pen.dash, 0);
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count) BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count)
{ {
char buf[128]; char buf[128];
int i; int i;
@ -507,8 +497,7 @@ BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count)
LPCSTR name; LPCSTR name;
int l; int l;
name = PSDRV_UVMetrics(str[i], name = PSDRV_UVMetrics(str[i], physDev->font.afm)->N->sz;
((PSDRV_PDEVICE *)dc->physDev)->font.afm)->N->sz;
l = snprintf(buf, sizeof(buf), psglyphshow, name); l = snprintf(buf, sizeof(buf), psglyphshow, name);
if (l < sizeof(psglyphshow) - 2 || l > sizeof(buf) - 1) if (l < sizeof(psglyphshow) - 2 || l > sizeof(buf) - 1)
@ -517,84 +506,84 @@ BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count)
continue; continue;
} }
PSDRV_WriteSpool(dc, buf, l); PSDRV_WriteSpool(physDev, buf, l);
} }
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteFill(DC *dc) BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psfill, sizeof(psfill)-1); return PSDRV_WriteSpool(physDev, psfill, sizeof(psfill)-1);
} }
BOOL PSDRV_WriteEOFill(DC *dc) BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, pseofill, sizeof(pseofill)-1); return PSDRV_WriteSpool(physDev, pseofill, sizeof(pseofill)-1);
} }
BOOL PSDRV_WriteGSave(DC *dc) BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psgsave, sizeof(psgsave)-1); return PSDRV_WriteSpool(physDev, psgsave, sizeof(psgsave)-1);
} }
BOOL PSDRV_WriteGRestore(DC *dc) BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psgrestore, sizeof(psgrestore)-1); return PSDRV_WriteSpool(physDev, psgrestore, sizeof(psgrestore)-1);
} }
BOOL PSDRV_WriteNewPath(DC *dc) BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psnewpath, sizeof(psnewpath)-1); return PSDRV_WriteSpool(physDev, psnewpath, sizeof(psnewpath)-1);
} }
BOOL PSDRV_WriteClosePath(DC *dc) BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psclosepath, sizeof(psclosepath)-1); return PSDRV_WriteSpool(physDev, psclosepath, sizeof(psclosepath)-1);
} }
BOOL PSDRV_WriteClip(DC *dc) BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psclip, sizeof(psclip)-1); return PSDRV_WriteSpool(physDev, psclip, sizeof(psclip)-1);
} }
BOOL PSDRV_WriteEOClip(DC *dc) BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, pseoclip, sizeof(pseoclip)-1); return PSDRV_WriteSpool(physDev, pseoclip, sizeof(pseoclip)-1);
} }
BOOL PSDRV_WriteInitClip(DC *dc) BOOL PSDRV_WriteInitClip(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, psinitclip, sizeof(psinitclip)-1); return PSDRV_WriteSpool(physDev, psinitclip, sizeof(psinitclip)-1);
} }
BOOL PSDRV_WriteHatch(DC *dc) BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev)
{ {
return PSDRV_WriteSpool(dc, pshatch, sizeof(pshatch)-1); return PSDRV_WriteSpool(physDev, pshatch, sizeof(pshatch)-1);
} }
BOOL PSDRV_WriteRotate(DC *dc, float ang) BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang)
{ {
char buf[256]; char buf[256];
sprintf(buf, psrotate, ang); sprintf(buf, psrotate, ang);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size) BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size)
{ {
char buf[256]; char buf[256];
sprintf(buf, "[/Indexed /DeviceRGB %d\n<\n", size); sprintf(buf, "[/Indexed /DeviceRGB %d\n<\n", size);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc) BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev)
{ {
char buf[] = ">\n] setcolorspace\n"; char buf[] = ">\n] setcolorspace\n";
return PSDRV_WriteSpool(dc, buf, sizeof(buf) - 1); return PSDRV_WriteSpool(physDev, buf, sizeof(buf) - 1);
} }
BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number) BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number)
{ {
char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1), *ptr; char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1), *ptr;
int i; int i;
@ -606,13 +595,13 @@ BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number)
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' '); ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7; ptr += 7;
} }
PSDRV_WriteSpool(dc, buf, number * 7); PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst, BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthSrc, INT widthDst, INT heightDst, INT widthSrc,
INT heightSrc, char *bits) INT heightSrc, char *bits)
{ {
@ -631,7 +620,7 @@ BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
sprintf(buf, start, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc, sprintf(buf, start, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc,
(depth < 8) ? depth : 8, widthSrc, -heightSrc, heightSrc); (depth < 8) ? depth : 8, widthSrc, -heightSrc, heightSrc);
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
switch(depth) { switch(depth) {
case 8: case 8:
@ -651,13 +640,13 @@ BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
break; break;
} }
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(!bits) if(!bits)
PSDRV_WriteSpool(dc, end, sizeof(end) - 1); PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
else { else {
sprintf(buf, endbits, bits); sprintf(buf, endbits, bits);
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
@ -665,7 +654,7 @@ BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
} }
BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number) BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number)
{ {
char *buf = HeapAlloc(PSDRV_Heap, 0, number * 3 + 1); char *buf = HeapAlloc(PSDRV_Heap, 0, number * 3 + 1);
char *ptr; char *ptr;
@ -678,13 +667,13 @@ BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number)
((i & 0xf) == 0xf) || (i == number - 1) ? '\n' : ' '); ((i & 0xf) == 0xf) || (i == number - 1) ? '\n' : ' ');
ptr += 3; ptr += 3;
} }
PSDRV_WriteSpool(dc, buf, number * 3); PSDRV_WriteSpool(physDev, buf, number * 3);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number) BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number)
{ {
char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1); char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
char *ptr; char *ptr;
@ -707,13 +696,13 @@ BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number)
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' '); ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7; ptr += 7;
} }
PSDRV_WriteSpool(dc, buf, number * 7); PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number) BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number)
{ {
char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1); char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
char *ptr; char *ptr;
@ -727,13 +716,13 @@ BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number)
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' '); ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7; ptr += 7;
} }
PSDRV_WriteSpool(dc, buf, number * 7); PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number) BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number)
{ {
char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1); char *buf = HeapAlloc(PSDRV_Heap, 0, number * 7 + 1);
char *ptr; char *ptr;
@ -747,53 +736,53 @@ BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number)
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' '); ((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7; ptr += 7;
} }
PSDRV_WriteSpool(dc, buf, number * 7); PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }
BOOL PSDRV_WriteArrayGet(DC *dc, CHAR *pszArrayName, INT nIndex) BOOL PSDRV_WriteArrayGet(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex)
{ {
char buf[100]; char buf[100];
sprintf(buf, psarrayget, pszArrayName, nIndex); sprintf(buf, psarrayget, pszArrayName, nIndex);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteArrayPut(DC *dc, CHAR *pszArrayName, INT nIndex, LONG lObject) BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lObject)
{ {
char buf[100]; char buf[100];
sprintf(buf, psarrayput, pszArrayName, nIndex, lObject); sprintf(buf, psarrayput, pszArrayName, nIndex, lObject);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize) BOOL PSDRV_WriteArrayDef(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nSize)
{ {
char buf[100]; char buf[100];
sprintf(buf, psarraydef, pszArrayName, nSize); sprintf(buf, psarraydef, pszArrayName, nSize);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h) BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h)
{ {
char buf[100]; char buf[100];
sprintf(buf, psrectclip, x, y, w, h); sprintf(buf, psrectclip, x, y, w, h);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName) BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName)
{ {
char buf[100]; char buf[100];
sprintf(buf, psrectclip2, pszArrayName); sprintf(buf, psrectclip2, pszArrayName);
return PSDRV_WriteSpool(dc, buf, strlen(buf)); return PSDRV_WriteSpool(physDev, buf, strlen(buf));
} }
BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits) BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits)
{ {
char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n " char start[] = "<<\n /PaintType 1\n /PatternType 1\n /TilingType 1\n "
"/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n"; "/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n";
@ -808,12 +797,12 @@ BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits)
buf = HeapAlloc(PSDRV_Heap, 0, sizeof(start) + 100); buf = HeapAlloc(PSDRV_Heap, 0, sizeof(start) + 100);
sprintf(buf, start, w, h, w, h); sprintf(buf, start, w, h, w, h);
PSDRV_WriteSpool(dc, buf, strlen(buf)); PSDRV_WriteSpool(physDev, buf, strlen(buf));
PSDRV_WriteIndexColorSpaceBegin(dc, 1); PSDRV_WriteIndexColorSpaceBegin(physDev, 1);
map[0] = dc->textColor; map[0] = GetTextColor( physDev->hdc );
map[1] = dc->backgroundColor; map[1] = GetBkColor( physDev->hdc );
PSDRV_WriteRGB(dc, map, 2); PSDRV_WriteRGB(physDev, map, 2);
PSDRV_WriteIndexColorSpaceEnd(dc); PSDRV_WriteIndexColorSpaceEnd(physDev);
ptr = buf; ptr = buf;
for(y = h-1; y >= 0; y--) { for(y = h-1; y >= 0; y--) {
for(x = 0; x < w/8; x++) { for(x = 0; x < w/8; x++) {
@ -821,8 +810,8 @@ BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits)
ptr += 2; ptr += 2;
} }
} }
PSDRV_WriteImageDict(dc, 1, 0, 0, 8, 8, 8, 8, buf); PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf);
PSDRV_WriteSpool(dc, end, sizeof(end) - 1); PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
HeapFree(PSDRV_Heap, 0, buf); HeapFree(PSDRV_Heap, 0, buf);
return TRUE; return TRUE;
} }

View File

@ -267,6 +267,8 @@ typedef struct {
} JOB; } JOB;
typedef struct { typedef struct {
HDC hdc;
DC *dc;
PSFONT font; /* Current PS font */ PSFONT font; /* Current PS font */
PSPEN pen; PSPEN pen;
PSBRUSH brush; PSBRUSH brush;
@ -327,13 +329,10 @@ extern BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm,
extern void PSDRV_FreeAFMList( FONTFAMILY *head ); extern void PSDRV_FreeAFMList( FONTFAMILY *head );
extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved); extern BOOL WINAPI PSDRV_Init(HINSTANCE hinst, DWORD reason, LPVOID reserved);
extern HFONT PSDRV_FONT_SelectObject( DC *dc, HFONT hfont );
extern HPEN PSDRV_PEN_SelectObject( DC * dc, HPEN hpen );
extern HBRUSH PSDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush );
extern BOOL PSDRV_Brush(DC *dc, BOOL EO); extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO);
extern BOOL PSDRV_SetFont( DC *dc ); extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_SetPen( DC *dc ); extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2); extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2); extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
@ -341,98 +340,95 @@ extern void PSDRV_CreateColor( PSDRV_PDEVICE *physDev, PSCOLOR *pscolor,
COLORREF wincolor ); COLORREF wincolor );
extern char PSDRV_UnicodeToANSI(int u); extern char PSDRV_UnicodeToANSI(int u);
extern INT PSDRV_WriteHeader( DC *dc, LPCSTR title ); extern INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title );
extern INT PSDRV_WriteFooter( DC *dc ); extern INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev );
extern INT PSDRV_WriteNewPage( DC *dc ); extern INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev );
extern INT PSDRV_WriteEndPage( DC *dc ); extern INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y); extern BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y);
extern BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y); extern BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y);
extern BOOL PSDRV_WriteStroke(DC *dc); extern BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width, extern BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
INT height); INT height);
extern BOOL PSDRV_WriteRRectangle(DC *dc, INT x, INT y, INT width, extern BOOL PSDRV_WriteRRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
INT height); INT height);
extern BOOL PSDRV_WriteSetFont(DC *dc); extern BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count); extern BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count);
extern BOOL PSDRV_WriteSetPen(DC *dc); extern BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h, extern BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h,
double ang1, double ang2); double ang1, double ang2);
extern BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color); extern BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color);
extern BOOL PSDRV_WriteSetBrush(DC *dc); extern BOOL PSDRV_WriteSetBrush(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteFill(DC *dc); extern BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteEOFill(DC *dc); extern BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteGSave(DC *dc); extern BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteGRestore(DC *dc); extern BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteNewPath(DC *dc); extern BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteClosePath(DC *dc); extern BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteInitClip(DC *dc); extern BOOL PSDRV_WriteInitClip(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteClip(DC *dc); extern BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h); extern BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h);
extern BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName); extern BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName);
extern BOOL PSDRV_WriteEOClip(DC *dc); extern BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteHatch(DC *dc); extern BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteRotate(DC *dc, float ang); extern BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang);
extern BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size); extern BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size);
extern BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc); extern BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev);
extern BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number); extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number);
extern BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst, extern BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthSrc, INT widthDst, INT heightDst, INT widthSrc,
INT heightSrc, char *bits); INT heightSrc, char *bits);
extern BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number); extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number);
extern BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number); extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number);
extern BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number); extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
extern BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number); extern BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
extern int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch); extern int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch);
extern BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits); extern BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits);
extern BOOL PSDRV_WriteArrayPut(DC *dc, CHAR *pszArrayName, INT nIndex, LONG lCoord); extern BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lCoord);
extern BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize); extern BOOL PSDRV_WriteArrayDef(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nSize);
extern BOOL PSDRV_Arc( DC *dc, INT left, INT top, INT right, extern BOOL PSDRV_Arc( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT bottom, INT xstart, INT ystart,
INT xend, INT yend ); INT xend, INT yend );
extern BOOL PSDRV_Chord( DC *dc, INT left, INT top, INT right, extern BOOL PSDRV_Chord( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT bottom, INT xstart, INT ystart,
INT xend, INT yend ); INT xend, INT yend );
extern BOOL PSDRV_Ellipse( DC *dc, INT left, INT top, INT right, extern BOOL PSDRV_Ellipse( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom ); INT bottom );
extern INT PSDRV_EndDoc( DC *dc ); extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev );
extern INT PSDRV_EndPage( DC *dc ); extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp ); DEVICEFONTENUMPROC proc, LPARAM lp );
extern INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput, extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
SEGPTR lpInData, SEGPTR lpOutData );
extern BOOL PSDRV_ExtTextOut( DC *dc, 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 PSDRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar, extern BOOL PSDRV_GetCharWidth( PSDRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
LPINT buffer ); LPINT buffer );
extern BOOL PSDRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count, extern BOOL PSDRV_GetTextExtentPoint( PSDRV_PDEVICE *physDev, LPCWSTR str, INT count,
LPSIZE size ); LPSIZE size );
extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics ); extern BOOL PSDRV_GetTextMetrics( PSDRV_PDEVICE *physDev, TEXTMETRICW *metrics );
extern BOOL PSDRV_LineTo( DC *dc, INT x, INT y ); extern BOOL PSDRV_LineTo( PSDRV_PDEVICE *physDev, INT x, INT y );
extern BOOL PSDRV_PatBlt( DC *dc, INT x, INT y, INT width, INT height, DWORD extern BOOL PSDRV_PatBlt( PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, DWORD
dwRop); dwRop);
extern BOOL PSDRV_Pie( DC *dc, INT left, INT top, INT right, extern BOOL PSDRV_Pie( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT bottom, INT xstart, INT ystart,
INT xend, INT yend ); INT xend, INT yend );
extern BOOL PSDRV_Polygon( DC *dc, const POINT* pt, INT count ); extern BOOL PSDRV_Polygon( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
extern BOOL PSDRV_Polyline( DC *dc, const POINT* pt, INT count ); extern BOOL PSDRV_Polyline( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
extern BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts, extern BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* counts,
UINT polygons ); UINT polygons );
extern BOOL PSDRV_PolyPolyline( DC *dc, const POINT* pts, const DWORD* counts, extern BOOL PSDRV_PolyPolyline( PSDRV_PDEVICE *physDev, const POINT* pts, const DWORD* counts,
DWORD polylines ); DWORD polylines );
extern BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right, extern BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom ); INT bottom );
extern BOOL PSDRV_RoundRect(DC *dc, INT left, INT top, INT right, extern BOOL PSDRV_RoundRect(PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height); INT bottom, INT ell_width, INT ell_height);
extern HGDIOBJ PSDRV_SelectObject( DC *dc, HGDIOBJ handle ); extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color );
extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color ); extern VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev );
extern VOID PSDRV_SetDeviceClipping( DC *dc ); extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color );
extern COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ); extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color );
extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color ); extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc );
extern INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc ); extern INT PSDRV_StartPage( PSDRV_PDEVICE *physDev );
extern INT PSDRV_StartPage( DC *dc ); extern INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst,
extern INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT xSrc, INT widthDst, INT heightDst, INT xSrc,
INT ySrc, INT widthSrc, INT heightSrc, INT ySrc, INT widthSrc, INT heightSrc,
const void *bits, const BITMAPINFO *info, const void *bits, const BITMAPINFO *info,
@ -447,7 +443,7 @@ extern DWORD PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice,
LPCSTR lpszPort, LPCSTR lpszPort,
WORD fwCapability, LPSTR lpszOutput, WORD fwCapability, LPSTR lpszOutput,
LPDEVMODEA lpdm); LPDEVMODEA lpdm);
VOID PSDRV_DrawLine( DC *dc ); VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev );
INT PSDRV_GlyphListInit(void); INT PSDRV_GlyphListInit(void);
const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName); const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
VOID PSDRV_IndexGlyphList(void); VOID PSDRV_IndexGlyphList(void);

View File

@ -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,
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,
/*********************************************************************** /***********************************************************************
* 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,
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,
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,
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,
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,
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,
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,
/* 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 */
} }
} }

View File

@ -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

View File

@ -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
@ 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

View File

@ -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)
/*********************************************************************** /***********************************************************************
* 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)
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)
* 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)
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)
/*********************************************************************** /***********************************************************************
* 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,
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,
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,
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,
} }
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,
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,
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,
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,
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,
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,
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,
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,
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)
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,
return FALSE; return FALSE;
} }
void X11DRV_XRender_UpdateDrawable(DC *dc) void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev)
{ {
assert(0); assert(0);
return; return;

View File

@ -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)
* 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);

View File

@ -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,
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,
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 );

View File

@ -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;

View File

@ -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 )
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 )
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 )
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 )
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)
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 )
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,
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,
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)

View File

@ -57,7 +57,7 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_LineTo(dc, x, y); ret = PATH_LineTo(dc, x, y);
else else
ret = dc->funcs->pLineTo && dc->funcs->pLineTo(dc,x,y); ret = dc->funcs->pLineTo && dc->funcs->pLineTo(dc->physDev,x,y);
if(ret) { if(ret) {
dc->CursPosX = x; dc->CursPosX = x;
dc->CursPosY = y; dc->CursPosY = y;
@ -110,7 +110,7 @@ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt )
dc->CursPosY = y; dc->CursPosY = y;
if(PATH_IsPathOpen(dc->path)) ret = PATH_MoveTo(dc); if(PATH_IsPathOpen(dc->path)) ret = PATH_MoveTo(dc);
else if (dc->funcs->pMoveTo) ret = dc->funcs->pMoveTo(dc,x,y); else if (dc->funcs->pMoveTo) ret = dc->funcs->pMoveTo(dc->physDev,x,y);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
} }
@ -143,7 +143,7 @@ BOOL WINAPI Arc( HDC hdc, INT left, INT top, INT right,
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Arc(dc, left, top, right, bottom, xstart, ystart, xend, yend,0); ret = PATH_Arc(dc, left, top, right, bottom, xstart, ystart, xend, yend,0);
else if (dc->funcs->pArc) else if (dc->funcs->pArc)
ret = dc->funcs->pArc(dc,left,top,right,bottom,xstart,ystart,xend,yend); ret = dc->funcs->pArc(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -164,7 +164,7 @@ BOOL WINAPI ArcTo( HDC hdc,
if(dc->funcs->pArcTo) if(dc->funcs->pArcTo)
{ {
result = dc->funcs->pArcTo( dc, left, top, right, bottom, result = dc->funcs->pArcTo( dc->physDev, left, top, right, bottom,
xstart, ystart, xend, yend ); xstart, ystart, xend, yend );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return result; return result;
@ -215,7 +215,7 @@ BOOL WINAPI Pie( HDC hdc, INT left, INT top,
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,2); ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,2);
else if(dc->funcs->pPie) else if(dc->funcs->pPie)
ret = dc->funcs->pPie(dc,left,top,right,bottom,xstart,ystart,xend,yend); ret = dc->funcs->pPie(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
@ -247,7 +247,7 @@ BOOL WINAPI Chord( HDC hdc, INT left, INT top,
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,1); ret = PATH_Arc(dc,left,top,right,bottom,xstart,ystart,xend,yend,1);
else if(dc->funcs->pChord) else if(dc->funcs->pChord)
ret = dc->funcs->pChord(dc,left,top,right,bottom,xstart,ystart,xend,yend); ret = dc->funcs->pChord(dc->physDev,left,top,right,bottom,xstart,ystart,xend,yend);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
@ -277,7 +277,7 @@ BOOL WINAPI Ellipse( HDC hdc, INT left, INT top,
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Ellipse(dc,left,top,right,bottom); ret = PATH_Ellipse(dc,left,top,right,bottom);
else if (dc->funcs->pEllipse) else if (dc->funcs->pEllipse)
ret = dc->funcs->pEllipse(dc,left,top,right,bottom); ret = dc->funcs->pEllipse(dc->physDev,left,top,right,bottom);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
@ -307,7 +307,7 @@ BOOL WINAPI Rectangle( HDC hdc, INT left, INT top,
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_Rectangle(dc, left, top, right, bottom); ret = PATH_Rectangle(dc, left, top, right, bottom);
else if (dc->funcs->pRectangle) else if (dc->funcs->pRectangle)
ret = dc->funcs->pRectangle(dc,left,top,right,bottom); ret = dc->funcs->pRectangle(dc->physDev,left,top,right,bottom);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -338,7 +338,7 @@ BOOL WINAPI RoundRect( HDC hdc, INT left, INT top, INT right,
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_RoundRect(dc,left,top,right,bottom,ell_width,ell_height); ret = PATH_RoundRect(dc,left,top,right,bottom,ell_width,ell_height);
else if (dc->funcs->pRoundRect) else if (dc->funcs->pRoundRect)
ret = dc->funcs->pRoundRect(dc,left,top,right,bottom,ell_width,ell_height); ret = dc->funcs->pRoundRect(dc->physDev,left,top,right,bottom,ell_width,ell_height);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -362,7 +362,7 @@ COLORREF WINAPI SetPixel( HDC hdc, INT x, INT y, COLORREF color )
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (dc) if (dc)
{ {
if (dc->funcs->pSetPixel) ret = dc->funcs->pSetPixel(dc,x,y,color); if (dc->funcs->pSetPixel) ret = dc->funcs->pSetPixel(dc->physDev,x,y,color);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -379,7 +379,7 @@ BOOL WINAPI SetPixelV( HDC hdc, INT x, INT y, COLORREF color )
{ {
if (dc->funcs->pSetPixel) if (dc->funcs->pSetPixel)
{ {
dc->funcs->pSetPixel(dc,x,y,color); dc->funcs->pSetPixel(dc->physDev,x,y,color);
ret = TRUE; ret = TRUE;
} }
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -409,7 +409,7 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y )
/* FIXME: should this be in the graphics driver? */ /* FIXME: should this be in the graphics driver? */
if (PtVisible( hdc, x, y )) if (PtVisible( hdc, x, y ))
{ {
if (dc->funcs->pGetPixel) ret = dc->funcs->pGetPixel(dc,x,y); if (dc->funcs->pGetPixel) ret = dc->funcs->pGetPixel(dc->physDev,x,y);
} }
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
@ -439,7 +439,7 @@ INT WINAPI ChoosePixelFormat( HDC hdc, const LPPIXELFORMATDESCRIPTOR ppfd )
if (!dc) return 0; if (!dc) return 0;
if (!dc->funcs->pChoosePixelFormat) FIXME(" :stub\n"); if (!dc->funcs->pChoosePixelFormat) FIXME(" :stub\n");
else ret = dc->funcs->pChoosePixelFormat(dc,ppfd); else ret = dc->funcs->pChoosePixelFormat(dc->physDev,ppfd);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
@ -468,7 +468,7 @@ BOOL WINAPI SetPixelFormat( HDC hdc, INT iPixelFormat,
if (!dc) return 0; if (!dc) return 0;
if (!dc->funcs->pSetPixelFormat) FIXME(" :stub\n"); if (!dc->funcs->pSetPixelFormat) FIXME(" :stub\n");
else bRet = dc->funcs->pSetPixelFormat(dc,iPixelFormat,ppfd); else bRet = dc->funcs->pSetPixelFormat(dc->physDev,iPixelFormat,ppfd);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return bRet; return bRet;
@ -496,7 +496,7 @@ INT WINAPI GetPixelFormat( HDC hdc )
if (!dc) return 0; if (!dc) return 0;
if (!dc->funcs->pGetPixelFormat) FIXME(" :stub\n"); if (!dc->funcs->pGetPixelFormat) FIXME(" :stub\n");
else ret = dc->funcs->pGetPixelFormat(dc); else ret = dc->funcs->pGetPixelFormat(dc->physDev);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
@ -534,7 +534,7 @@ INT WINAPI DescribePixelFormat( HDC hdc, INT iPixelFormat, UINT nBytes,
ppfd->nVersion = 1; ppfd->nVersion = 1;
ret = 3; ret = 3;
} }
else ret = dc->funcs->pDescribePixelFormat(dc,iPixelFormat,nBytes,ppfd); else ret = dc->funcs->pDescribePixelFormat(dc->physDev,iPixelFormat,nBytes,ppfd);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
@ -564,7 +564,7 @@ BOOL WINAPI SwapBuffers( HDC hdc )
FIXME(" :stub\n"); FIXME(" :stub\n");
bRet = TRUE; bRet = TRUE;
} }
else bRet = dc->funcs->pSwapBuffers(dc); else bRet = dc->funcs->pSwapBuffers(dc->physDev);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return bRet; return bRet;
@ -589,7 +589,7 @@ BOOL WINAPI PaintRgn( HDC hdc, HRGN hrgn )
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (dc) if (dc)
{ {
if (dc->funcs->pPaintRgn) ret = dc->funcs->pPaintRgn(dc,hrgn); if (dc->funcs->pPaintRgn) ret = dc->funcs->pPaintRgn(dc->physDev,hrgn);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -616,7 +616,7 @@ BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
if (!dc) return FALSE; if (!dc) return FALSE;
if(dc->funcs->pFillRgn) if(dc->funcs->pFillRgn)
retval = dc->funcs->pFillRgn(dc, hrgn, hbrush); retval = dc->funcs->pFillRgn(dc->physDev, hrgn, hbrush);
else if ((prevBrush = SelectObject( hdc, hbrush ))) else if ((prevBrush = SelectObject( hdc, hbrush )))
{ {
retval = PaintRgn( hdc, hrgn ); retval = PaintRgn( hdc, hrgn );
@ -648,7 +648,7 @@ BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush,
if (!dc) return FALSE; if (!dc) return FALSE;
if(dc->funcs->pFrameRgn) if(dc->funcs->pFrameRgn)
ret = dc->funcs->pFrameRgn( dc, hrgn, hbrush, nWidth, nHeight ); ret = dc->funcs->pFrameRgn( dc->physDev, hrgn, hbrush, nWidth, nHeight );
else else
{ {
HRGN tmp = CreateRectRgn( 0, 0, 0, 0 ); HRGN tmp = CreateRectRgn( 0, 0, 0, 0 );
@ -688,7 +688,7 @@ BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
if (!dc) return FALSE; if (!dc) return FALSE;
if(dc->funcs->pInvertRgn) if(dc->funcs->pInvertRgn)
retval = dc->funcs->pInvertRgn( dc, hrgn ); retval = dc->funcs->pInvertRgn( dc->physDev, hrgn );
else else
{ {
prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) ); prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) );
@ -729,7 +729,7 @@ BOOL WINAPI Polyline( HDC hdc, const POINT* pt, INT count )
if (dc) if (dc)
{ {
if (PATH_IsPathOpen(dc->path)) ret = PATH_Polyline(dc, pt, count); if (PATH_IsPathOpen(dc->path)) ret = PATH_Polyline(dc, pt, count);
else if (dc->funcs->pPolyline) ret = dc->funcs->pPolyline(dc,pt,count); else if (dc->funcs->pPolyline) ret = dc->funcs->pPolyline(dc->physDev,pt,count);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -749,7 +749,7 @@ BOOL WINAPI PolylineTo( HDC hdc, const POINT* pt, DWORD cCount )
ret = PATH_PolylineTo(dc, pt, cCount); ret = PATH_PolylineTo(dc, pt, cCount);
else if(dc->funcs->pPolylineTo) else if(dc->funcs->pPolylineTo)
ret = dc->funcs->pPolylineTo(dc, pt, cCount); ret = dc->funcs->pPolylineTo(dc->physDev, pt, cCount);
else { /* do it using Polyline */ else { /* do it using Polyline */
POINT *pts = HeapAlloc( GetProcessHeap(), 0, POINT *pts = HeapAlloc( GetProcessHeap(), 0,
@ -799,7 +799,7 @@ BOOL WINAPI Polygon( HDC hdc, const POINT* pt, INT count )
if (dc) if (dc)
{ {
if (PATH_IsPathOpen(dc->path)) ret = PATH_Polygon(dc, pt, count); if (PATH_IsPathOpen(dc->path)) ret = PATH_Polygon(dc, pt, count);
else if (dc->funcs->pPolygon) ret = dc->funcs->pPolygon(dc,pt,count); else if (dc->funcs->pPolygon) ret = dc->funcs->pPolygon(dc->physDev,pt,count);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -848,7 +848,7 @@ BOOL WINAPI PolyPolygon( HDC hdc, const POINT* pt, const INT* counts,
if (dc) if (dc)
{ {
if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolygon(dc, pt, counts, polygons); if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolygon(dc, pt, counts, polygons);
else if (dc->funcs->pPolyPolygon) ret = dc->funcs->pPolyPolygon(dc,pt,counts,polygons); else if (dc->funcs->pPolyPolygon) ret = dc->funcs->pPolyPolygon(dc->physDev,pt,counts,polygons);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -865,7 +865,7 @@ BOOL WINAPI PolyPolyline( HDC hdc, const POINT* pt, const DWORD* counts,
if (dc) if (dc)
{ {
if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolyline(dc, pt, counts, polylines); if (PATH_IsPathOpen(dc->path)) ret = PATH_PolyPolyline(dc, pt, counts, polylines);
else if (dc->funcs->pPolyPolyline) ret = dc->funcs->pPolyPolyline(dc,pt,counts,polylines); else if (dc->funcs->pPolyPolyline) ret = dc->funcs->pPolyPolyline(dc->physDev,pt,counts,polylines);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -891,7 +891,7 @@ BOOL WINAPI ExtFloodFill( HDC hdc, INT x, INT y, COLORREF color,
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCUpdate( hdc );
if (dc) if (dc)
{ {
if (dc->funcs->pExtFloodFill) ret = dc->funcs->pExtFloodFill(dc,x,y,color,fillType); if (dc->funcs->pExtFloodFill) ret = dc->funcs->pExtFloodFill(dc->physDev,x,y,color,fillType);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -969,7 +969,7 @@ BOOL WINAPI PolyBezier( HDC hdc, const POINT* lppt, DWORD cPoints )
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_PolyBezier(dc, lppt, cPoints); ret = PATH_PolyBezier(dc, lppt, cPoints);
else if (dc->funcs->pPolyBezier) else if (dc->funcs->pPolyBezier)
ret = dc->funcs->pPolyBezier(dc, lppt, cPoints); ret = dc->funcs->pPolyBezier(dc->physDev, lppt, cPoints);
else /* We'll convert it into line segments and draw them using Polyline */ else /* We'll convert it into line segments and draw them using Polyline */
{ {
POINT *Pts; POINT *Pts;
@ -1008,7 +1008,7 @@ BOOL WINAPI PolyBezierTo( HDC hdc, const POINT* lppt, DWORD cPoints )
if(PATH_IsPathOpen(dc->path)) if(PATH_IsPathOpen(dc->path))
ret = PATH_PolyBezierTo(dc, lppt, cPoints); ret = PATH_PolyBezierTo(dc, lppt, cPoints);
else if(dc->funcs->pPolyBezierTo) else if(dc->funcs->pPolyBezierTo)
ret = dc->funcs->pPolyBezierTo(dc, lppt, cPoints); ret = dc->funcs->pPolyBezierTo(dc->physDev, lppt, cPoints);
else { /* We'll do it using PolyBezier */ else { /* We'll do it using PolyBezier */
POINT *pt; POINT *pt;
pt = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (cPoints + 1) ); pt = HeapAlloc( GetProcessHeap(), 0, sizeof(POINT) * (cPoints + 1) );
@ -1044,7 +1044,7 @@ BOOL WINAPI AngleArc(HDC hdc, INT x, INT y, DWORD dwRadius, FLOAT eStartAngle, F
if(dc->funcs->pAngleArc) if(dc->funcs->pAngleArc)
{ {
result = dc->funcs->pAngleArc( dc, x, y, dwRadius, eStartAngle, eSweepAngle ); result = dc->funcs->pAngleArc( dc->physDev, x, y, dwRadius, eStartAngle, eSweepAngle );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return result; return result;
@ -1089,7 +1089,7 @@ BOOL WINAPI PolyDraw(HDC hdc, const POINT *lppt, const BYTE *lpbTypes,
if(dc->funcs->pPolyDraw) if(dc->funcs->pPolyDraw)
{ {
result = dc->funcs->pPolyDraw( dc, lppt, lpbTypes, cCount ); result = dc->funcs->pPolyDraw( dc->physDev, lppt, lpbTypes, cCount );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return result; return result;
} }

View File

@ -115,7 +115,7 @@ BOOL WINAPI BeginPath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pBeginPath) if(dc->funcs->pBeginPath)
ret = dc->funcs->pBeginPath(dc); ret = dc->funcs->pBeginPath(dc->physDev);
else else
{ {
/* If path is already open, do nothing */ /* If path is already open, do nothing */
@ -154,7 +154,7 @@ BOOL WINAPI EndPath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pEndPath) if(dc->funcs->pEndPath)
ret = dc->funcs->pEndPath(dc); ret = dc->funcs->pEndPath(dc->physDev);
else else
{ {
/* Check that path is currently being constructed */ /* Check that path is currently being constructed */
@ -200,7 +200,7 @@ BOOL WINAPI AbortPath( HDC hdc )
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pAbortPath) if(dc->funcs->pAbortPath)
ret = dc->funcs->pAbortPath(dc); ret = dc->funcs->pAbortPath(dc->physDev);
else /* Remove all entries from the path */ else /* Remove all entries from the path */
PATH_EmptyPath( &dc->path ); PATH_EmptyPath( &dc->path );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -230,7 +230,7 @@ BOOL WINAPI CloseFigure(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pCloseFigure) if(dc->funcs->pCloseFigure)
ret = dc->funcs->pCloseFigure(dc); ret = dc->funcs->pCloseFigure(dc->physDev);
else else
{ {
/* Check that path is open */ /* Check that path is open */
@ -366,7 +366,7 @@ static BOOL PATH_FillPath(DC *dc, GdiPath *pPath)
HRGN hrgn; HRGN hrgn;
if(dc->funcs->pFillPath) if(dc->funcs->pFillPath)
return dc->funcs->pFillPath(dc); return dc->funcs->pFillPath(dc->physDev);
/* Check that path is closed */ /* Check that path is closed */
if(pPath->state!=PATH_Closed) if(pPath->state!=PATH_Closed)
@ -448,7 +448,7 @@ BOOL WINAPI FillPath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pFillPath) if(dc->funcs->pFillPath)
bRet = dc->funcs->pFillPath(dc); bRet = dc->funcs->pFillPath(dc->physDev);
else else
{ {
bRet = PATH_FillPath(dc, &dc->path); bRet = PATH_FillPath(dc, &dc->path);
@ -486,7 +486,7 @@ BOOL WINAPI SelectClipPath(HDC hdc, INT iMode)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pSelectClipPath) if(dc->funcs->pSelectClipPath)
success = dc->funcs->pSelectClipPath(dc, iMode); success = dc->funcs->pSelectClipPath(dc->physDev, iMode);
else else
{ {
pPath = &dc->path; pPath = &dc->path;
@ -1464,7 +1464,7 @@ BOOL WINAPI FlattenPath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pFlattenPath) ret = dc->funcs->pFlattenPath(dc); if(dc->funcs->pFlattenPath) ret = dc->funcs->pFlattenPath(dc->physDev);
else else
{ {
GdiPath *pPath = &dc->path; GdiPath *pPath = &dc->path;
@ -1487,7 +1487,7 @@ static BOOL PATH_StrokePath(DC *dc, GdiPath *pPath)
BOOL ret = TRUE; BOOL ret = TRUE;
if(dc->funcs->pStrokePath) if(dc->funcs->pStrokePath)
return dc->funcs->pStrokePath(dc); return dc->funcs->pStrokePath(dc->physDev);
if(pPath->state != PATH_Closed) if(pPath->state != PATH_Closed)
return FALSE; return FALSE;
@ -1581,7 +1581,7 @@ BOOL WINAPI StrokeAndFillPath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pStrokeAndFillPath) if(dc->funcs->pStrokeAndFillPath)
bRet = dc->funcs->pStrokeAndFillPath(dc); bRet = dc->funcs->pStrokeAndFillPath(dc->physDev);
else else
{ {
bRet = PATH_FillPath(dc, &dc->path); bRet = PATH_FillPath(dc, &dc->path);
@ -1617,7 +1617,7 @@ BOOL WINAPI StrokePath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pStrokePath) if(dc->funcs->pStrokePath)
bRet = dc->funcs->pStrokePath(dc); bRet = dc->funcs->pStrokePath(dc->physDev);
else else
{ {
pPath = &dc->path; pPath = &dc->path;
@ -1651,7 +1651,7 @@ BOOL WINAPI WidenPath(HDC hdc)
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pWidenPath) if(dc->funcs->pWidenPath)
ret = dc->funcs->pWidenPath(dc); ret = dc->funcs->pWidenPath(dc->physDev);
FIXME("stub\n"); FIXME("stub\n");
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );

View File

@ -856,7 +856,7 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
* Retrieve an area from the source DC, stretching and mapping all the * Retrieve an area from the source DC, stretching and mapping all the
* pixels to Windows colors. * pixels to Windows colors.
*/ */
static int BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst, static int BITBLT_GetSrcAreaStretch( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
Pixmap pixmap, GC gc, Pixmap pixmap, GC gc,
INT xSrc, INT ySrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, INT widthSrc, INT heightSrc,
@ -865,8 +865,7 @@ static int BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
RECT *visRectSrc, RECT *visRectDst ) RECT *visRectSrc, RECT *visRectDst )
{ {
XImage *imageSrc, *imageDst; XImage *imageSrc, *imageDst;
X11DRV_PDEVICE *physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev; DC *dcDst = physDevDst->dc;
X11DRV_PDEVICE *physDevDst = (X11DRV_PDEVICE *)dcDst->physDev;
RECT rectSrc = *visRectSrc; RECT rectSrc = *visRectSrc;
RECT rectDst = *visRectDst; RECT rectDst = *visRectDst;
@ -912,16 +911,16 @@ static int BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
* Retrieve an area from the source DC, mapping all the * Retrieve an area from the source DC, mapping all the
* pixels to Windows colors. * pixels to Windows colors.
*/ */
static int BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc, static int BITBLT_GetSrcArea( X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
INT xSrc, INT ySrc, RECT *visRectSrc ) Pixmap pixmap, GC gc, INT xSrc, INT ySrc, RECT *visRectSrc )
{ {
XImage *imageSrc, *imageDst; XImage *imageSrc, *imageDst;
register INT x, y; register INT x, y;
int exposures = 0; int exposures = 0;
INT width = visRectSrc->right - visRectSrc->left; INT width = visRectSrc->right - visRectSrc->left;
INT height = visRectSrc->bottom - visRectSrc->top; INT height = visRectSrc->bottom - visRectSrc->top;
X11DRV_PDEVICE *physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev; DC *dcSrc = physDevSrc->dc;
X11DRV_PDEVICE *physDevDst = (X11DRV_PDEVICE *)dcDst->physDev; DC *dcDst = physDevDst->dc;
if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel) if (dcSrc->bitsPerPixel == dcDst->bitsPerPixel)
{ {
@ -1018,14 +1017,13 @@ static int BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc,
* Retrieve an area from the destination DC, mapping all the * Retrieve an area from the destination DC, mapping all the
* pixels to Windows colors. * pixels to Windows colors.
*/ */
static int BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst) static int BITBLT_GetDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, GC gc, RECT *visRectDst)
{ {
int exposures = 0; int exposures = 0;
INT width = visRectDst->right - visRectDst->left; INT width = visRectDst->right - visRectDst->left;
INT height = visRectDst->bottom - visRectDst->top; INT height = visRectDst->bottom - visRectDst->top;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!X11DRV_PALETTE_XPixelToPalette || (dc->bitsPerPixel == 1) || if (!X11DRV_PALETTE_XPixelToPalette || (physDev->dc->bitsPerPixel == 1) ||
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) )
{ {
XCopyArea( gdi_display, physDev->drawable, pixmap, gc, XCopyArea( gdi_display, physDev->drawable, pixmap, gc,
@ -1037,7 +1035,7 @@ static int BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst)
register INT x, y; register INT x, y;
XImage *image; XImage *image;
if (dc->flags & DC_MEMORY) if (physDev->dc->flags & DC_MEMORY)
image = XGetImage( gdi_display, physDev->drawable, image = XGetImage( gdi_display, physDev->drawable,
visRectDst->left, visRectDst->top, visRectDst->left, visRectDst->top,
width, height, AllPlanes, ZPixmap ); width, height, AllPlanes, ZPixmap );
@ -1067,19 +1065,18 @@ static int BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst)
* Put an area back into the destination DC, mapping the pixel * Put an area back into the destination DC, mapping the pixel
* colors to X pixels. * colors to X pixels.
*/ */
static int BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst) static int BITBLT_PutDstArea(X11DRV_PDEVICE *physDev, Pixmap pixmap, RECT *visRectDst)
{ {
int exposures = 0; int exposures = 0;
INT width = visRectDst->right - visRectDst->left; INT width = visRectDst->right - visRectDst->left;
INT height = visRectDst->bottom - visRectDst->top; INT height = visRectDst->bottom - visRectDst->top;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
/* !X11DRV_PALETTE_PaletteToXPixel is _NOT_ enough */ /* !X11DRV_PALETTE_PaletteToXPixel is _NOT_ enough */
if (!X11DRV_PALETTE_PaletteToXPixel || (dc->bitsPerPixel == 1) || if (!X11DRV_PALETTE_PaletteToXPixel || (physDev->dc->bitsPerPixel == 1) ||
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) ) (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL) )
{ {
XCopyArea( gdi_display, pixmap, physDev->drawable, gc, 0, 0, XCopyArea( gdi_display, pixmap, physDev->drawable, physDev->gc, 0, 0,
width, height, visRectDst->left, visRectDst->top ); width, height, visRectDst->left, visRectDst->top );
exposures++; exposures++;
} }
@ -1094,7 +1091,7 @@ static int BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT *visRectDst)
XPutPixel( image, x, y, XPutPixel( image, x, y,
X11DRV_PALETTE_PaletteToXPixel[XGetPixel( image, x, y )]); X11DRV_PALETTE_PaletteToXPixel[XGetPixel( image, x, y )]);
} }
XPutImage( gdi_display, physDev->drawable, gc, image, 0, 0, XPutImage( gdi_display, physDev->drawable, physDev->gc, image, 0, 0,
visRectDst->left, visRectDst->top, width, height ); visRectDst->left, visRectDst->top, width, height );
XDestroyImage( image ); XDestroyImage( image );
} }
@ -1198,9 +1195,9 @@ static BOOL BITBLT_GetVisRectangles( DC *dcDst, INT xDst, INT yDst,
* *
* Implementation of PatBlt(), BitBlt() and StretchBlt(). * Implementation of PatBlt(), BitBlt() and StretchBlt().
*/ */
static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst, static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthDst, INT heightDst,
DC *dcSrc, INT xSrc, INT ySrc, X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, INT widthSrc, INT heightSrc,
DWORD rop ) DWORD rop )
{ {
@ -1210,8 +1207,8 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
const BYTE *opcode; const BYTE *opcode;
Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */ Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */
GC tmpGC = 0; GC tmpGC = 0;
X11DRV_PDEVICE *physDevSrc = NULL; DC *dcSrc = physDevSrc ? physDevSrc->dc : NULL;
X11DRV_PDEVICE *physDevDst = (X11DRV_PDEVICE *)dcDst->physDev; DC *dcDst = physDevDst->dc;
/* compensate for off-by-one shifting for negative widths and heights */ /* compensate for off-by-one shifting for negative widths and heights */
if (widthDst < 0) if (widthDst < 0)
@ -1223,7 +1220,6 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
if (heightSrc < 0) if (heightSrc < 0)
++ySrc; ++ySrc;
if(dcSrc) physDevSrc = (X11DRV_PDEVICE *)dcSrc->physDev;
usePat = (((rop >> 4) & 0x0f0000) != (rop & 0x0f0000)); usePat = (((rop >> 4) & 0x0f0000) != (rop & 0x0f0000));
useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000)); useSrc = (((rop >> 2) & 0x330000) != (rop & 0x330000));
useDst = (((rop >> 1) & 0x550000) != (rop & 0x550000)); useDst = (((rop >> 1) & 0x550000) != (rop & 0x550000));
@ -1332,7 +1328,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
case PATINVERT: /* 0x5a */ case PATINVERT: /* 0x5a */
if (perfect_graphics()) break; if (perfect_graphics()) break;
if (X11DRV_SetupGCForBrush( dcDst )) if (X11DRV_SetupGCForBrush( physDevDst ))
{ {
wine_tsx11_lock(); wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXxor ); XSetFunction( gdi_display, physDevDst->gc, GXxor );
@ -1344,7 +1340,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
case 0xa50065: case 0xa50065:
if (perfect_graphics()) break; if (perfect_graphics()) break;
if (X11DRV_SetupGCForBrush( dcDst )) if (X11DRV_SetupGCForBrush( physDevDst ))
{ {
wine_tsx11_lock(); wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXequiv ); XSetFunction( gdi_display, physDevDst->gc, GXequiv );
@ -1384,7 +1380,7 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
break; break;
case PATCOPY: /* 0xf0 */ case PATCOPY: /* 0xf0 */
if (!X11DRV_SetupGCForBrush( dcDst )) return TRUE; if (!X11DRV_SetupGCForBrush( physDevDst )) return TRUE;
wine_tsx11_lock(); wine_tsx11_lock();
XSetFunction( gdi_display, physDevDst->gc, GXcopy ); XSetFunction( gdi_display, physDevDst->gc, GXcopy );
XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc, XFillRectangle( gdi_display, physDevDst->drawable, physDevDst->gc,
@ -1421,17 +1417,17 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height, pixmaps[SRC] = XCreatePixmap( gdi_display, root_window, width, height,
dcDst->bitsPerPixel ); dcDst->bitsPerPixel );
if (fStretch) if (fStretch)
BITBLT_GetSrcAreaStretch( dcSrc, dcDst, pixmaps[SRC], tmpGC, BITBLT_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC,
xSrc, ySrc, widthSrc, heightSrc, xSrc, ySrc, widthSrc, heightSrc,
xDst, yDst, widthDst, heightDst, xDst, yDst, widthDst, heightDst,
&visRectSrc, &visRectDst ); &visRectSrc, &visRectDst );
else else
BITBLT_GetSrcArea( dcSrc, dcDst, pixmaps[SRC], tmpGC, BITBLT_GetSrcArea( physDevSrc, physDevDst, pixmaps[SRC], tmpGC,
xSrc, ySrc, &visRectSrc ); xSrc, ySrc, &visRectSrc );
} }
if (useDst) BITBLT_GetDstArea( dcDst, pixmaps[DST], tmpGC, &visRectDst ); if (useDst) BITBLT_GetDstArea( physDevDst, pixmaps[DST], tmpGC, &visRectDst );
if (usePat) fNullBrush = !X11DRV_SetupGCForPatBlt( dcDst, tmpGC, TRUE ); if (usePat) fNullBrush = !X11DRV_SetupGCForPatBlt( physDevDst, tmpGC, TRUE );
else fNullBrush = FALSE; else fNullBrush = FALSE;
destUsed = FALSE; destUsed = FALSE;
@ -1472,8 +1468,8 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
} }
} }
XSetFunction( gdi_display, physDevDst->gc, GXcopy ); XSetFunction( gdi_display, physDevDst->gc, GXcopy );
physDevDst->exposures += BITBLT_PutDstArea( dcDst, pixmaps[destUsed ? DST : SRC], physDevDst->exposures += BITBLT_PutDstArea( physDevDst, pixmaps[destUsed ? DST : SRC],
physDevDst->gc, &visRectDst ); &visRectDst );
XFreePixmap( gdi_display, pixmaps[DST] ); XFreePixmap( gdi_display, pixmaps[DST] );
if (pixmaps[SRC]) XFreePixmap( gdi_display, pixmaps[SRC] ); if (pixmaps[SRC]) XFreePixmap( gdi_display, pixmaps[SRC] );
if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] ); if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] );
@ -1486,14 +1482,13 @@ static BOOL BITBLT_InternalStretchBlt( DC *dcDst, INT xDst, INT yDst,
/*********************************************************************** /***********************************************************************
* X11DRV_PatBlt * X11DRV_PatBlt
*/ */
BOOL X11DRV_PatBlt( DC *dc, INT left, INT top, BOOL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop )
INT width, INT height, DWORD rop )
{ {
BOOL result; BOOL result;
X11DRV_LockDIBSection( dc, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
result = BITBLT_InternalStretchBlt( dc, left, top, width, height, NULL, 0, 0, 0, 0, rop ); result = BITBLT_InternalStretchBlt( physDev, left, top, width, height, NULL, 0, 0, 0, 0, rop );
X11DRV_UnlockDIBSection( dc, TRUE ); X11DRV_UnlockDIBSection( physDev, TRUE );
return result; return result;
} }
@ -1501,13 +1496,15 @@ BOOL X11DRV_PatBlt( DC *dc, INT left, INT top,
/*********************************************************************** /***********************************************************************
* X11DRV_BitBlt * X11DRV_BitBlt
*/ */
BOOL X11DRV_BitBlt( DC *dcDst, INT xDst, INT yDst, BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT width, INT height, DC *dcSrc, INT width, INT height, X11DRV_PDEVICE *physDevSrc,
INT xSrc, INT ySrc, DWORD rop ) INT xSrc, INT ySrc, DWORD rop )
{ {
BOOL result = FALSE; BOOL result = FALSE;
INT sSrc, sDst; INT sSrc, sDst;
RECT visRectDst, visRectSrc; RECT visRectDst, visRectSrc;
DC *dcSrc = physDevSrc->dc;
DC *dcDst = physDevDst->dc;
if (((rop >> 16) & 0x55) == ((rop >> 17) & 0x55)) { if (((rop >> 16) & 0x55) == ((rop >> 17) & 0x55)) {
/* FIXME: seems the ROP doesn't include destination; /* FIXME: seems the ROP doesn't include destination;
@ -1515,8 +1512,8 @@ BOOL X11DRV_BitBlt( DC *dcDst, INT xDst, INT yDst,
* we can pass TRUE instead of FALSE to CoerceDIBSection(dcDst...), * we can pass TRUE instead of FALSE to CoerceDIBSection(dcDst...),
* which may avoid a copy in some situations */ * which may avoid a copy in some situations */
} }
sDst = X11DRV_LockDIBSection( dcDst, DIB_Status_None, FALSE ); sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None, FALSE );
sSrc = X11DRV_LockDIBSection( dcSrc, DIB_Status_None, FALSE ); sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None, FALSE );
if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) && if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) &&
(dcSrc->bitsPerPixel == dcDst->bitsPerPixel)) (dcSrc->bitsPerPixel == dcDst->bitsPerPixel))
@ -1545,22 +1542,22 @@ BOOL X11DRV_BitBlt( DC *dcDst, INT xDst, INT yDst,
if (sDst == DIB_Status_AppMod) { if (sDst == DIB_Status_AppMod) {
FIXME("potential optimization - client-side DIB copy\n"); FIXME("potential optimization - client-side DIB copy\n");
} }
X11DRV_CoerceDIBSection( dcDst, DIB_Status_GdiMod, FALSE ); X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod, FALSE );
X11DRV_DIB_CopyDIBSection( dcSrc, dcDst, xSrc, ySrc, xDst, yDst, width, height ); X11DRV_DIB_CopyDIBSection( physDevSrc, physDevDst, xSrc, ySrc, xDst, yDst, width, height );
result = TRUE; result = TRUE;
goto END; goto END;
} }
X11DRV_CoerceDIBSection( dcDst, DIB_Status_GdiMod, FALSE ); X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod, FALSE );
X11DRV_CoerceDIBSection( dcSrc, DIB_Status_GdiMod, FALSE ); X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod, FALSE );
result = BITBLT_InternalStretchBlt( dcDst, xDst, yDst, width, height, result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, width, height,
dcSrc, xSrc, ySrc, width, height, rop ); physDevSrc, xSrc, ySrc, width, height, rop );
END: END:
X11DRV_UnlockDIBSection( dcSrc, FALSE ); X11DRV_UnlockDIBSection( physDevSrc, FALSE );
X11DRV_UnlockDIBSection( dcDst, TRUE ); X11DRV_UnlockDIBSection( physDevDst, TRUE );
return result; return result;
} }
@ -1569,21 +1566,21 @@ END:
/*********************************************************************** /***********************************************************************
* X11DRV_StretchBlt * X11DRV_StretchBlt
*/ */
BOOL X11DRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, BOOL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthDst, INT heightDst,
DC *dcSrc, INT xSrc, INT ySrc, X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop ) INT widthSrc, INT heightSrc, DWORD rop )
{ {
BOOL result; BOOL result;
X11DRV_LockDIBSection( dcDst, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDevDst, DIB_Status_GdiMod, FALSE );
X11DRV_LockDIBSection( dcSrc, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDevSrc, DIB_Status_GdiMod, FALSE );
result = BITBLT_InternalStretchBlt( dcDst, xDst, yDst, widthDst, heightDst, result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); physDevSrc, xSrc, ySrc, widthSrc, heightSrc, rop );
X11DRV_UnlockDIBSection( dcSrc, FALSE ); X11DRV_UnlockDIBSection( physDevSrc, FALSE );
X11DRV_UnlockDIBSection( dcDst, TRUE ); X11DRV_UnlockDIBSection( physDevDst, TRUE );
return result; return result;
} }

View File

@ -74,14 +74,13 @@ BOOL X11DRV_BITMAP_Init(void)
} }
/*********************************************************************** /***********************************************************************
* X11DRV_BITMAP_SelectObject * X11DRV_SelectBitmap (X11DRV.@)
*/ */
HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap ) HBITMAP X11DRV_SelectBitmap( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
{ {
BITMAPOBJ *bmp; BITMAPOBJ *bmp;
HRGN hrgn; HRGN hrgn;
HBITMAP prevHandle = dc->hBitmap; DC *dc = physDev->dc;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!(dc->flags & DC_MEMORY)) return 0; if (!(dc->flags & DC_MEMORY)) return 0;
if (hbitmap == dc->hBitmap) return hbitmap; /* nothing to do */ if (hbitmap == dc->hBitmap) return hbitmap; /* nothing to do */
@ -141,7 +140,7 @@ HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap )
DC_InitDC( dc ); DC_InitDC( dc );
} }
GDI_ReleaseObj( hbitmap ); GDI_ReleaseObj( hbitmap );
return prevHandle; return hbitmap;
} }
@ -481,6 +480,7 @@ BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap )
TSXFreePixmap( gdi_display, (Pixmap)bmp->physBitmap ); TSXFreePixmap( gdi_display, (Pixmap)bmp->physBitmap );
bmp->physBitmap = NULL; bmp->physBitmap = NULL;
bmp->funcs = NULL; bmp->funcs = NULL;
if (bmp->dib) X11DRV_DIB_DeleteDIBSection( bmp );
GDI_ReleaseObj( hbitmap ); GDI_ReleaseObj( hbitmap );
} }
return TRUE; return TRUE;

View File

@ -154,9 +154,9 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
/*********************************************************************** /***********************************************************************
* BRUSH_SelectSolidBrush * BRUSH_SelectSolidBrush
*/ */
static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color ) static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if ((dc->bitsPerPixel > 1) && (screen_depth <= 8) && !COLOR_IsSolid( color )) if ((dc->bitsPerPixel > 1) && (screen_depth <= 8) && !COLOR_IsSolid( color ))
{ {
@ -168,7 +168,7 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
else else
{ {
/* Solid brush */ /* Solid brush */
physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( dc, color ); physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( physDev, color );
physDev->brush.fillStyle = FillSolid; physDev->brush.fillStyle = FillSolid;
} }
} }
@ -177,10 +177,10 @@ static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
/*********************************************************************** /***********************************************************************
* BRUSH_SelectPatternBrush * BRUSH_SelectPatternBrush
*/ */
static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap ) static BOOL BRUSH_SelectPatternBrush( X11DRV_PDEVICE *physDev, HBITMAP hbitmap )
{ {
BOOL ret = FALSE; BOOL ret = FALSE;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ); BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE; if (!bmp) return FALSE;
@ -229,21 +229,17 @@ static BOOL BRUSH_SelectPatternBrush( DC * dc, HBITMAP hbitmap )
/*********************************************************************** /***********************************************************************
* BRUSH_SelectObject * X11DRV_SelectBrush (X11DRV.@)
*/ */
HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush ) HBRUSH X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush )
{ {
LOGBRUSH logbrush; LOGBRUSH logbrush;
HBITMAP16 hBitmap; HBITMAP16 hBitmap;
BITMAPINFO * bmpInfo; BITMAPINFO * bmpInfo;
HBRUSH16 prevHandle = dc->hBrush;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0; if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0;
TRACE("hdc=%04x hbrush=%04x\n", dc->hSelf,hbrush); TRACE("hdc=%04x hbrush=%04x\n", physDev->hdc,hbrush);
dc->hBrush = hbrush;
if (physDev->brush.pixmap) if (physDev->brush.pixmap)
{ {
@ -260,12 +256,12 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
case BS_SOLID: case BS_SOLID:
TRACE("BS_SOLID\n" ); TRACE("BS_SOLID\n" );
BRUSH_SelectSolidBrush( dc, logbrush.lbColor ); BRUSH_SelectSolidBrush( physDev, logbrush.lbColor );
break; break;
case BS_HATCHED: case BS_HATCHED:
TRACE("BS_HATCHED\n" ); TRACE("BS_HATCHED\n" );
physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( dc, logbrush.lbColor ); physDev->brush.pixel = X11DRV_PALETTE_ToPhysical( physDev, logbrush.lbColor );
physDev->brush.pixmap = TSXCreateBitmapFromData( gdi_display, root_window, physDev->brush.pixmap = TSXCreateBitmapFromData( gdi_display, root_window,
HatchBrushes[logbrush.lbHatch], 8, 8 ); HatchBrushes[logbrush.lbHatch], 8, 8 );
physDev->brush.fillStyle = FillStippled; physDev->brush.fillStyle = FillStippled;
@ -273,7 +269,7 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
case BS_PATTERN: case BS_PATTERN:
TRACE("BS_PATTERN\n"); TRACE("BS_PATTERN\n");
BRUSH_SelectPatternBrush( dc, (HBRUSH16)logbrush.lbHatch ); BRUSH_SelectPatternBrush( physDev, (HBRUSH16)logbrush.lbHatch );
break; break;
case BS_DIBPATTERN: case BS_DIBPATTERN:
@ -281,17 +277,16 @@ HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush )
if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch ))) if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)logbrush.lbHatch )))
{ {
int size = DIB_BitmapInfoSize( bmpInfo, logbrush.lbColor ); int size = DIB_BitmapInfoSize( bmpInfo, logbrush.lbColor );
hBitmap = CreateDIBitmap( dc->hSelf, &bmpInfo->bmiHeader, hBitmap = CreateDIBitmap( physDev->hdc, &bmpInfo->bmiHeader,
CBM_INIT, ((char *)bmpInfo) + size, CBM_INIT, ((char *)bmpInfo) + size,
bmpInfo, bmpInfo,
(WORD)logbrush.lbColor ); (WORD)logbrush.lbColor );
BRUSH_SelectPatternBrush( dc, hBitmap ); BRUSH_SelectPatternBrush( physDev, hBitmap );
DeleteObject( hBitmap ); DeleteObject( hBitmap );
GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch ); GlobalUnlock16( (HGLOBAL16)logbrush.lbHatch );
} }
break; break;
} }
return hbrush;
return prevHandle;
} }

View File

@ -38,10 +38,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
* *
* Could write using GetRegionData but this would be slower. * Could write using GetRegionData but this would be slower.
*/ */
void X11DRV_SetDeviceClipping( DC * dc ) void X11DRV_SetDeviceClipping( X11DRV_PDEVICE *physDev )
{ {
XRectangle *pXrect; XRectangle *pXrect;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->hGCClipRgn, REGION_MAGIC); RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->hGCClipRgn, REGION_MAGIC);
if (!obj) if (!obj)
@ -96,7 +96,7 @@ void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int or
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (dc) if (dc)
{ {
X11DRV_PDEVICE *physDev = dc->physDev; X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
/* /*
* This function change the coordinate system (DCOrgX,DCOrgY) * This function change the coordinate system (DCOrgX,DCOrgY)
* values. When it moves the origin, other data like the current clipping * values. When it moves the origin, other data like the current clipping
@ -114,7 +114,7 @@ void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x, int or
physDev->drawable = drawable; physDev->drawable = drawable;
TSXSetSubwindowMode( gdi_display, physDev->gc, mode ); TSXSetSubwindowMode( gdi_display, physDev->gc, mode );
if(physDev->xrender) if(physDev->xrender)
X11DRV_XRender_UpdateDrawable(dc); X11DRV_XRender_UpdateDrawable( physDev );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
} }
@ -130,7 +130,7 @@ void X11DRV_StartGraphicsExposures( HDC hdc )
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (dc) if (dc)
{ {
X11DRV_PDEVICE *physDev = dc->physDev; X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TSXSetGraphicsExposures( gdi_display, physDev->gc, True ); TSXSetGraphicsExposures( gdi_display, physDev->gc, True );
physDev->exposures = 0; physDev->exposures = 0;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -151,7 +151,7 @@ void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn )
if (dc) if (dc)
{ {
XEvent event; XEvent event;
X11DRV_PDEVICE *physDev = dc->physDev; X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
SetRectRgn( hrgn, 0, 0, 0, 0 ); SetRectRgn( hrgn, 0, 0, 0, 0 );
wine_tsx11_lock(); wine_tsx11_lock();

View File

@ -54,7 +54,7 @@ static int XShmErrorFlag = 0;
/* This structure holds the arguments for DIB_SetImageBits() */ /* This structure holds the arguments for DIB_SetImageBits() */
typedef struct typedef struct
{ {
struct tagDC *dc; X11DRV_PDEVICE *physDev;
LPCVOID bits; LPCVOID bits;
XImage *image; XImage *image;
PALETTEENTRY *palentry; PALETTEENTRY *palentry;
@ -143,7 +143,7 @@ XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth )
* Fills the color map of a bitmap palette. Should not be called * Fills the color map of a bitmap palette. Should not be called
* for a >8-bit deep bitmap. * for a >8-bit deep bitmap.
*/ */
int *X11DRV_DIB_GenColorMap( DC *dc, int *colorMapping, int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping,
WORD coloruse, WORD depth, BOOL quads, WORD coloruse, WORD depth, BOOL quads,
const void *colorPtr, int start, int end ) const void *colorPtr, int start, int end )
{ {
@ -165,7 +165,7 @@ int *X11DRV_DIB_GenColorMap( DC *dc, int *colorMapping,
rgb->rgbBlue > 255*3/2); rgb->rgbBlue > 255*3/2);
else else
for (i = start; i < end; i++, rgb++) for (i = start; i < end; i++, rgb++)
colorMapping[i] = X11DRV_PALETTE_ToPhysical( dc, RGB(rgb->rgbRed, colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, RGB(rgb->rgbRed,
rgb->rgbGreen, rgb->rgbGreen,
rgb->rgbBlue)); rgb->rgbBlue));
} }
@ -179,7 +179,7 @@ int *X11DRV_DIB_GenColorMap( DC *dc, int *colorMapping,
rgb->rgbtBlue > 255*3/2); rgb->rgbtBlue > 255*3/2);
else else
for (i = start; i < end; i++, rgb++) for (i = start; i < end; i++, rgb++)
colorMapping[i] = X11DRV_PALETTE_ToPhysical( dc, RGB(rgb->rgbtRed, colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, RGB(rgb->rgbtRed,
rgb->rgbtGreen, rgb->rgbtGreen,
rgb->rgbtBlue)); rgb->rgbtBlue));
} }
@ -190,10 +190,10 @@ int *X11DRV_DIB_GenColorMap( DC *dc, int *colorMapping,
WORD * index = (WORD *)colorPtr; WORD * index = (WORD *)colorPtr;
for (i = start; i < end; i++, index++) for (i = start; i < end; i++, index++)
colorMapping[i] = X11DRV_PALETTE_ToPhysical( dc, PALETTEINDEX(*index) ); colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, PALETTEINDEX(*index) );
} else { } else {
for (i = start; i < end; i++) for (i = start; i < end; i++)
colorMapping[i] = X11DRV_PALETTE_ToPhysical( dc, PALETTEINDEX(i) ); colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, PALETTEINDEX(i) );
} }
} }
@ -206,7 +206,7 @@ int *X11DRV_DIB_GenColorMap( DC *dc, int *colorMapping,
* Build the color map from the bitmap palette. Should not be called * Build the color map from the bitmap palette. Should not be called
* for a >8-bit deep bitmap. * for a >8-bit deep bitmap.
*/ */
int *X11DRV_DIB_BuildColorMap( DC *dc, WORD coloruse, WORD depth, int *X11DRV_DIB_BuildColorMap( X11DRV_PDEVICE *physDev, WORD coloruse, WORD depth,
const BITMAPINFO *info, int *nColors ) const BITMAPINFO *info, int *nColors )
{ {
int colors; int colors;
@ -240,7 +240,7 @@ int *X11DRV_DIB_BuildColorMap( DC *dc, WORD coloruse, WORD depth,
return NULL; return NULL;
*nColors = colors; *nColors = colors;
return X11DRV_DIB_GenColorMap( dc, colorMapping, coloruse, depth, return X11DRV_DIB_GenColorMap( physDev, colorMapping, coloruse, depth,
isInfo, colorPtr, 0, colors); isInfo, colorPtr, 0, colors);
} }
@ -2939,7 +2939,7 @@ static void X11DRV_DIB_SetImageBits_RLE8( int lines, const BYTE *bits,
*/ */
static void X11DRV_DIB_SetImageBits_16( int lines, const BYTE *srcbits, static void X11DRV_DIB_SetImageBits_16( int lines, const BYTE *srcbits,
DWORD srcwidth, DWORD dstwidth, int left, DWORD srcwidth, DWORD dstwidth, int left,
DC *dc, DWORD rSrc, DWORD gSrc, DWORD bSrc, X11DRV_PDEVICE *physDev, DWORD rSrc, DWORD gSrc, DWORD bSrc,
XImage *bmpImage, DWORD linebytes ) XImage *bmpImage, DWORD linebytes )
{ {
DWORD x; DWORD x;
@ -3185,7 +3185,7 @@ static void X11DRV_DIB_SetImageBits_16( int lines, const BYTE *srcbits,
((srcval >> bShift2) & 0x07); ((srcval >> bShift2) & 0x07);
XPutPixel(bmpImage, x, h, XPutPixel(bmpImage, x, h,
X11DRV_PALETTE_ToPhysical X11DRV_PALETTE_ToPhysical
(dc, RGB(red,green,blue))); (physDev, RGB(red,green,blue)));
} }
srcbits += linebytes; srcbits += linebytes;
} }
@ -3528,7 +3528,7 @@ static void X11DRV_DIB_GetImageBits_16( int lines, BYTE *dstbits,
*/ */
static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits, static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits,
DWORD srcwidth, DWORD dstwidth, int left, DWORD srcwidth, DWORD dstwidth, int left,
DC *dc, X11DRV_PDEVICE *physDev,
DWORD rSrc, DWORD gSrc, DWORD bSrc, DWORD rSrc, DWORD gSrc, DWORD bSrc,
XImage *bmpImage, DWORD linebytes ) XImage *bmpImage, DWORD linebytes )
{ {
@ -3675,7 +3675,7 @@ static void X11DRV_DIB_SetImageBits_24( int lines, const BYTE *srcbits,
for (x = left; x < dstwidth+left; x++) { for (x = left; x < dstwidth+left; x++) {
XPutPixel(bmpImage, x, h, XPutPixel(bmpImage, x, h,
X11DRV_PALETTE_ToPhysical X11DRV_PALETTE_ToPhysical
(dc, RGB(srcbyte[2], srcbyte[1], srcbyte[0]))); (physDev, RGB(srcbyte[2], srcbyte[1], srcbyte[0])));
srcbyte+=3; srcbyte+=3;
} }
srcbits += linebytes; srcbits += linebytes;
@ -3906,7 +3906,7 @@ static void X11DRV_DIB_GetImageBits_24( int lines, BYTE *dstbits,
*/ */
static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits, static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits,
DWORD srcwidth, DWORD dstwidth, int left, DWORD srcwidth, DWORD dstwidth, int left,
DC *dc, X11DRV_PDEVICE *physDev,
DWORD rSrc, DWORD gSrc, DWORD bSrc, DWORD rSrc, DWORD gSrc, DWORD bSrc,
XImage *bmpImage, XImage *bmpImage,
DWORD linebytes) DWORD linebytes)
@ -4156,7 +4156,7 @@ static void X11DRV_DIB_SetImageBits_32(int lines, const BYTE *srcbits,
green=(srcvalue >> gShift) & 0xff; green=(srcvalue >> gShift) & 0xff;
blue= (srcvalue >> bShift) & 0xff; blue= (srcvalue >> bShift) & 0xff;
XPutPixel(bmpImage, x, h, X11DRV_PALETTE_ToPhysical XPutPixel(bmpImage, x, h, X11DRV_PALETTE_ToPhysical
(dc, RGB(red,green,blue))); (physDev, RGB(red,green,blue)));
} }
srcbits += linebytes; srcbits += linebytes;
} }
@ -4554,21 +4554,21 @@ static int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
case 16: case 16:
X11DRV_DIB_SetImageBits_16( descr->lines, descr->bits, X11DRV_DIB_SetImageBits_16( descr->lines, descr->bits,
descr->infoWidth, descr->width, descr->infoWidth, descr->width,
descr->xSrc, descr->dc, descr->xSrc, descr->physDev,
descr->rMask, descr->gMask, descr->bMask, descr->rMask, descr->gMask, descr->bMask,
bmpImage, descr->dibpitch); bmpImage, descr->dibpitch);
break; break;
case 24: case 24:
X11DRV_DIB_SetImageBits_24( descr->lines, descr->bits, X11DRV_DIB_SetImageBits_24( descr->lines, descr->bits,
descr->infoWidth, descr->width, descr->infoWidth, descr->width,
descr->xSrc, descr->dc, descr->xSrc, descr->physDev,
descr->rMask, descr->gMask, descr->bMask, descr->rMask, descr->gMask, descr->bMask,
bmpImage, descr->dibpitch); bmpImage, descr->dibpitch);
break; break;
case 32: case 32:
X11DRV_DIB_SetImageBits_32( descr->lines, descr->bits, X11DRV_DIB_SetImageBits_32( descr->lines, descr->bits,
descr->infoWidth, descr->width, descr->infoWidth, descr->width,
descr->xSrc, descr->dc, descr->xSrc, descr->physDev,
descr->rMask, descr->gMask, descr->bMask, descr->rMask, descr->gMask, descr->bMask,
bmpImage, descr->dibpitch); bmpImage, descr->dibpitch);
break; break;
@ -4732,7 +4732,7 @@ static int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
* X11DRV_SetDIBitsToDevice * X11DRV_SetDIBitsToDevice
* *
*/ */
INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx, INT X11DRV_SetDIBitsToDevice( X11DRV_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 )
@ -4741,8 +4741,7 @@ INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
DWORD width, oldcy = cy; DWORD width, oldcy = cy;
INT result; INT result;
int height, tmpheight; int height, tmpheight;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height, if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
&descr.infoBpp, &descr.compression ) == -1) &descr.infoBpp, &descr.compression ) == -1)
@ -4758,7 +4757,7 @@ INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
if (xSrc + cx >= width) cx = width - xSrc; if (xSrc + cx >= width) cx = width - xSrc;
if (!cx || !cy) return 0; if (!cx || !cy) return 0;
X11DRV_SetupGCForText( dc ); /* To have the correct colors */ X11DRV_SetupGCForText( physDev ); /* To have the correct colors */
TSXSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[dc->ROPmode-1]); TSXSetFunction(gdi_display, physDev->gc, X11DRV_XROPfunction[dc->ROPmode-1]);
switch (descr.infoBpp) switch (descr.infoBpp)
@ -4767,7 +4766,7 @@ INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
case 4: case 4:
case 8: case 8:
descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap( descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap(
coloruse == DIB_PAL_COLORS ? dc : NULL, coloruse, coloruse == DIB_PAL_COLORS ? physDev : NULL, coloruse,
dc->bitsPerPixel, info, &descr.nColorMap ); dc->bitsPerPixel, info, &descr.nColorMap );
if (!descr.colorMap) return 0; if (!descr.colorMap) return 0;
descr.rMask = descr.gMask = descr.bMask = 0; descr.rMask = descr.gMask = descr.bMask = 0;
@ -4789,7 +4788,7 @@ INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
break; break;
} }
descr.dc = dc; descr.physDev = physDev;
descr.bits = bits; descr.bits = bits;
descr.image = NULL; descr.image = NULL;
descr.palentry = NULL; descr.palentry = NULL;
@ -4817,18 +4816,17 @@ INT X11DRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
} }
/*********************************************************************** /***********************************************************************
* X11DRV_DIB_SetDIBits * X11DRV_SetDIBits (X11DRV.@)
*/ */
INT X11DRV_DIB_SetDIBits( INT X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
BITMAPOBJ *bmp, DC *dc, UINT startscan, UINT lines, LPCVOID bits, const BITMAPINFO *info, UINT coloruse )
UINT lines, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse, HBITMAP hbitmap)
{ {
X11DRV_DIB_IMAGEBITS_DESCR descr; X11DRV_DIB_IMAGEBITS_DESCR descr;
BITMAPOBJ *bmp;
int height, tmpheight; int height, tmpheight;
INT result; INT result;
descr.dc = dc; descr.physDev = physDev;
if (DIB_GetBitmapInfo( &info->bmiHeader, &descr.infoWidth, &height, if (DIB_GetBitmapInfo( &info->bmiHeader, &descr.infoWidth, &height,
&descr.infoBpp, &descr.compression ) == -1) &descr.infoBpp, &descr.compression ) == -1)
@ -4839,6 +4837,8 @@ INT X11DRV_DIB_SetDIBits(
if (!lines || (startscan >= height)) if (!lines || (startscan >= height))
return 0; return 0;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) return 0;
if (startscan + lines > height) lines = height - startscan; if (startscan + lines > height) lines = height - startscan;
switch (descr.infoBpp) switch (descr.infoBpp)
@ -4847,10 +4847,14 @@ INT X11DRV_DIB_SetDIBits(
case 4: case 4:
case 8: case 8:
descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap( descr.colorMap = (RGBQUAD *)X11DRV_DIB_BuildColorMap(
coloruse == DIB_PAL_COLORS ? descr.dc : NULL, coloruse, coloruse == DIB_PAL_COLORS ? descr.physDev : NULL, coloruse,
bmp->bitmap.bmBitsPixel, bmp->bitmap.bmBitsPixel,
info, &descr.nColorMap ); info, &descr.nColorMap );
if (!descr.colorMap) return 0; if (!descr.colorMap)
{
GDI_ReleaseObj( hbitmap );
return 0;
}
descr.rMask = descr.gMask = descr.bMask = 0; descr.rMask = descr.gMask = descr.bMask = 0;
break; break;
case 15: case 15:
@ -4895,30 +4899,37 @@ INT X11DRV_DIB_SetDIBits(
if (descr.colorMap) HeapFree(GetProcessHeap(), 0, descr.colorMap); if (descr.colorMap) HeapFree(GetProcessHeap(), 0, descr.colorMap);
GDI_ReleaseObj( hbitmap );
return result; return result;
} }
/*********************************************************************** /***********************************************************************
* X11DRV_DIB_GetDIBits * X11DRV_GetDIBits (X11DRV.@)
*/ */
INT X11DRV_DIB_GetDIBits( INT X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, UINT lines,
BITMAPOBJ *bmp, DC *dc, UINT startscan, LPVOID bits, BITMAPINFO *info, UINT coloruse )
UINT lines, LPVOID bits, BITMAPINFO *info,
UINT coloruse, HBITMAP hbitmap)
{ {
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib; X11DRV_DIBSECTION *dib;
X11DRV_DIB_IMAGEBITS_DESCR descr; X11DRV_DIB_IMAGEBITS_DESCR descr;
PALETTEOBJ * palette; PALETTEOBJ * palette;
BITMAPOBJ *bmp;
int height; int height;
DC *dc = physDev->dc;
if (!(palette = (PALETTEOBJ*)GDI_GetObjPtr( dc->hPalette, PALETTE_MAGIC )))
return 0;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
{
GDI_ReleaseObj( dc->hPalette );
return 0;
}
dib = (X11DRV_DIBSECTION *) bmp->dib;
TRACE("%u scanlines of (%i,%i) -> (%i,%i) starting from %u\n", TRACE("%u scanlines of (%i,%i) -> (%i,%i) starting from %u\n",
lines, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight, lines, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
(int)info->bmiHeader.biWidth, (int)info->bmiHeader.biHeight, (int)info->bmiHeader.biWidth, (int)info->bmiHeader.biHeight,
startscan ); startscan );
if (!(palette = (PALETTEOBJ*)GDI_GetObjPtr( dc->hPalette, PALETTE_MAGIC )))
return 0;
if( lines > bmp->bitmap.bmHeight ) lines = bmp->bitmap.bmHeight; if( lines > bmp->bitmap.bmHeight ) lines = bmp->bitmap.bmHeight;
height = info->bmiHeader.biHeight; height = info->bmiHeader.biHeight;
@ -4971,7 +4982,7 @@ INT X11DRV_DIB_GetDIBits(
X11DRV_CreateBitmap(hbitmap); X11DRV_CreateBitmap(hbitmap);
descr.dc = dc; descr.physDev = physDev;
descr.palentry = palette->logpalette.palPalEntry; descr.palentry = palette->logpalette.palPalEntry;
descr.bits = bits; descr.bits = bits;
descr.image = NULL; descr.image = NULL;
@ -5020,7 +5031,7 @@ INT X11DRV_DIB_GetDIBits(
done: done:
GDI_ReleaseObj( dc->hPalette ); GDI_ReleaseObj( dc->hPalette );
GDI_ReleaseObj( hbitmap );
return lines; return lines;
} }
@ -5061,7 +5072,7 @@ static void X11DRV_DIB_DoCopyDIBSection(BITMAPOBJ *bmp, BOOL toDIB,
&descr.infoBpp, &descr.compression ) == -1) &descr.infoBpp, &descr.compression ) == -1)
return; return;
descr.dc = NULL; descr.physDev = NULL;
descr.palentry = NULL; descr.palentry = NULL;
descr.image = dib->image; descr.image = dib->image;
descr.colorMap = colorMap; descr.colorMap = colorMap;
@ -5122,13 +5133,13 @@ static void X11DRV_DIB_DoCopyDIBSection(BITMAPOBJ *bmp, BOOL toDIB,
/*********************************************************************** /***********************************************************************
* X11DRV_DIB_CopyDIBSection * X11DRV_DIB_CopyDIBSection
*/ */
void X11DRV_DIB_CopyDIBSection(DC *dcSrc, DC *dcDst, void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
DWORD xSrc, DWORD ySrc, DWORD xSrc, DWORD ySrc, DWORD xDest, DWORD yDest,
DWORD xDest, DWORD yDest,
DWORD width, DWORD height) DWORD width, DWORD height)
{ {
BITMAPOBJ *bmp; BITMAPOBJ *bmp;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dcDst->physDev; DC *dcSrc = physDevSrc->dc;
DC *dcDst = physDevDst->dc;
int nColorMap = 0, *colorMap = NULL, aColorMap = FALSE; int nColorMap = 0, *colorMap = NULL, aColorMap = FALSE;
TRACE("(%p,%p,%ld,%ld,%ld,%ld,%ld,%ld)\n", dcSrc, dcDst, TRACE("(%p,%p,%ld,%ld,%ld,%ld,%ld,%ld)\n", dcSrc, dcDst,
@ -5167,7 +5178,7 @@ void X11DRV_DIB_CopyDIBSection(DC *dcSrc, DC *dcDst,
colorMap = dib->colorMap; colorMap = dib->colorMap;
nColorMap = dib->nColorMap; nColorMap = dib->nColorMap;
} else { } else {
colorMap = X11DRV_DIB_BuildColorMap( dcSrc, (WORD)-1, colorMap = X11DRV_DIB_BuildColorMap( physDevSrc, (WORD)-1,
bmp->dib->dsBm.bmBitsPixel, bmp->dib->dsBm.bmBitsPixel,
(BITMAPINFO*)&(bmp->dib->dsBmih), (BITMAPINFO*)&(bmp->dib->dsBmih),
&nColorMap ); &nColorMap );
@ -5176,7 +5187,7 @@ void X11DRV_DIB_CopyDIBSection(DC *dcSrc, DC *dcDst,
} }
/* perform the copy */ /* perform the copy */
X11DRV_DIB_DoCopyDIBSection(bmp, FALSE, colorMap, nColorMap, X11DRV_DIB_DoCopyDIBSection(bmp, FALSE, colorMap, nColorMap,
physDev->drawable, xSrc, ySrc, xDest, yDest, physDevDst->drawable, xSrc, ySrc, xDest, yDest,
width, height); width, height);
/* free color mapping */ /* free color mapping */
if (aColorMap) if (aColorMap)
@ -5534,32 +5545,32 @@ void X11DRV_UnlockDIBSection2(HBITMAP hBmp, BOOL commit)
/*********************************************************************** /***********************************************************************
* X11DRV_CoerceDIBSection * X11DRV_CoerceDIBSection
*/ */
INT X11DRV_CoerceDIBSection(DC *dc, INT req, BOOL lossy) INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
{ {
if (!dc) return DIB_Status_None; if (!physDev) return DIB_Status_None;
return X11DRV_CoerceDIBSection2( dc->hBitmap, req, lossy ); return X11DRV_CoerceDIBSection2( physDev->dc->hBitmap, req, lossy );
} }
/*********************************************************************** /***********************************************************************
* X11DRV_LockDIBSection * X11DRV_LockDIBSection
*/ */
INT X11DRV_LockDIBSection(DC *dc, INT req, BOOL lossy) INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev, INT req, BOOL lossy)
{ {
if (!dc) return DIB_Status_None; if (!physDev) return DIB_Status_None;
if (!(dc->flags & DC_MEMORY)) return DIB_Status_None; if (!(physDev->dc->flags & DC_MEMORY)) return DIB_Status_None;
return X11DRV_LockDIBSection2( dc->hBitmap, req, lossy ); return X11DRV_LockDIBSection2( physDev->dc->hBitmap, req, lossy );
} }
/*********************************************************************** /***********************************************************************
* X11DRV_UnlockDIBSection * X11DRV_UnlockDIBSection
*/ */
void X11DRV_UnlockDIBSection(DC *dc, BOOL commit) void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev, BOOL commit)
{ {
if (!dc) return; if (!physDev) return;
if (!(dc->flags & DC_MEMORY)) return; if (!(physDev->dc->flags & DC_MEMORY)) return;
X11DRV_UnlockDIBSection2( dc->hBitmap, commit ); X11DRV_UnlockDIBSection2( physDev->dc->hBitmap, commit );
} }
@ -5633,7 +5644,7 @@ static XImage *X11DRV_XShmCreateImage( int width, int height, int bpp,
* X11DRV_DIB_CreateDIBSection * X11DRV_DIB_CreateDIBSection
*/ */
HBITMAP X11DRV_DIB_CreateDIBSection( HBITMAP X11DRV_DIB_CreateDIBSection(
DC *dc, BITMAPINFO *bmi, UINT usage, X11DRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage,
LPVOID *bits, HANDLE section, LPVOID *bits, HANDLE section,
DWORD offset, DWORD ovr_pitch) DWORD offset, DWORD ovr_pitch)
{ {
@ -5694,7 +5705,7 @@ HBITMAP X11DRV_DIB_CreateDIBSection(
/* Create Color Map */ /* Create Color Map */
if (bm.bmBits && bm.bmBitsPixel <= 8) if (bm.bmBits && bm.bmBitsPixel <= 8)
colorMap = X11DRV_DIB_BuildColorMap( usage == DIB_PAL_COLORS? dc : NULL, colorMap = X11DRV_DIB_BuildColorMap( usage == DIB_PAL_COLORS? physDev : NULL,
usage, bm.bmBitsPixel, bmi, &nColorMap ); usage, bm.bmBitsPixel, bmi, &nColorMap );
/* Allocate Memory for DIB and fill structure */ /* Allocate Memory for DIB and fill structure */
@ -5738,7 +5749,7 @@ HBITMAP X11DRV_DIB_CreateDIBSection(
/* Create Device Dependent Bitmap and add DIB pointer */ /* Create Device Dependent Bitmap and add DIB pointer */
if (dib) if (dib)
{ {
res = CreateDIBitmap(dc->hSelf, bi, 0, NULL, bmi, usage); res = CreateDIBitmap(physDev->hdc, bi, 0, NULL, bmi, usage);
if (res) if (res)
{ {
bmp = (BITMAPOBJ *) GDI_GetObjPtr(res, BITMAP_MAGIC); bmp = (BITMAPOBJ *) GDI_GetObjPtr(res, BITMAP_MAGIC);
@ -5843,11 +5854,16 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp)
} }
/*********************************************************************** /***********************************************************************
* X11DRV_DIB_SetDIBColorTable * X11DRV_SetDIBColorTable (X11DRV.@)
*/ */
UINT X11DRV_DIB_SetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count, const RGBQUAD *colors) UINT X11DRV_SetDIBColorTable( X11DRV_PDEVICE *physDev, UINT start, UINT count, const RGBQUAD *colors )
{ {
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib; BITMAPOBJ * bmp;
X11DRV_DIBSECTION *dib;
UINT ret = 0;
if (!(bmp = (BITMAPOBJ*)GDI_GetObjPtr( physDev->dc->hBitmap, BITMAP_MAGIC ))) return 0;
dib = (X11DRV_DIBSECTION *) bmp->dib;
if (dib && dib->colorMap) { if (dib && dib->colorMap) {
UINT end = count + start; UINT end = count + start;
@ -5858,21 +5874,27 @@ UINT X11DRV_DIB_SetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count,
* of the bitmap object. * of the bitmap object.
*/ */
X11DRV_DIB_Lock(bmp, DIB_Status_AppMod, FALSE); X11DRV_DIB_Lock(bmp, DIB_Status_AppMod, FALSE);
X11DRV_DIB_GenColorMap( dc, dib->colorMap, DIB_RGB_COLORS, X11DRV_DIB_GenColorMap( physDev, dib->colorMap, DIB_RGB_COLORS,
dib->dibSection.dsBm.bmBitsPixel, dib->dibSection.dsBm.bmBitsPixel,
TRUE, colors, start, end ); TRUE, colors, start, end );
X11DRV_DIB_Unlock(bmp, TRUE); X11DRV_DIB_Unlock(bmp, TRUE);
return end - start; ret = end - start;
} }
return 0; GDI_ReleaseObj( physDev->dc->hBitmap );
return ret;
} }
/*********************************************************************** /***********************************************************************
* X11DRV_DIB_GetDIBColorTable * X11DRV_GetDIBColorTable (X11DRV.@)
*/ */
UINT X11DRV_DIB_GetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count, RGBQUAD *colors) UINT X11DRV_GetDIBColorTable( X11DRV_PDEVICE *physDev, UINT start, UINT count, RGBQUAD *colors )
{ {
X11DRV_DIBSECTION *dib = (X11DRV_DIBSECTION *) bmp->dib; BITMAPOBJ * bmp;
X11DRV_DIBSECTION *dib;
UINT ret = 0;
if (!(bmp = (BITMAPOBJ*)GDI_GetObjPtr( physDev->dc->hBitmap, BITMAP_MAGIC ))) return 0;
dib = (X11DRV_DIBSECTION *) bmp->dib;
if (dib && dib->colorMap) { if (dib && dib->colorMap) {
UINT i, end = count + start; UINT i, end = count + start;
@ -5884,9 +5906,10 @@ UINT X11DRV_DIB_GetDIBColorTable(BITMAPOBJ *bmp, DC *dc, UINT start, UINT count,
colors->rgbRed = GetRValue(col); colors->rgbRed = GetRValue(col);
colors->rgbReserved = 0; colors->rgbReserved = 0;
} }
return end-start; ret = end-start;
} }
return 0; GDI_ReleaseObj( physDev->dc->hBitmap );
return ret;
} }

View File

@ -81,12 +81,12 @@ const int X11DRV_XROPfunction[16] =
* If fMapColors is TRUE, X pixels are mapped to Windows colors. * If fMapColors is TRUE, X pixels are mapped to Windows colors.
* Return FALSE if brush is BS_NULL, TRUE otherwise. * Return FALSE if brush is BS_NULL, TRUE otherwise.
*/ */
BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors ) BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors )
{ {
XGCValues val; XGCValues val;
unsigned long mask; unsigned long mask;
Pixmap pixmap = 0; Pixmap pixmap = 0;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if (physDev->brush.style == BS_NULL) return FALSE; if (physDev->brush.style == BS_NULL) return FALSE;
if (physDev->brush.pixel == -1) if (physDev->brush.pixel == -1)
@ -126,7 +126,7 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors )
{ {
case FillStippled: case FillStippled:
case FillOpaqueStippled: case FillOpaqueStippled:
if (dc->backgroundMode==OPAQUE) val.fill_style = FillOpaqueStippled; if (GetBkMode(dc->hSelf)==OPAQUE) val.fill_style = FillOpaqueStippled;
val.stipple = physDev->brush.pixmap; val.stipple = physDev->brush.pixmap;
mask = GCStipple; mask = GCStipple;
break; break;
@ -159,7 +159,7 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors )
} }
val.ts_x_origin = dc->DCOrgX + dc->brushOrgX; val.ts_x_origin = dc->DCOrgX + dc->brushOrgX;
val.ts_y_origin = dc->DCOrgY + dc->brushOrgY; val.ts_y_origin = dc->DCOrgY + dc->brushOrgY;
val.fill_rule = (dc->polyFillMode==WINDING) ? WindingRule : EvenOddRule; val.fill_rule = (GetPolyFillMode(physDev->hdc) == WINDING) ? WindingRule : EvenOddRule;
TSXChangeGC( gdi_display, gc, TSXChangeGC( gdi_display, gc,
GCFunction | GCForeground | GCBackground | GCFillStyle | GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask, GCFillRule | GCTileStipXOrigin | GCTileStipYOrigin | mask,
@ -175,10 +175,9 @@ BOOL X11DRV_SetupGCForPatBlt( DC * dc, GC gc, BOOL fMapColors )
* Setup physDev->gc for drawing operations using current brush. * Setup physDev->gc for drawing operations using current brush.
* Return FALSE if brush is BS_NULL, TRUE otherwise. * Return FALSE if brush is BS_NULL, TRUE otherwise.
*/ */
BOOL X11DRV_SetupGCForBrush( DC * dc ) BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; return X11DRV_SetupGCForPatBlt( physDev, physDev->gc, FALSE );
return X11DRV_SetupGCForPatBlt( dc, physDev->gc, FALSE );
} }
@ -188,10 +187,10 @@ BOOL X11DRV_SetupGCForBrush( DC * dc )
* Setup physDev->gc for drawing operations using current pen. * Setup physDev->gc for drawing operations using current pen.
* Return FALSE if pen is PS_NULL, TRUE otherwise. * Return FALSE if pen is PS_NULL, TRUE otherwise.
*/ */
BOOL X11DRV_SetupGCForPen( DC * dc ) BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev )
{ {
XGCValues val; XGCValues val;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if (physDev->pen.style == PS_NULL) return FALSE; if (physDev->pen.style == PS_NULL) return FALSE;
@ -225,8 +224,7 @@ BOOL X11DRV_SetupGCForPen( DC * dc )
(physDev->pen.style != PS_INSIDEFRAME)) (physDev->pen.style != PS_INSIDEFRAME))
{ {
TSXSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len ); TSXSetDashes( gdi_display, physDev->gc, 0, physDev->pen.dashes, physDev->pen.dash_len );
val.line_style = (dc->backgroundMode == OPAQUE) ? val.line_style = (GetBkMode(dc->hSelf) == OPAQUE) ? LineDoubleDash : LineOnOffDash;
LineDoubleDash : LineOnOffDash;
} }
else val.line_style = LineSolid; else val.line_style = LineSolid;
val.line_width = physDev->pen.width; val.line_width = physDev->pen.width;
@ -271,9 +269,8 @@ BOOL X11DRV_SetupGCForPen( DC * dc )
* Setup physDev->gc for text drawing operations. * Setup physDev->gc for text drawing operations.
* Return FALSE if the font is null, TRUE otherwise. * Return FALSE if the font is null, TRUE otherwise.
*/ */
BOOL X11DRV_SetupGCForText( DC * dc ) BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
XFontStruct* xfs = XFONT_GetFontStruct( physDev->font ); XFontStruct* xfs = XFONT_GetFontStruct( physDev->font );
if( xfs ) if( xfs )
@ -299,15 +296,15 @@ BOOL X11DRV_SetupGCForText( DC * dc )
* X11DRV_LineTo * X11DRV_LineTo
*/ */
BOOL BOOL
X11DRV_LineTo( DC *dc, INT x, INT y ) X11DRV_LineTo( X11DRV_PDEVICE *physDev, INT x, INT y )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
POINT start; POINT start;
POINT end; POINT end;
if (X11DRV_SetupGCForPen( dc )) { if (X11DRV_SetupGCForPen( physDev )) {
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
start.x = dc->CursPosX; start.x = dc->CursPosX;
start.y = dc->CursPosY; start.y = dc->CursPosY;
@ -323,7 +320,7 @@ X11DRV_LineTo( DC *dc, INT x, INT y )
dc->DCOrgY + end.y); dc->DCOrgY + end.y);
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
} }
return TRUE; return TRUE;
} }
@ -338,7 +335,7 @@ X11DRV_LineTo( DC *dc, INT x, INT y )
* *
*/ */
static BOOL static BOOL
X11DRV_DrawArc( DC *dc, INT left, INT top, INT right, X11DRV_DrawArc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT bottom, INT xstart, INT ystart,
INT xend, INT yend, INT lines ) INT xend, INT yend, INT lines )
{ {
@ -346,7 +343,7 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right,
INT width, oldwidth, oldendcap; INT width, oldwidth, oldendcap;
double start_angle, end_angle; double start_angle, end_angle;
XPoint points[4]; XPoint points[4];
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
BOOL update = FALSE; BOOL update = FALSE;
left = XLPTODP( dc, left ); left = XLPTODP( dc, left );
@ -407,11 +404,11 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right,
if (idiff_angle <= 0) idiff_angle += 360 * 64; if (idiff_angle <= 0) idiff_angle += 360 * 64;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
/* Fill arc with brush if Chord() or Pie() */ /* Fill arc with brush if Chord() or Pie() */
if ((lines > 0) && X11DRV_SetupGCForBrush( dc )) { if ((lines > 0) && X11DRV_SetupGCForBrush( physDev )) {
TSXSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice); TSXSetArcMode( gdi_display, physDev->gc, (lines==1) ? ArcChord : ArcPieSlice);
TSXFillArc( gdi_display, physDev->drawable, physDev->gc, TSXFillArc( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + left, dc->DCOrgY + top, dc->DCOrgX + left, dc->DCOrgY + top,
@ -421,7 +418,7 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right,
/* Draw arc and lines */ /* Draw arc and lines */
if (X11DRV_SetupGCForPen( dc )){ if (X11DRV_SetupGCForPen( physDev )){
TSXDrawArc( gdi_display, physDev->drawable, physDev->gc, TSXDrawArc( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + left, dc->DCOrgY + top, dc->DCOrgX + left, dc->DCOrgY + top,
right-left-1, bottom-top-1, istart_angle, idiff_angle ); right-left-1, bottom-top-1, istart_angle, idiff_angle );
@ -485,7 +482,7 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right,
} }
/* Update the DIBSection of the pixmap */ /* Update the DIBSection of the pixmap */
X11DRV_UnlockDIBSection(dc, update); X11DRV_UnlockDIBSection(physDev, update);
physDev->pen.width = oldwidth; physDev->pen.width = oldwidth;
physDev->pen.endcap = oldendcap; physDev->pen.endcap = oldendcap;
@ -497,10 +494,10 @@ X11DRV_DrawArc( DC *dc, INT left, INT top, INT right,
* X11DRV_Arc * X11DRV_Arc
*/ */
BOOL BOOL
X11DRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom, X11DRV_Arc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return X11DRV_DrawArc( dc, left, top, right, bottom, return X11DRV_DrawArc( physDev, left, top, right, bottom,
xstart, ystart, xend, yend, 0 ); xstart, ystart, xend, yend, 0 );
} }
@ -509,10 +506,10 @@ X11DRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom,
* X11DRV_Pie * X11DRV_Pie
*/ */
BOOL BOOL
X11DRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom, X11DRV_Pie( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return X11DRV_DrawArc( dc, left, top, right, bottom, return X11DRV_DrawArc( physDev, left, top, right, bottom,
xstart, ystart, xend, yend, 2 ); xstart, ystart, xend, yend, 2 );
} }
@ -520,10 +517,10 @@ X11DRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom,
* X11DRV_Chord * X11DRV_Chord
*/ */
BOOL BOOL
X11DRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom, X11DRV_Chord( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend ) INT xstart, INT ystart, INT xend, INT yend )
{ {
return X11DRV_DrawArc( dc, left, top, right, bottom, return X11DRV_DrawArc( physDev, left, top, right, bottom,
xstart, ystart, xend, yend, 1 ); xstart, ystart, xend, yend, 1 );
} }
@ -532,10 +529,10 @@ X11DRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom,
* X11DRV_Ellipse * X11DRV_Ellipse
*/ */
BOOL BOOL
X11DRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom ) X11DRV_Ellipse( X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom )
{ {
INT width, oldwidth; INT width, oldwidth;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
BOOL update = FALSE; BOOL update = FALSE;
left = XLPTODP( dc, left ); left = XLPTODP( dc, left );
@ -564,16 +561,16 @@ X11DRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom )
physDev->pen.width = width; physDev->pen.width = width;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
if (X11DRV_SetupGCForBrush( dc )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
TSXFillArc( gdi_display, physDev->drawable, physDev->gc, TSXFillArc( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + left, dc->DCOrgY + top, dc->DCOrgX + left, dc->DCOrgY + top,
right-left-1, bottom-top-1, 0, 360*64 ); right-left-1, bottom-top-1, 0, 360*64 );
update = TRUE; update = TRUE;
} }
if (X11DRV_SetupGCForPen( dc )) if (X11DRV_SetupGCForPen( physDev ))
{ {
TSXDrawArc( gdi_display, physDev->drawable, physDev->gc, TSXDrawArc( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + left, dc->DCOrgY + top, dc->DCOrgX + left, dc->DCOrgY + top,
@ -582,7 +579,7 @@ X11DRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom )
} }
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, update); X11DRV_UnlockDIBSection(physDev, update);
physDev->pen.width = oldwidth; physDev->pen.width = oldwidth;
return TRUE; return TRUE;
@ -593,10 +590,10 @@ X11DRV_Ellipse( DC *dc, INT left, INT top, INT right, INT bottom )
* X11DRV_Rectangle * X11DRV_Rectangle
*/ */
BOOL BOOL
X11DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom) X11DRV_Rectangle(X11DRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom)
{ {
INT width, oldwidth, oldjoinstyle; INT width, oldwidth, oldjoinstyle;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
BOOL update = FALSE; BOOL update = FALSE;
TRACE("(%d %d %d %d)\n", TRACE("(%d %d %d %d)\n",
@ -632,10 +629,10 @@ X11DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
physDev->pen.linejoin = PS_JOIN_MITER; physDev->pen.linejoin = PS_JOIN_MITER;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
if ((right > left + width) && (bottom > top + width)) if ((right > left + width) && (bottom > top + width))
if (X11DRV_SetupGCForBrush( dc )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + left + (width + 1) / 2, dc->DCOrgX + left + (width + 1) / 2,
@ -643,7 +640,7 @@ X11DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
right-left-width-1, bottom-top-width-1); right-left-width-1, bottom-top-width-1);
update = TRUE; update = TRUE;
} }
if (X11DRV_SetupGCForPen( dc )) if (X11DRV_SetupGCForPen( physDev ))
{ {
TSXDrawRectangle( gdi_display, physDev->drawable, physDev->gc, TSXDrawRectangle( gdi_display, physDev->drawable, physDev->gc,
dc->DCOrgX + left, dc->DCOrgY + top, dc->DCOrgX + left, dc->DCOrgY + top,
@ -652,7 +649,7 @@ X11DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
} }
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, update); X11DRV_UnlockDIBSection(physDev, update);
physDev->pen.width = oldwidth; physDev->pen.width = oldwidth;
physDev->pen.linejoin = oldjoinstyle; physDev->pen.linejoin = oldjoinstyle;
@ -663,11 +660,11 @@ X11DRV_Rectangle(DC *dc, INT left, INT top, INT right, INT bottom)
* X11DRV_RoundRect * X11DRV_RoundRect
*/ */
BOOL BOOL
X11DRV_RoundRect( DC *dc, INT left, INT top, INT right, X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT ell_width, INT ell_height ) INT bottom, INT ell_width, INT ell_height )
{ {
INT width, oldwidth, oldendcap; INT width, oldwidth, oldendcap;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
BOOL update = FALSE; BOOL update = FALSE;
TRACE("(%d %d %d %d %d %d\n", TRACE("(%d %d %d %d %d %d\n",
@ -710,10 +707,10 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right,
physDev->pen.endcap = PS_ENDCAP_SQUARE; physDev->pen.endcap = PS_ENDCAP_SQUARE;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
wine_tsx11_lock(); wine_tsx11_lock();
if (X11DRV_SetupGCForBrush( dc )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
if (ell_width > (right-left) ) if (ell_width > (right-left) )
if (ell_height > (bottom-top) ) if (ell_height > (bottom-top) )
@ -787,7 +784,8 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right,
* BTW this stuff is optimized for an Xfree86 server * BTW this stuff is optimized for an Xfree86 server
* read the comments inside the X11DRV_DrawArc function * read the comments inside the X11DRV_DrawArc function
*/ */
if (X11DRV_SetupGCForPen(dc)) { if (X11DRV_SetupGCForPen( physDev ))
{
if (ell_width > (right-left) ) if (ell_width > (right-left) )
if (ell_height > (bottom-top) ) if (ell_height > (bottom-top) )
XDrawArc( gdi_display, physDev->drawable, physDev->gc, XDrawArc( gdi_display, physDev->drawable, physDev->gc,
@ -855,7 +853,7 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right,
} }
wine_tsx11_unlock(); wine_tsx11_unlock();
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, update); X11DRV_UnlockDIBSection(physDev, update);
physDev->pen.width = oldwidth; physDev->pen.width = oldwidth;
physDev->pen.endcap = oldendcap; physDev->pen.endcap = oldendcap;
@ -867,17 +865,17 @@ X11DRV_RoundRect( DC *dc, INT left, INT top, INT right,
* X11DRV_SetPixel * X11DRV_SetPixel
*/ */
COLORREF COLORREF
X11DRV_SetPixel( DC *dc, INT x, INT y, COLORREF color ) X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color )
{ {
Pixel pixel; Pixel pixel;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y ); x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y );
y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y ); y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y );
pixel = X11DRV_PALETTE_ToPhysical( dc, color ); pixel = X11DRV_PALETTE_ToPhysical( physDev, color );
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
/* inefficient but simple... */ /* inefficient but simple... */
wine_tsx11_lock(); wine_tsx11_lock();
@ -887,7 +885,7 @@ X11DRV_SetPixel( DC *dc, INT x, INT y, COLORREF color )
wine_tsx11_unlock(); wine_tsx11_unlock();
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
return X11DRV_PALETTE_ToLogical(pixel); return X11DRV_PALETTE_ToLogical(pixel);
} }
@ -897,15 +895,15 @@ X11DRV_SetPixel( DC *dc, INT x, INT y, COLORREF color )
* X11DRV_GetPixel * X11DRV_GetPixel
*/ */
COLORREF COLORREF
X11DRV_GetPixel( DC *dc, INT x, INT y ) X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y )
{ {
static Pixmap pixmap = 0; static Pixmap pixmap = 0;
XImage * image; XImage * image;
int pixel; int pixel;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y ); x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y );
y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y ); y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y );
@ -930,7 +928,7 @@ X11DRV_GetPixel( DC *dc, INT x, INT y )
wine_tsx11_unlock(); wine_tsx11_unlock();
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, FALSE); X11DRV_UnlockDIBSection(physDev, FALSE);
return X11DRV_PALETTE_ToLogical(pixel); return X11DRV_PALETTE_ToLogical(pixel);
} }
@ -940,12 +938,12 @@ X11DRV_GetPixel( DC *dc, INT x, INT y )
* X11DRV_PaintRgn * X11DRV_PaintRgn
*/ */
BOOL BOOL
X11DRV_PaintRgn( DC *dc, HRGN hrgn ) X11DRV_PaintRgn( X11DRV_PDEVICE *physDev, HRGN hrgn )
{ {
RECT box; RECT box;
HRGN tmpVisRgn, prevVisRgn; HRGN tmpVisRgn, prevVisRgn;
HDC hdc = dc->hSelf; /* FIXME: should not mix dc/hdc this way */ DC *dc = physDev->dc;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; HDC hdc = physDev->hdc; /* FIXME: should not mix dc/hdc this way */
if (!(tmpVisRgn = CreateRectRgn( 0, 0, 0, 0 ))) return FALSE; if (!(tmpVisRgn = CreateRectRgn( 0, 0, 0, 0 ))) return FALSE;
@ -968,17 +966,17 @@ X11DRV_PaintRgn( DC *dc, HRGN hrgn )
/* Fill the region */ /* Fill the region */
GetRgnBox( dc->hGCClipRgn, &box ); GetRgnBox( dc->hGCClipRgn, &box );
if (X11DRV_SetupGCForBrush( dc )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
box.left, box.top, box.left, box.top,
box.right-box.left, box.bottom-box.top ); box.right-box.left, box.bottom-box.top );
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
} }
/* Restore the visible region */ /* Restore the visible region */
@ -991,12 +989,12 @@ X11DRV_PaintRgn( DC *dc, HRGN hrgn )
* X11DRV_Polyline * X11DRV_Polyline
*/ */
BOOL BOOL
X11DRV_Polyline( DC *dc, const POINT* pt, INT count ) X11DRV_Polyline( X11DRV_PDEVICE *physDev, const POINT* pt, INT count )
{ {
INT oldwidth; INT oldwidth;
register int i; register int i;
XPoint *points; XPoint *points;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if((oldwidth = physDev->pen.width) == 0) physDev->pen.width = 1; if((oldwidth = physDev->pen.width) == 0) physDev->pen.width = 1;
@ -1011,16 +1009,16 @@ X11DRV_Polyline( DC *dc, const POINT* pt, INT count )
points[i].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt[i].x, pt[i].y ); points[i].y = dc->DCOrgY + INTERNAL_YWPTODP( dc, pt[i].x, pt[i].y );
} }
if (X11DRV_SetupGCForPen ( dc )) if (X11DRV_SetupGCForPen ( physDev ))
{ {
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, TSXDrawLines( gdi_display, physDev->drawable, physDev->gc,
points, count, CoordModeOrigin ); points, count, CoordModeOrigin );
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
} }
HeapFree( GetProcessHeap(), 0, points ); HeapFree( GetProcessHeap(), 0, points );
@ -1033,11 +1031,11 @@ X11DRV_Polyline( DC *dc, const POINT* pt, INT count )
* X11DRV_Polygon * X11DRV_Polygon
*/ */
BOOL BOOL
X11DRV_Polygon( DC *dc, const POINT* pt, INT count ) X11DRV_Polygon( X11DRV_PDEVICE *physDev, const POINT* pt, INT count )
{ {
register int i; register int i;
XPoint *points; XPoint *points;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
BOOL update = FALSE; BOOL update = FALSE;
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (count+1) ))) if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (count+1) )))
@ -1053,15 +1051,15 @@ X11DRV_Polygon( DC *dc, const POINT* pt, INT count )
points[count] = points[0]; points[count] = points[0];
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
if (X11DRV_SetupGCForBrush( dc )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
TSXFillPolygon( gdi_display, physDev->drawable, physDev->gc, TSXFillPolygon( gdi_display, physDev->drawable, physDev->gc,
points, count+1, Complex, CoordModeOrigin); points, count+1, Complex, CoordModeOrigin);
update = TRUE; update = TRUE;
} }
if (X11DRV_SetupGCForPen ( dc )) if (X11DRV_SetupGCForPen ( physDev ))
{ {
TSXDrawLines( gdi_display, physDev->drawable, physDev->gc, TSXDrawLines( gdi_display, physDev->drawable, physDev->gc,
points, count+1, CoordModeOrigin ); points, count+1, CoordModeOrigin );
@ -1069,7 +1067,7 @@ X11DRV_Polygon( DC *dc, const POINT* pt, INT count )
} }
/* Update the DIBSection from the pixmap */ /* Update the DIBSection from the pixmap */
X11DRV_UnlockDIBSection(dc, update); X11DRV_UnlockDIBSection(physDev, update);
HeapFree( GetProcessHeap(), 0, points ); HeapFree( GetProcessHeap(), 0, points );
return TRUE; return TRUE;
@ -1080,27 +1078,27 @@ X11DRV_Polygon( DC *dc, const POINT* pt, INT count )
* X11DRV_PolyPolygon * X11DRV_PolyPolygon
*/ */
BOOL BOOL
X11DRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons) X11DRV_PolyPolygon( X11DRV_PDEVICE *physDev, const POINT* pt, const INT* counts, UINT polygons)
{ {
HRGN hrgn; HRGN hrgn;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
/* FIXME: The points should be converted to device coords before */ /* FIXME: The points should be converted to device coords before */
/* creating the region. */ /* creating the region. */
hrgn = CreatePolyPolygonRgn( pt, counts, polygons, dc->polyFillMode ); hrgn = CreatePolyPolygonRgn( pt, counts, polygons, GetPolyFillMode( physDev->hdc ) );
X11DRV_PaintRgn( dc, hrgn ); X11DRV_PaintRgn( physDev, hrgn );
DeleteObject( hrgn ); DeleteObject( hrgn );
/* Draw the outline of the polygons */ /* Draw the outline of the polygons */
if (X11DRV_SetupGCForPen ( dc )) if (X11DRV_SetupGCForPen ( physDev ))
{ {
int i, j, max = 0; int i, j, max = 0;
XPoint *points; XPoint *points;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
for (i = 0; i < polygons; i++) if (counts[i] > max) max = counts[i]; for (i = 0; i < polygons; i++) if (counts[i] > max) max = counts[i];
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (max+1) ))) if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (max+1) )))
@ -1122,7 +1120,7 @@ X11DRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons)
} }
/* Update the DIBSection of the dc's bitmap */ /* Update the DIBSection of the dc's bitmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
HeapFree( GetProcessHeap(), 0, points ); HeapFree( GetProcessHeap(), 0, points );
} }
@ -1134,17 +1132,17 @@ X11DRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons)
* X11DRV_PolyPolyline * X11DRV_PolyPolyline
*/ */
BOOL BOOL
X11DRV_PolyPolyline( DC *dc, const POINT* pt, const DWORD* counts, DWORD polylines ) X11DRV_PolyPolyline( X11DRV_PDEVICE *physDev, const POINT* pt, const DWORD* counts, DWORD polylines )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if (X11DRV_SetupGCForPen ( dc )) if (X11DRV_SetupGCForPen ( physDev ))
{ {
int i, j, max = 0; int i, j, max = 0;
XPoint *points; XPoint *points;
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
for (i = 0; i < polylines; i++) if (counts[i] > max) max = counts[i]; for (i = 0; i < polylines; i++) if (counts[i] > max) max = counts[i];
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * max ))) if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * max )))
@ -1165,7 +1163,7 @@ X11DRV_PolyPolyline( DC *dc, const POINT* pt, const DWORD* counts, DWORD polylin
} }
/* Update the DIBSection of the dc's bitmap */ /* Update the DIBSection of the dc's bitmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
HeapFree( GetProcessHeap(), 0, points ); HeapFree( GetProcessHeap(), 0, points );
} }
@ -1180,12 +1178,11 @@ X11DRV_PolyPolyline( DC *dc, const POINT* pt, const DWORD* counts, DWORD polylin
* (xorg,yorg) is the origin of the X image relative to the drawable. * (xorg,yorg) is the origin of the X image relative to the drawable.
* (x,y) is relative to the origin of the X image. * (x,y) is relative to the origin of the X image.
*/ */
static void X11DRV_InternalFloodFill(XImage *image, DC *dc, static void X11DRV_InternalFloodFill(XImage *image, X11DRV_PDEVICE *physDev,
int x, int y, int x, int y,
int xOrg, int yOrg, int xOrg, int yOrg,
Pixel pixel, WORD fillType ) Pixel pixel, WORD fillType )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
int left, right; int left, right;
#define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \ #define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \
@ -1220,7 +1217,7 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
while ((x < right) && !TO_FLOOD(x,y)) x++; while ((x < right) && !TO_FLOOD(x,y)) x++;
if (x >= right) break; if (x >= right) break;
while ((x < right) && TO_FLOOD(x,y)) x++; while ((x < right) && TO_FLOOD(x,y)) x++;
X11DRV_InternalFloodFill(image, dc, x-1, y, X11DRV_InternalFloodFill(image, physDev, x-1, y,
xOrg, yOrg, pixel, fillType ); xOrg, yOrg, pixel, fillType );
} }
} }
@ -1235,7 +1232,7 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
while ((x < right) && !TO_FLOOD(x,y)) x++; while ((x < right) && !TO_FLOOD(x,y)) x++;
if (x >= right) break; if (x >= right) break;
while ((x < right) && TO_FLOOD(x,y)) x++; while ((x < right) && TO_FLOOD(x,y)) x++;
X11DRV_InternalFloodFill(image, dc, x-1, y, X11DRV_InternalFloodFill(image, physDev, x-1, y,
xOrg, yOrg, pixel, fillType ); xOrg, yOrg, pixel, fillType );
} }
} }
@ -1247,12 +1244,12 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
* X11DRV_ExtFloodFill * X11DRV_ExtFloodFill
*/ */
BOOL BOOL
X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color, X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y, COLORREF color,
UINT fillType ) UINT fillType )
{ {
XImage *image; XImage *image;
RECT rect; RECT rect;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
TRACE("X11DRV_ExtFloodFill %d,%d %06lx %d\n", x, y, color, fillType ); TRACE("X11DRV_ExtFloodFill %d,%d %06lx %d\n", x, y, color, fillType );
@ -1266,23 +1263,23 @@ X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color,
rect.bottom - rect.top, rect.bottom - rect.top,
AllPlanes, ZPixmap ))) return FALSE; AllPlanes, ZPixmap ))) return FALSE;
if (X11DRV_SetupGCForBrush( dc )) if (X11DRV_SetupGCForBrush( physDev ))
{ {
/* Update the pixmap from the DIB section */ /* Update the pixmap from the DIB section */
X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE); X11DRV_LockDIBSection(physDev, DIB_Status_GdiMod, FALSE);
/* ROP mode is always GXcopy for flood-fill */ /* ROP mode is always GXcopy for flood-fill */
wine_tsx11_lock(); wine_tsx11_lock();
XSetFunction( gdi_display, physDev->gc, GXcopy ); XSetFunction( gdi_display, physDev->gc, GXcopy );
X11DRV_InternalFloodFill(image, dc, X11DRV_InternalFloodFill(image, physDev,
XLPTODP(dc,x) + dc->DCOrgX - rect.left, XLPTODP(dc,x) + dc->DCOrgX - rect.left,
YLPTODP(dc,y) + dc->DCOrgY - rect.top, YLPTODP(dc,y) + dc->DCOrgY - rect.top,
rect.left, rect.top, rect.left, rect.top,
X11DRV_PALETTE_ToPhysical( dc, color ), X11DRV_PALETTE_ToPhysical( physDev, color ),
fillType ); fillType );
wine_tsx11_unlock(); wine_tsx11_unlock();
/* Update the DIBSection of the dc's bitmap */ /* Update the DIBSection of the dc's bitmap */
X11DRV_UnlockDIBSection(dc, TRUE); X11DRV_UnlockDIBSection(physDev, TRUE);
} }
TSXDestroyImage( image ); TSXDestroyImage( image );
@ -1293,44 +1290,29 @@ X11DRV_ExtFloodFill( DC *dc, INT x, INT y, COLORREF color,
* X11DRV_SetBkColor * X11DRV_SetBkColor
*/ */
COLORREF COLORREF
X11DRV_SetBkColor( DC *dc, COLORREF color ) X11DRV_SetBkColor( X11DRV_PDEVICE *physDev, COLORREF color )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; physDev->backgroundPixel = X11DRV_PALETTE_ToPhysical( physDev, color );
COLORREF oldColor; return color;
oldColor = dc->backgroundColor;
dc->backgroundColor = color;
physDev->backgroundPixel = X11DRV_PALETTE_ToPhysical( dc, color );
return oldColor;
} }
/********************************************************************** /**********************************************************************
* X11DRV_SetTextColor * X11DRV_SetTextColor
*/ */
COLORREF COLORREF
X11DRV_SetTextColor( DC *dc, COLORREF color ) X11DRV_SetTextColor( X11DRV_PDEVICE *physDev, COLORREF color )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; physDev->textPixel = X11DRV_PALETTE_ToPhysical( physDev, color );
COLORREF oldColor; return color;
oldColor = dc->textColor;
dc->textColor = color;
physDev->textPixel = X11DRV_PALETTE_ToPhysical( dc, color );
return oldColor;
} }
/*********************************************************************** /***********************************************************************
* X11DRV_GetDCOrgEx * X11DRV_GetDCOrgEx
*/ */
BOOL X11DRV_GetDCOrgEx( DC *dc, LPPOINT lpp ) BOOL X11DRV_GetDCOrgEx( X11DRV_PDEVICE *physDev, LPPOINT lpp )
{ {
if (!(dc->flags & DC_MEMORY)) if (!(physDev->dc->flags & DC_MEMORY))
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *) dc->physDev;
Window root; Window root;
int x, y, w, h, border, depth; int x, y, w, h, border, depth;

View File

@ -36,17 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
const DC_FUNCTIONS *X11DRV_DC_Funcs = NULL; /* hack */ const DC_FUNCTIONS *X11DRV_DC_Funcs = NULL; /* hack */
BITMAP_DRIVER X11DRV_BITMAP_Driver =
{
X11DRV_DIB_SetDIBits,
X11DRV_DIB_GetDIBits,
X11DRV_DIB_DeleteDIBSection,
X11DRV_DIB_SetDIBColorTable,
X11DRV_DIB_GetDIBColorTable,
X11DRV_DIB_Lock,
X11DRV_DIB_Unlock
};
PALETTE_DRIVER X11DRV_PALETTE_Driver = PALETTE_DRIVER X11DRV_PALETTE_Driver =
{ {
X11DRV_PALETTE_SetMapping, X11DRV_PALETTE_SetMapping,
@ -74,7 +63,6 @@ BOOL X11DRV_GDI_Initialize( Display *display )
Screen *screen = DefaultScreenOfDisplay(display); Screen *screen = DefaultScreenOfDisplay(display);
gdi_display = display; gdi_display = display;
BITMAP_Driver = &X11DRV_BITMAP_Driver;
PALETTE_Driver = &X11DRV_PALETTE_Driver; PALETTE_Driver = &X11DRV_PALETTE_Driver;
palette_size = X11DRV_PALETTE_Init(); palette_size = X11DRV_PALETTE_Init();
@ -114,12 +102,14 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
if (!X11DRV_DC_Funcs) X11DRV_DC_Funcs = dc->funcs; /* hack */ if (!X11DRV_DC_Funcs) X11DRV_DC_Funcs = dc->funcs; /* hack */
dc->physDev = physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, physDev = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*physDev) );
sizeof(*physDev) );
if(!physDev) { if(!physDev) {
ERR("Can't allocate physDev\n"); ERR("Can't allocate physDev\n");
return FALSE; return FALSE;
} }
dc->physDev = (PHYSDEV)physDev;
physDev->hdc = dc->hSelf;
physDev->dc = dc; /* FIXME */
if (dc->flags & DC_MEMORY) if (dc->flags & DC_MEMORY)
{ {
@ -172,12 +162,12 @@ BOOL X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
/********************************************************************** /**********************************************************************
* X11DRV_DeleteDC * X11DRV_DeleteDC
*/ */
BOOL X11DRV_DeleteDC( DC *dc ) BOOL X11DRV_DeleteDC( X11DRV_PDEVICE *physDev )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
if(physDev->xrender) if(physDev->xrender)
X11DRV_XRender_DeleteDC(dc); X11DRV_XRender_DeleteDC( physDev );
wine_tsx11_lock(); wine_tsx11_lock();
XFreeGC( gdi_display, physDev->gc ); XFreeGC( gdi_display, physDev->gc );
while (physDev->used_visuals-- > 0) while (physDev->used_visuals-- > 0)
@ -192,7 +182,7 @@ BOOL X11DRV_DeleteDC( DC *dc )
/*********************************************************************** /***********************************************************************
* GetDeviceCaps (X11DRV.@) * GetDeviceCaps (X11DRV.@)
*/ */
INT X11DRV_GetDeviceCaps( DC *dc, INT cap ) INT X11DRV_GetDeviceCaps( X11DRV_PDEVICE *physDev, INT cap )
{ {
switch(cap) switch(cap)
{ {
@ -254,7 +244,7 @@ INT X11DRV_GetDeviceCaps( DC *dc, INT cap )
case LOGPIXELSY: case LOGPIXELSY:
return log_pixels_y; return log_pixels_y;
case CAPS1: case CAPS1:
FIXME("(%04x): CAPS1 is unimplemented, will return 0\n", dc->hSelf ); FIXME("(%04x): CAPS1 is unimplemented, will return 0\n", physDev->hdc );
/* please see wingdi.h for the possible bit-flag values that need /* please see wingdi.h for the possible bit-flag values that need
to be returned. also, see to be returned. also, see
http://msdn.microsoft.com/library/ddkdoc/win95ddk/graphcnt_1m0p.htm */ http://msdn.microsoft.com/library/ddkdoc/win95ddk/graphcnt_1m0p.htm */
@ -275,7 +265,7 @@ INT X11DRV_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;
} }
} }
@ -284,11 +274,9 @@ INT X11DRV_GetDeviceCaps( DC *dc, INT cap )
/********************************************************************** /**********************************************************************
* ExtEscape (X11DRV.@) * ExtEscape (X11DRV.@)
*/ */
INT X11DRV_ExtEscape( DC *dc, INT escape, INT in_count, LPCVOID in_data, INT X11DRV_ExtEscape( X11DRV_PDEVICE *physDev, INT escape, INT in_count, LPCVOID in_data,
INT out_count, LPVOID out_data ) INT out_count, LPVOID out_data )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
switch(escape) switch(escape)
{ {
case QUERYESCSUPPORT: case QUERYESCSUPPORT:

View File

@ -29,25 +29,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdi); WINE_DEFAULT_DEBUG_CHANNEL(gdi);
/***********************************************************************
* X11DRV_SelectObject
*/
HGDIOBJ X11DRV_SelectObject( DC *dc, HGDIOBJ handle )
{
TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
switch(GetObjectType( handle ))
{
case OBJ_PEN: return X11DRV_PEN_SelectObject( dc, handle );
case OBJ_BRUSH: return X11DRV_BRUSH_SelectObject( dc, handle );
case OBJ_BITMAP: return X11DRV_BITMAP_SelectObject( dc, handle );
case OBJ_FONT: return X11DRV_FONT_SelectObject( dc, handle );
case OBJ_REGION: return (HGDIOBJ)SelectClipRgn( dc->hSelf, handle );
}
return 0;
}
/*********************************************************************** /***********************************************************************
* X11DRV_DeleteObject * X11DRV_DeleteObject
*/ */

View File

@ -765,8 +765,9 @@ COLORREF X11DRV_PALETTE_ToLogical(int pixel)
* *
* Return the physical color closest to 'color'. * Return the physical color closest to 'color'.
*/ */
int X11DRV_PALETTE_ToPhysical( DC *dc, COLORREF color ) int X11DRV_PALETTE_ToPhysical( X11DRV_PDEVICE *physDev, COLORREF color )
{ {
DC *dc = physDev ? physDev->dc : NULL;
WORD index = 0; WORD index = 0;
HPALETTE16 hPal = (dc)? dc->hPalette: GetStockObject(DEFAULT_PALETTE); HPALETTE16 hPal = (dc)? dc->hPalette: GetStockObject(DEFAULT_PALETTE);
unsigned char spec_type = color >> 24; unsigned char spec_type = color >> 24;

View File

@ -32,17 +32,15 @@ static const char PEN_dashdotdot[] = { 12,4,4,4,4,4 };
static const char PEN_alternate[] = { 1,1 }; static const char PEN_alternate[] = { 1,1 };
/*********************************************************************** /***********************************************************************
* PEN_SelectObject * X11DRV_SelectPen (X11DRV.@)
*/ */
HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen ) HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen )
{ {
LOGPEN logpen; LOGPEN logpen;
HPEN prevHandle = dc->hPen; DC *dc = physDev->dc;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0; if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0;
dc->hPen = hpen;
physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK; physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK;
physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK; physDev->pen.type = logpen.lopnStyle & PS_TYPE_MASK;
physDev->pen.endcap = logpen.lopnStyle & PS_ENDCAP_MASK; physDev->pen.endcap = logpen.lopnStyle & PS_ENDCAP_MASK;
@ -52,7 +50,7 @@ HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen )
dc->xformWorld2Vport.eM11 * 0.5); dc->xformWorld2Vport.eM11 * 0.5);
if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width; if (physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */ if (physDev->pen.width == 1) physDev->pen.width = 0; /* Faster */
physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( dc, logpen.lopnColor ); physDev->pen.pixel = X11DRV_PALETTE_ToPhysical( physDev, logpen.lopnColor );
switch(logpen.lopnStyle & PS_STYLE_MASK) switch(logpen.lopnStyle & PS_STYLE_MASK)
{ {
case PS_DASH: case PS_DASH:
@ -79,6 +77,5 @@ HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen )
FIXME("PS_USERSTYLE is not supported\n"); FIXME("PS_USERSTYLE is not supported\n");
break; break;
} }
return hpen;
return prevHandle;
} }

View File

@ -44,7 +44,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(text);
* X11DRV_ExtTextOut * X11DRV_ExtTextOut
*/ */
BOOL BOOL
X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags, X11DRV_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 )
{ {
@ -55,18 +55,17 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
RECT rect; RECT rect;
char dfBreakChar, lfUnderline, lfStrikeOut; char dfBreakChar, lfUnderline, lfStrikeOut;
BOOL rotated = FALSE; BOOL rotated = FALSE;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
XChar2b *str2b = NULL; XChar2b *str2b = NULL;
BOOL dibUpdateFlag = FALSE; BOOL dibUpdateFlag = FALSE;
BOOL result = TRUE; BOOL result = TRUE;
DC *dc = physDev->dc;
if(dc->gdiFont) if(dc->gdiFont)
return X11DRV_XRender_ExtTextOut(dc, x, y, flags, lprect, wstr, count, return X11DRV_XRender_ExtTextOut(physDev, x, y, flags, lprect, wstr, count,
lpDx); lpDx);
if (!X11DRV_SetupGCForText( dc )) return TRUE; if (!X11DRV_SetupGCForText( physDev )) return TRUE;
pfo = XFONT_GetFontObject( physDev->font ); pfo = XFONT_GetFontObject( physDev->font );
font = pfo->fs; font = pfo->fs;
@ -104,7 +103,7 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
SIZE sz; SIZE sz;
if (flags & ETO_CLIPPED) /* Can't clip with no rectangle */ if (flags & ETO_CLIPPED) /* Can't clip with no rectangle */
return FALSE; return FALSE;
if (!X11DRV_GetTextExtentPoint( dc, wstr, count, &sz )) if (!X11DRV_GetTextExtentPoint( physDev, wstr, count, &sz ))
return FALSE; return FALSE;
rect.left = INTERNAL_XWPTODP( dc, x, y ); rect.left = INTERNAL_XWPTODP( dc, x, y );
rect.right = INTERNAL_XWPTODP( dc, x+sz.cx, y+sz.cy ); rect.right = INTERNAL_XWPTODP( dc, x+sz.cx, y+sz.cy );
@ -132,7 +131,7 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
if (flags & ETO_OPAQUE) if (flags & ETO_OPAQUE)
{ {
X11DRV_LockDIBSection( dc, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
dibUpdateFlag = TRUE; dibUpdateFlag = TRUE;
TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel ); TSXSetForeground( gdi_display, physDev->gc, physDev->backgroundPixel );
TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc, TSXFillRectangle( gdi_display, physDev->drawable, physDev->gc,
@ -151,7 +150,7 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
else else
{ {
SIZE sz; SIZE sz;
if (!X11DRV_GetTextExtentPoint( dc, wstr, count, &sz )) if (!X11DRV_GetTextExtentPoint( physDev, wstr, count, &sz ))
return FALSE; return FALSE;
width = INTERNAL_XWSTODS(dc, sz.cx); width = INTERNAL_XWSTODS(dc, sz.cx);
} }
@ -215,11 +214,11 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
if (!dibUpdateFlag) if (!dibUpdateFlag)
{ {
X11DRV_LockDIBSection( dc, DIB_Status_GdiMod, FALSE ); X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod, FALSE );
dibUpdateFlag = TRUE; dibUpdateFlag = TRUE;
} }
if (dc->backgroundMode != TRANSPARENT) if (GetBkMode( physDev->hdc ) != TRANSPARENT)
{ {
/* If rectangle is opaque and clipped, do nothing */ /* If rectangle is opaque and clipped, do nothing */
if (!(flags & ETO_CLIPPED) || !(flags & ETO_OPAQUE)) if (!(flags & ETO_CLIPPED) || !(flags & ETO_OPAQUE))
@ -406,7 +405,7 @@ FAIL:
result = FALSE; result = FALSE;
END: END:
if (dibUpdateFlag) X11DRV_UnlockDIBSection( dc, TRUE ); if (dibUpdateFlag) X11DRV_UnlockDIBSection( physDev, TRUE );
return result; return result;
} }
@ -414,10 +413,10 @@ END:
/*********************************************************************** /***********************************************************************
* X11DRV_GetTextExtentPoint * X11DRV_GetTextExtentPoint
*/ */
BOOL X11DRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count, BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count,
LPSIZE size ) LPSIZE size )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
fontObject* pfo = XFONT_GetFontObject( physDev->font ); fontObject* pfo = XFONT_GetFontObject( physDev->font );
TRACE("%s %d\n", debugstr_wn(str,count), count); TRACE("%s %d\n", debugstr_wn(str,count), count);

View File

@ -3182,13 +3182,13 @@ LPIFONTINFO16 XFONT_GetFontInfo( X_PHYSFONT pFont )
* * * *
***********************************************************************/ ***********************************************************************/
/*********************************************************************** /***********************************************************************
* X11DRV_FONT_SelectObject * X11DRV_SelectFont (X11DRV.@)
*/ */
HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont ) HFONT X11DRV_SelectFont( X11DRV_PDEVICE *physDev, HFONT hfont )
{ {
LOGFONTW logfont; LOGFONTW logfont;
LOGFONT16 lf; LOGFONT16 lf;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev; DC *dc = physDev->dc;
TRACE("dc=%p, hfont=%04x\n", dc, hfont); TRACE("dc=%p, hfont=%04x\n", dc, hfont);
@ -3197,7 +3197,7 @@ HFONT X11DRV_FONT_SelectObject( DC* dc, HFONT hfont )
TRACE("dc->gdiFont = %p\n", dc->gdiFont); TRACE("dc->gdiFont = %p\n", dc->gdiFont);
if(dc->gdiFont && X11DRV_XRender_Installed) { if(dc->gdiFont && X11DRV_XRender_Installed) {
X11DRV_XRender_SelectFont(dc, hfont); X11DRV_XRender_SelectFont(physDev, hfont);
return FALSE; return FALSE;
} }
@ -3326,9 +3326,8 @@ BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
/*********************************************************************** /***********************************************************************
* X11DRV_GetTextMetrics * X11DRV_GetTextMetrics
*/ */
BOOL X11DRV_GetTextMetrics(DC *dc, TEXTMETRICW *metrics) BOOL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics)
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
TEXTMETRICA tmA; TEXTMETRICA tmA;
if( CHECK_PFONT(physDev->font) ) if( CHECK_PFONT(physDev->font) )
@ -3345,10 +3344,9 @@ BOOL X11DRV_GetTextMetrics(DC *dc, TEXTMETRICW *metrics)
/*********************************************************************** /***********************************************************************
* X11DRV_GetCharWidth * X11DRV_GetCharWidth
*/ */
BOOL X11DRV_GetCharWidth( DC *dc, UINT firstChar, UINT lastChar, BOOL X11DRV_GetCharWidth( X11DRV_PDEVICE *physDev, UINT firstChar, UINT lastChar,
LPINT buffer ) LPINT buffer )
{ {
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
fontObject* pfo = XFONT_GetFontObject( physDev->font ); fontObject* pfo = XFONT_GetFontObject( physDev->font );
if( pfo ) if( pfo )

View File

@ -23,8 +23,6 @@
#include "gdi.h" #include "gdi.h"
struct tagGDI_BITMAP_DRIVER;
/* Flags used for BitmapBits. We only use the first two at the moment */ /* Flags used for BitmapBits. We only use the first two at the moment */
#define DDB_SET 1 #define DDB_SET 1
@ -48,19 +46,6 @@ typedef struct tagBITMAPOBJ
SEGPTR segptr_bits; /* segptr to DIB bits */ SEGPTR segptr_bits; /* segptr to DIB bits */
} BITMAPOBJ; } BITMAPOBJ;
typedef struct tagBITMAP_DRIVER
{
INT (*pSetDIBits)(struct tagBITMAPOBJ *,struct tagDC *,UINT,UINT,LPCVOID,const BITMAPINFO *,UINT,HBITMAP);
INT (*pGetDIBits)(struct tagBITMAPOBJ *,struct tagDC *,UINT,UINT,LPVOID,BITMAPINFO *,UINT,HBITMAP);
VOID (*pDeleteDIBSection)(struct tagBITMAPOBJ *);
UINT (*pSetDIBColorTable)(struct tagBITMAPOBJ *,struct tagDC *,UINT,UINT,const RGBQUAD *);
UINT (*pGetDIBColorTable)(struct tagBITMAPOBJ *,struct tagDC *,UINT,UINT,RGBQUAD *);
INT (*pLockDIB)(struct tagBITMAPOBJ *,INT,BOOL);
VOID (*pUnlockDIB)(struct tagBITMAPOBJ *,BOOL);
} BITMAP_DRIVER;
extern BITMAP_DRIVER *BITMAP_Driver;
/* objects/bitmap.c */ /* objects/bitmap.c */
extern INT16 BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer ); extern INT16 BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer );
extern INT BITMAP_GetObject( BITMAPOBJ * bmp, INT count, LPVOID buffer ); extern INT BITMAP_GetObject( BITMAPOBJ * bmp, INT count, LPVOID buffer );
@ -77,7 +62,6 @@ extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, DWORD *width,
extern HBITMAP DIB_CreateDIBSection( HDC hdc, BITMAPINFO *bmi, UINT usage, LPVOID *bits, extern HBITMAP DIB_CreateDIBSection( HDC hdc, BITMAPINFO *bmi, UINT usage, LPVOID *bits,
HANDLE section, DWORD offset, DWORD ovr_pitch ); HANDLE section, DWORD offset, DWORD ovr_pitch );
extern void DIB_UpdateDIBSection( DC *dc, BOOL toDIB ); extern void DIB_UpdateDIBSection( DC *dc, BOOL toDIB );
extern void DIB_DeleteDIBSection( BITMAPOBJ *bmp );
extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp ); extern void DIB_SelectDIBSection( DC *dc, BITMAPOBJ *bmp );
extern HGLOBAL DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp); extern HGLOBAL DIB_CreateDIBFromBitmap(HDC hdc, HBITMAP hBmp);

View File

@ -62,12 +62,14 @@ typedef struct tagGDIOBJHDR
typedef struct tagGdiFont *GdiFont; typedef struct tagGdiFont *GdiFont;
typedef struct { int opaque; } *PHYSDEV; /* PHYSDEV is an opaque pointer */
typedef struct tagDC typedef struct tagDC
{ {
GDIOBJHDR header; GDIOBJHDR header;
HDC hSelf; /* Handle to this DC */ HDC hSelf; /* Handle to this DC */
const struct tagDC_FUNCS *funcs; /* DC function table */ const struct tagDC_FUNCS *funcs; /* DC function table */
void *physDev; /* Physical device (driver-specific) */ PHYSDEV physDev; /* Physical device (driver-specific) */
INT saveLevel; INT saveLevel;
DWORD dwHookData; DWORD dwHookData;
FARPROC16 hookProc; /* the original SEGPTR ... */ FARPROC16 hookProc; /* the original SEGPTR ... */
@ -138,108 +140,113 @@ typedef INT (*DEVICEFONTENUMPROC)(LPENUMLOGFONTEXW,LPNEWTEXTMETRICEXW,DWORD,
typedef struct tagDC_FUNCS typedef struct tagDC_FUNCS
{ {
INT (*pAbortDoc)(DC*); INT (*pAbortDoc)(PHYSDEV);
BOOL (*pAbortPath)(DC*); BOOL (*pAbortPath)(PHYSDEV);
BOOL (*pAngleArc)(DC*,INT,INT,DWORD,FLOAT,FLOAT); BOOL (*pAngleArc)(PHYSDEV,INT,INT,DWORD,FLOAT,FLOAT);
BOOL (*pArc)(DC*,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pArc)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pArcTo)(DC*,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pArcTo)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pBeginPath)(DC*); BOOL (*pBeginPath)(PHYSDEV);
BOOL (*pBitBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,DWORD); BOOL (*pBitBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,DWORD);
LONG (*pBitmapBits)(HBITMAP,void*,LONG,WORD); LONG (*pBitmapBits)(HBITMAP,void*,LONG,WORD);
INT (*pChoosePixelFormat)(DC*,const PIXELFORMATDESCRIPTOR *); INT (*pChoosePixelFormat)(PHYSDEV,const PIXELFORMATDESCRIPTOR *);
BOOL (*pChord)(DC*,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pChord)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCloseFigure)(DC*); BOOL (*pCloseFigure)(PHYSDEV);
BOOL (*pCreateBitmap)(HBITMAP); BOOL (*pCreateBitmap)(HBITMAP);
BOOL (*pCreateDC)(DC *,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*); BOOL (*pCreateDC)(DC *,LPCSTR,LPCSTR,LPCSTR,const DEVMODEA*);
HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE, HBITMAP (*pCreateDIBSection)(PHYSDEV,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD,DWORD);
DWORD,DWORD); BOOL (*pDeleteDC)(PHYSDEV);
BOOL (*pDeleteDC)(DC*);
BOOL (*pDeleteObject)(HGDIOBJ); BOOL (*pDeleteObject)(HGDIOBJ);
INT (*pDescribePixelFormat)(DC *,INT,UINT,PIXELFORMATDESCRIPTOR *); INT (*pDescribePixelFormat)(PHYSDEV,INT,UINT,PIXELFORMATDESCRIPTOR *);
DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA); DWORD (*pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA);
BOOL (*pEllipse)(DC*,INT,INT,INT,INT); BOOL (*pEllipse)(PHYSDEV,INT,INT,INT,INT);
INT (*pEndDoc)(DC*); INT (*pEndDoc)(PHYSDEV);
INT (*pEndPage)(DC*); INT (*pEndPage)(PHYSDEV);
BOOL (*pEndPath)(DC*); BOOL (*pEndPath)(PHYSDEV);
BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM); BOOL (*pEnumDeviceFonts)(HDC,LPLOGFONTW,DEVICEFONTENUMPROC,LPARAM);
INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT); INT (*pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD); INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
INT (*pExtEscape)(DC*,INT,INT,LPCVOID,INT,LPVOID); INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
BOOL (*pExtFloodFill)(DC*,INT,INT,COLORREF,UINT); BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
BOOL (*pExtTextOut)(DC*,INT,INT,UINT,const RECT*,LPCWSTR,UINT, BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const RECT*,LPCWSTR,UINT,const INT*);
const INT*); BOOL (*pFillPath)(PHYSDEV);
BOOL (*pFillPath)(DC*); BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
BOOL (*pFillRgn)(DC*,HRGN,HBRUSH); BOOL (*pFlattenPath)(PHYSDEV);
BOOL (*pFlattenPath)(DC*); BOOL (*pFrameRgn)(PHYSDEV,HRGN,HBRUSH,INT,INT);
BOOL (*pFrameRgn)(DC*,HRGN,HBRUSH,INT,INT); BOOL (*pGetCharWidth)(PHYSDEV,UINT,UINT,LPINT);
BOOL (*pGetCharWidth)(DC*,UINT,UINT,LPINT); BOOL (*pGetDCOrgEx)(PHYSDEV,LPPOINT);
BOOL (*pGetDCOrgEx)(DC*,LPPOINT); UINT (*pGetDIBColorTable)(PHYSDEV,UINT,UINT,RGBQUAD*);
INT (*pGetDeviceCaps)(DC*,INT); INT (*pGetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPVOID,BITMAPINFO*,UINT);
BOOL (*pGetDeviceGammaRamp)(DC*,LPVOID); INT (*pGetDeviceCaps)(PHYSDEV,INT);
COLORREF (*pGetPixel)(DC*,INT,INT); BOOL (*pGetDeviceGammaRamp)(PHYSDEV,LPVOID);
INT (*pGetPixelFormat)(DC*); COLORREF (*pGetPixel)(PHYSDEV,INT,INT);
BOOL (*pGetTextExtentPoint)(DC*,LPCWSTR,INT,LPSIZE); INT (*pGetPixelFormat)(PHYSDEV);
BOOL (*pGetTextMetrics)(DC*,TEXTMETRICW*); BOOL (*pGetTextExtentPoint)(PHYSDEV,LPCWSTR,INT,LPSIZE);
INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT); BOOL (*pGetTextMetrics)(PHYSDEV,TEXTMETRICW*);
BOOL (*pInvertRgn)(DC*,HRGN); INT (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
BOOL (*pLineTo)(DC*,INT,INT); BOOL (*pInvertRgn)(PHYSDEV,HRGN);
BOOL (*pMoveTo)(DC*,INT,INT); BOOL (*pLineTo)(PHYSDEV,INT,INT);
INT (*pOffsetClipRgn)(DC*,INT,INT); BOOL (*pMoveTo)(PHYSDEV,INT,INT);
BOOL (*pOffsetViewportOrg)(DC*,INT,INT); INT (*pOffsetClipRgn)(PHYSDEV,INT,INT);
BOOL (*pOffsetWindowOrg)(DC*,INT,INT); BOOL (*pOffsetViewportOrg)(PHYSDEV,INT,INT);
BOOL (*pPaintRgn)(DC*,HRGN); BOOL (*pOffsetWindowOrg)(PHYSDEV,INT,INT);
BOOL (*pPatBlt)(DC*,INT,INT,INT,INT,DWORD); BOOL (*pPaintRgn)(PHYSDEV,HRGN);
BOOL (*pPie)(DC*,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pPatBlt)(PHYSDEV,INT,INT,INT,INT,DWORD);
BOOL (*pPolyBezier)(DC*,const POINT*,DWORD); BOOL (*pPie)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pPolyBezierTo)(DC*,const POINT*,DWORD); BOOL (*pPolyBezier)(PHYSDEV,const POINT*,DWORD);
BOOL (*pPolyDraw)(DC*,const POINT*,const BYTE *,DWORD); BOOL (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
BOOL (*pPolyPolygon)(DC*,const POINT*,const INT*,UINT); BOOL (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE *,DWORD);
BOOL (*pPolyPolyline)(DC*,const POINT*,const DWORD*,DWORD); BOOL (*pPolyPolygon)(PHYSDEV,const POINT*,const INT*,UINT);
BOOL (*pPolygon)(DC*,const POINT*,INT); BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const DWORD*,DWORD);
BOOL (*pPolyline)(DC*,const POINT*,INT); BOOL (*pPolygon)(PHYSDEV,const POINT*,INT);
BOOL (*pPolylineTo)(DC*,const POINT*,INT); BOOL (*pPolyline)(PHYSDEV,const POINT*,INT);
UINT (*pRealizePalette)(DC*); BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT);
BOOL (*pRectangle)(DC*,INT,INT,INT,INT); UINT (*pRealizePalette)(PHYSDEV);
BOOL (*pRestoreDC)(DC*,INT); BOOL (*pRectangle)(PHYSDEV,INT,INT,INT,INT);
BOOL (*pRoundRect)(DC*,INT,INT,INT,INT,INT,INT); BOOL (*pRestoreDC)(PHYSDEV,INT);
INT (*pSaveDC)(DC*); BOOL (*pRoundRect)(PHYSDEV,INT,INT,INT,INT,INT,INT);
BOOL (*pScaleViewportExt)(DC*,INT,INT,INT,INT); INT (*pSaveDC)(PHYSDEV);
BOOL (*pScaleWindowExt)(DC*,INT,INT,INT,INT); BOOL (*pScaleViewportExt)(PHYSDEV,INT,INT,INT,INT);
BOOL (*pSelectClipPath)(DC*,INT); BOOL (*pScaleWindowExt)(PHYSDEV,INT,INT,INT,INT);
INT (*pSelectClipRgn)(DC*,HRGN); HBITMAP (*pSelectBitmap)(PHYSDEV,HBITMAP);
HANDLE (*pSelectObject)(DC*,HANDLE); HBRUSH (*pSelectBrush)(PHYSDEV,HBRUSH);
HPALETTE (*pSelectPalette)(DC*,HPALETTE,BOOL); BOOL (*pSelectClipPath)(PHYSDEV,INT);
COLORREF (*pSetBkColor)(DC*,COLORREF); INT (*pSelectClipRgn)(PHYSDEV,HRGN);
INT (*pSetBkMode)(DC*,INT); HFONT (*pSelectFont)(PHYSDEV,HFONT);
VOID (*pSetDeviceClipping)(DC*); HPALETTE (*pSelectPalette)(PHYSDEV,HPALETTE,BOOL);
BOOL (*pSetDeviceGammaRamp)(DC*,LPVOID); HPEN (*pSelectPen)(PHYSDEV,HPEN);
INT (*pSetDIBitsToDevice)(DC*,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT, COLORREF (*pSetBkColor)(PHYSDEV,COLORREF);
LPCVOID,const BITMAPINFO*,UINT); INT (*pSetBkMode)(PHYSDEV,INT);
INT (*pSetMapMode)(DC*,INT); UINT (*pSetDIBColorTable)(PHYSDEV,UINT,UINT,const RGBQUAD*);
DWORD (*pSetMapperFlags)(DC*,DWORD); INT (*pSetDIBits)(PHYSDEV,HBITMAP,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF); INT (*pSetDIBitsToDevice)(PHYSDEV,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,
BOOL (*pSetPixelFormat)(DC*,INT,const PIXELFORMATDESCRIPTOR *); const BITMAPINFO*,UINT);
INT (*pSetPolyFillMode)(DC*,INT); VOID (*pSetDeviceClipping)(PHYSDEV);
INT (*pSetROP2)(DC*,INT); BOOL (*pSetDeviceGammaRamp)(PHYSDEV,LPVOID);
INT (*pSetRelAbs)(DC*,INT); INT (*pSetMapMode)(PHYSDEV,INT);
INT (*pSetStretchBltMode)(DC*,INT); DWORD (*pSetMapperFlags)(PHYSDEV,DWORD);
UINT (*pSetTextAlign)(DC*,UINT); COLORREF (*pSetPixel)(PHYSDEV,INT,INT,COLORREF);
INT (*pSetTextCharacterExtra)(DC*,INT); BOOL (*pSetPixelFormat)(PHYSDEV,INT,const PIXELFORMATDESCRIPTOR *);
DWORD (*pSetTextColor)(DC*,DWORD); INT (*pSetPolyFillMode)(PHYSDEV,INT);
INT (*pSetTextJustification)(DC*,INT,INT); INT (*pSetROP2)(PHYSDEV,INT);
BOOL (*pSetViewportExt)(DC*,INT,INT); INT (*pSetRelAbs)(PHYSDEV,INT);
BOOL (*pSetViewportOrg)(DC*,INT,INT); INT (*pSetStretchBltMode)(PHYSDEV,INT);
BOOL (*pSetWindowExt)(DC*,INT,INT); UINT (*pSetTextAlign)(PHYSDEV,UINT);
BOOL (*pSetWindowOrg)(DC*,INT,INT); INT (*pSetTextCharacterExtra)(PHYSDEV,INT);
INT (*pStartDoc)(DC*,const DOCINFOA*); DWORD (*pSetTextColor)(PHYSDEV,DWORD);
INT (*pStartPage)(DC*); INT (*pSetTextJustification)(PHYSDEV,INT,INT);
BOOL (*pStretchBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,INT,INT,DWORD); BOOL (*pSetViewportExt)(PHYSDEV,INT,INT);
INT (*pStretchDIBits)(DC*,INT,INT,INT,INT,INT,INT,INT,INT, BOOL (*pSetViewportOrg)(PHYSDEV,INT,INT);
const void *,const BITMAPINFO *,UINT,DWORD); BOOL (*pSetWindowExt)(PHYSDEV,INT,INT);
BOOL (*pStrokeAndFillPath)(DC*); BOOL (*pSetWindowOrg)(PHYSDEV,INT,INT);
BOOL (*pStrokePath)(DC*); INT (*pStartDoc)(PHYSDEV,const DOCINFOA*);
BOOL (*pSwapBuffers)(DC*); INT (*pStartPage)(PHYSDEV);
BOOL (*pWidenPath)(DC*); BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD);
INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *,
const BITMAPINFO*,UINT,DWORD);
BOOL (*pStrokeAndFillPath)(PHYSDEV);
BOOL (*pStrokePath)(PHYSDEV);
BOOL (*pSwapBuffers)(PHYSDEV);
BOOL (*pWidenPath)(PHYSDEV);
} DC_FUNCTIONS; } DC_FUNCTIONS;
/* DC hook codes */ /* DC hook codes */

View File

@ -45,8 +45,6 @@
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
struct tagCURSORICONINFO; struct tagCURSORICONINFO;
struct tagDC;
struct tagDeviceCaps;
struct tagPALETTEOBJ; struct tagPALETTEOBJ;
struct tagWINDOWPOS; struct tagWINDOWPOS;
@ -80,6 +78,8 @@ typedef struct tagXRENDERINFO *XRENDERINFO;
/* X physical device */ /* X physical device */
typedef struct typedef struct
{ {
HDC hdc;
DC *dc; /* direct pointer to DC, should go away */
GC gc; /* X Window GC */ GC gc; /* X Window GC */
Drawable drawable; Drawable drawable;
X_PHYSFONT font; X_PHYSFONT font;
@ -105,77 +105,75 @@ extern unsigned int X11DRV_server_startticks;
/* Wine driver X11 functions */ /* Wine driver X11 functions */
extern BOOL X11DRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst, extern BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT width, INT height, struct tagDC *dcSrc, INT width, INT height, X11DRV_PDEVICE *physDevSrc,
INT xSrc, INT ySrc, DWORD rop ); INT xSrc, INT ySrc, DWORD rop );
extern BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf, extern BOOL X11DRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
DEVICEFONTENUMPROC dfeproc, LPARAM lp ); DEVICEFONTENUMPROC dfeproc, LPARAM lp );
extern BOOL X11DRV_GetCharWidth( struct tagDC *dc, UINT firstChar, extern BOOL X11DRV_GetCharWidth( X11DRV_PDEVICE *physDev, UINT firstChar,
UINT lastChar, LPINT buffer ); UINT lastChar, LPINT buffer );
extern BOOL X11DRV_GetDCOrgEx( struct tagDC *dc, LPPOINT lpp ); extern BOOL X11DRV_GetDCOrgEx( X11DRV_PDEVICE *physDev, LPPOINT lpp );
extern BOOL X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCWSTR str, extern BOOL X11DRV_GetTextExtentPoint( X11DRV_PDEVICE *physDev, LPCWSTR str,
INT count, LPSIZE size ); INT count, LPSIZE size );
extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICW *metrics); extern BOOL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics);
extern BOOL X11DRV_PatBlt( struct tagDC *dc, INT left, INT top, extern BOOL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top,
INT width, INT height, DWORD rop ); INT width, INT height, DWORD rop );
extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc); extern VOID X11DRV_SetDeviceClipping(X11DRV_PDEVICE *physDev);
extern BOOL X11DRV_StretchBlt( struct tagDC *dcDst, INT xDst, INT yDst, extern BOOL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthDst, INT heightDst,
struct tagDC *dcSrc, INT xSrc, INT ySrc, X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop ); INT widthSrc, INT heightSrc, DWORD rop );
extern BOOL X11DRV_LineTo( struct tagDC *dc, INT x, INT y); extern BOOL X11DRV_LineTo( X11DRV_PDEVICE *physDev, INT x, INT y);
extern BOOL X11DRV_Arc( struct tagDC *dc, INT left, INT top, INT right, extern BOOL X11DRV_Arc( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL X11DRV_Pie( struct tagDC *dc, INT left, INT top, INT right, extern BOOL X11DRV_Pie( X11DRV_PDEVICE *physDev, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend, INT bottom, INT xstart, INT ystart, INT xend,
INT yend ); INT yend );
extern BOOL X11DRV_Chord( struct tagDC *dc, INT left, INT top, extern BOOL X11DRV_Chord( X11DRV_PDEVICE *physDev, INT left, INT top,
INT right, INT bottom, INT xstart, INT right, INT bottom, INT xstart,
INT ystart, INT xend, INT yend ); INT ystart, INT xend, INT yend );
extern BOOL X11DRV_Ellipse( struct tagDC *dc, INT left, INT top, extern BOOL X11DRV_Ellipse( X11DRV_PDEVICE *physDev, INT left, INT top,
INT right, INT bottom ); INT right, INT bottom );
extern BOOL X11DRV_Rectangle(struct tagDC *dc, INT left, INT top, extern BOOL X11DRV_Rectangle(X11DRV_PDEVICE *physDev, INT left, INT top,
INT right, INT bottom); INT right, INT bottom);
extern BOOL X11DRV_RoundRect( struct tagDC *dc, INT left, INT top, extern BOOL X11DRV_RoundRect( X11DRV_PDEVICE *physDev, INT left, INT top,
INT right, INT bottom, INT ell_width, INT right, INT bottom, INT ell_width,
INT ell_height ); INT ell_height );
extern COLORREF X11DRV_SetPixel( struct tagDC *dc, INT x, INT y, extern COLORREF X11DRV_SetPixel( X11DRV_PDEVICE *physDev, INT x, INT y,
COLORREF color ); COLORREF color );
extern COLORREF X11DRV_GetPixel( struct tagDC *dc, INT x, INT y); extern COLORREF X11DRV_GetPixel( X11DRV_PDEVICE *physDev, INT x, INT y);
extern BOOL X11DRV_PaintRgn( struct tagDC *dc, HRGN hrgn ); extern BOOL X11DRV_PaintRgn( X11DRV_PDEVICE *physDev, HRGN hrgn );
extern BOOL X11DRV_Polyline( struct tagDC *dc,const POINT* pt,INT count); extern BOOL X11DRV_Polyline( X11DRV_PDEVICE *physDev,const POINT* pt,INT count);
extern BOOL X11DRV_Polygon( struct tagDC *dc, const POINT* pt, INT count ); extern BOOL X11DRV_Polygon( X11DRV_PDEVICE *physDev, const POINT* pt, INT count );
extern BOOL X11DRV_PolyPolygon( struct tagDC *dc, const POINT* pt, extern BOOL X11DRV_PolyPolygon( X11DRV_PDEVICE *physDev, const POINT* pt,
const INT* counts, UINT polygons); const INT* counts, UINT polygons);
extern BOOL X11DRV_PolyPolyline( struct tagDC *dc, const POINT* pt, extern BOOL X11DRV_PolyPolyline( X11DRV_PDEVICE *physDev, const POINT* pt,
const DWORD* counts, DWORD polylines); const DWORD* counts, DWORD polylines);
extern HGDIOBJ X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ handle ); extern COLORREF X11DRV_SetBkColor( X11DRV_PDEVICE *physDev, COLORREF color );
extern COLORREF X11DRV_SetTextColor( X11DRV_PDEVICE *physDev, COLORREF color );
extern COLORREF X11DRV_SetBkColor( struct tagDC *dc, COLORREF color ); extern BOOL X11DRV_ExtFloodFill( X11DRV_PDEVICE *physDev, INT x, INT y,
extern COLORREF X11DRV_SetTextColor( struct tagDC *dc, COLORREF color );
extern BOOL X11DRV_ExtFloodFill( struct tagDC *dc, INT x, INT y,
COLORREF color, UINT fillType ); COLORREF color, UINT fillType );
extern BOOL X11DRV_ExtTextOut( struct tagDC *dc, INT x, INT y, extern BOOL X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y,
UINT flags, const RECT *lprect, UINT flags, const RECT *lprect,
LPCWSTR str, UINT count, const INT *lpDx ); LPCWSTR str, UINT count, const INT *lpDx );
extern BOOL X11DRV_CreateBitmap( HBITMAP hbitmap ); extern BOOL X11DRV_CreateBitmap( HBITMAP hbitmap );
extern BOOL X11DRV_DeleteObject( HGDIOBJ handle ); extern BOOL X11DRV_DeleteObject( HGDIOBJ handle );
extern LONG X11DRV_BitmapBits( HBITMAP hbitmap, void *bits, LONG count, extern LONG X11DRV_BitmapBits( HBITMAP hbitmap, void *bits, LONG count,
WORD flags ); WORD flags );
extern INT X11DRV_SetDIBitsToDevice( struct tagDC *dc, INT xDest, extern INT X11DRV_SetDIBitsToDevice( X11DRV_PDEVICE *physDev, INT xDest,
INT yDest, DWORD cx, DWORD cy, INT yDest, DWORD cx, DWORD cy,
INT xSrc, INT ySrc, INT xSrc, INT ySrc,
UINT startscan, UINT lines, UINT startscan, UINT lines,
LPCVOID bits, const BITMAPINFO *info, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse ); UINT coloruse );
extern INT X11DRV_DeviceBitmapBits( struct tagDC *dc, HBITMAP hbitmap, extern INT X11DRV_DeviceBitmapBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap,
WORD fGet, UINT startscan, WORD fGet, UINT startscan,
UINT lines, LPSTR bits, UINT lines, LPSTR bits,
LPBITMAPINFO info, UINT coloruse ); LPBITMAPINFO info, UINT coloruse );
extern BOOL X11DRV_GetDeviceGammaRamp( struct tagDC *dc, LPVOID ramp ); extern BOOL X11DRV_GetDeviceGammaRamp( X11DRV_PDEVICE *physDev, LPVOID ramp );
extern BOOL X11DRV_SetDeviceGammaRamp( struct tagDC *dc, LPVOID ramp ); extern BOOL X11DRV_SetDeviceGammaRamp( X11DRV_PDEVICE *physDev, LPVOID ramp );
/* OpenGL / X11 driver functions */ /* OpenGL / X11 driver functions */
extern int X11DRV_ChoosePixelFormat(DC *dc, const PIXELFORMATDESCRIPTOR *pppfd) ; extern int X11DRV_ChoosePixelFormat(DC *dc, const PIXELFORMATDESCRIPTOR *pppfd) ;
@ -188,10 +186,6 @@ extern BOOL X11DRV_SwapBuffers(DC *dc) ;
extern BOOL X11DRV_BITMAP_Init(void); extern BOOL X11DRV_BITMAP_Init(void);
extern int X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y ); extern int X11DRV_FONT_Init( int *log_pixels_x, int *log_pixels_y );
extern HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush );
extern HFONT X11DRV_FONT_SelectObject( DC * dc, HFONT hfont );
extern HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen );
extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap );
extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap ); extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap );
struct tagBITMAPOBJ; struct tagBITMAPOBJ;
@ -207,10 +201,10 @@ extern void X11DRV_SetDrawable( HDC hdc, Drawable drawable, int mode, int org_x,
extern void X11DRV_StartGraphicsExposures( HDC hdc ); extern void X11DRV_StartGraphicsExposures( HDC hdc );
extern void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn ); extern void X11DRV_EndGraphicsExposures( HDC hdc, HRGN hrgn );
extern BOOL X11DRV_SetupGCForPatBlt( struct tagDC *dc, GC gc, BOOL fMapColors ); extern BOOL X11DRV_SetupGCForPatBlt( X11DRV_PDEVICE *physDev, GC gc, BOOL fMapColors );
extern BOOL X11DRV_SetupGCForBrush( struct tagDC *dc ); extern BOOL X11DRV_SetupGCForBrush( X11DRV_PDEVICE *physDev );
extern BOOL X11DRV_SetupGCForPen( struct tagDC *dc ); extern BOOL X11DRV_SetupGCForPen( X11DRV_PDEVICE *physDev );
extern BOOL X11DRV_SetupGCForText( struct tagDC *dc ); extern BOOL X11DRV_SetupGCForText( X11DRV_PDEVICE *physDev );
extern const int X11DRV_XROPfunction[]; extern const int X11DRV_XROPfunction[];
@ -219,12 +213,12 @@ extern void _XInitImageFuncPtrs(XImage *);
extern BOOL X11DRV_XRender_Installed; extern BOOL X11DRV_XRender_Installed;
extern void X11DRV_XRender_Init(void); extern void X11DRV_XRender_Init(void);
extern void X11DRV_XRender_Finalize(void); extern void X11DRV_XRender_Finalize(void);
extern BOOL X11DRV_XRender_SelectFont(struct tagDC*, HFONT); extern BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE*, HFONT);
extern void X11DRV_XRender_DeleteDC(struct tagDC*); extern void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE*);
extern BOOL X11DRV_XRender_ExtTextOut(DC *dc, INT x, INT y, UINT flags, extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR wstr, const RECT *lprect, LPCWSTR wstr,
UINT count, const INT *lpDx); UINT count, const INT *lpDx);
extern void X11DRV_XRender_UpdateDrawable(DC *dc); extern void X11DRV_XRender_UpdateDrawable(X11DRV_PDEVICE *physDev);
/* exported dib functions for now */ /* exported dib functions for now */
@ -258,36 +252,24 @@ typedef struct
} X11DRV_DIBSECTION; } X11DRV_DIBSECTION;
extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse, extern int *X11DRV_DIB_BuildColorMap( X11DRV_PDEVICE *physDev, WORD coloruse,
WORD depth, const BITMAPINFO *info, WORD depth, const BITMAPINFO *info,
int *nColors ); int *nColors );
extern INT X11DRV_CoerceDIBSection(struct tagDC *dc,INT,BOOL); extern INT X11DRV_CoerceDIBSection(X11DRV_PDEVICE *physDev,INT,BOOL);
extern INT X11DRV_LockDIBSection(struct tagDC *dc,INT,BOOL); extern INT X11DRV_LockDIBSection(X11DRV_PDEVICE *physDev,INT,BOOL);
extern void X11DRV_UnlockDIBSection(struct tagDC *dc,BOOL); extern void X11DRV_UnlockDIBSection(X11DRV_PDEVICE *physDev,BOOL);
extern INT X11DRV_CoerceDIBSection2(HBITMAP bmp,INT,BOOL); extern INT X11DRV_CoerceDIBSection2(HBITMAP bmp,INT,BOOL);
extern INT X11DRV_LockDIBSection2(HBITMAP bmp,INT,BOOL); extern INT X11DRV_LockDIBSection2(HBITMAP bmp,INT,BOOL);
extern void X11DRV_UnlockDIBSection2(HBITMAP bmp,BOOL); extern void X11DRV_UnlockDIBSection2(HBITMAP bmp,BOOL);
extern HBITMAP X11DRV_DIB_CreateDIBSection(struct tagDC *dc, BITMAPINFO *bmi, UINT usage, extern HBITMAP X11DRV_DIB_CreateDIBSection(X11DRV_PDEVICE *physDev, BITMAPINFO *bmi, UINT usage,
LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch); LPVOID *bits, HANDLE section, DWORD offset, DWORD ovr_pitch);
extern struct tagBITMAP_DRIVER X11DRV_BITMAP_Driver;
extern INT X11DRV_DIB_SetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan,
UINT lines, LPCVOID bits, const BITMAPINFO *info,
UINT coloruse, HBITMAP hbitmap);
extern INT X11DRV_DIB_GetDIBits(struct tagBITMAPOBJ *bmp, struct tagDC *dc, UINT startscan,
UINT lines, LPVOID bits, BITMAPINFO *info,
UINT coloruse, HBITMAP hbitmap);
extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ *bmp); extern void X11DRV_DIB_DeleteDIBSection(struct tagBITMAPOBJ *bmp);
extern UINT X11DRV_DIB_SetDIBColorTable(struct tagBITMAPOBJ *,struct tagDC*,UINT,UINT,const RGBQUAD *);
extern UINT X11DRV_DIB_GetDIBColorTable(struct tagBITMAPOBJ *,struct tagDC*,UINT,UINT,RGBQUAD *);
extern INT X11DRV_DIB_Coerce(struct tagBITMAPOBJ *,INT,BOOL); extern INT X11DRV_DIB_Coerce(struct tagBITMAPOBJ *,INT,BOOL);
extern INT X11DRV_DIB_Lock(struct tagBITMAPOBJ *,INT,BOOL); extern INT X11DRV_DIB_Lock(struct tagBITMAPOBJ *,INT,BOOL);
extern void X11DRV_DIB_Unlock(struct tagBITMAPOBJ *,BOOL); extern void X11DRV_DIB_Unlock(struct tagBITMAPOBJ *,BOOL);
void X11DRV_DIB_CopyDIBSection(DC *dcSrc, DC *dcDst, void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
DWORD xSrc, DWORD ySrc, DWORD xSrc, DWORD ySrc, DWORD xDest, DWORD yDest,
DWORD xDest, DWORD yDest,
DWORD width, DWORD height); DWORD width, DWORD height);
struct _DCICMD; struct _DCICMD;
extern INT X11DRV_DCICommand(INT cbInput, const struct _DCICMD *lpCmd, LPVOID lpOutData); extern INT X11DRV_DCICommand(INT cbInput, const struct _DCICMD *lpCmd, LPVOID lpOutData);
@ -321,7 +303,7 @@ extern int X11DRV_PALETTE_Init(void);
extern void X11DRV_PALETTE_Cleanup(void); extern void X11DRV_PALETTE_Cleanup(void);
extern COLORREF X11DRV_PALETTE_ToLogical(int pixel); extern COLORREF X11DRV_PALETTE_ToLogical(int pixel);
extern int X11DRV_PALETTE_ToPhysical(struct tagDC *dc, COLORREF color); extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver; extern struct tagPALETTE_DRIVER X11DRV_PALETTE_Driver;

View File

@ -25,13 +25,12 @@
#include "wine/winbase16.h" #include "wine/winbase16.h"
#include "gdi.h" #include "gdi.h"
#include "bitmap.h" #include "bitmap.h"
#include "selectors.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
WINE_DEFAULT_DEBUG_CHANNEL(bitmap); WINE_DEFAULT_DEBUG_CHANNEL(bitmap);
BITMAP_DRIVER *BITMAP_Driver = NULL;
/*********************************************************************** /***********************************************************************
* BITMAP_GetWidthBytes * BITMAP_GetWidthBytes
@ -426,8 +425,26 @@ BOOL BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bmp )
if( bmp->bitmap.bmBits ) if( bmp->bitmap.bmBits )
HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits ); HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits );
DIB_DeleteDIBSection( bmp ); if (bmp->dib)
{
DIBSECTION *dib = bmp->dib;
if (dib->dsBm.bmBits)
{
if (dib->dshSection)
{
SYSTEM_INFO SystemInfo;
GetSystemInfo( &SystemInfo );
UnmapViewOfFile( (char *)dib->dsBm.bmBits -
(dib->dsOffset % SystemInfo.dwAllocationGranularity) );
}
else if (!dib->dsOffset)
VirtualFree(dib->dsBm.bmBits, 0L, MEM_RELEASE );
}
HeapFree(GetProcessHeap(), 0, dib);
bmp->dib = NULL;
if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
}
return GDI_FreeObject( hbitmap, bmp ); return GDI_FreeObject( hbitmap, bmp );
} }

View File

@ -50,7 +50,7 @@ void CLIPPING_UpdateGCRegion( DC * dc )
CombineRgn( dc->hGCClipRgn, dc->hVisRgn, 0, RGN_COPY ); CombineRgn( dc->hGCClipRgn, dc->hVisRgn, 0, RGN_COPY );
else else
CombineRgn(dc->hGCClipRgn, dc->hClipRgn, dc->hVisRgn, RGN_AND); CombineRgn(dc->hGCClipRgn, dc->hClipRgn, dc->hVisRgn, RGN_AND);
if (dc->funcs->pSetDeviceClipping) dc->funcs->pSetDeviceClipping( dc ); if (dc->funcs->pSetDeviceClipping) dc->funcs->pSetDeviceClipping( dc->physDev );
} }
@ -170,7 +170,7 @@ INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
TRACE("%04x %d,%d\n", hdc, x, y ); TRACE("%04x %d,%d\n", hdc, x, y );
if(dc->funcs->pOffsetClipRgn) if(dc->funcs->pOffsetClipRgn)
ret = dc->funcs->pOffsetClipRgn( dc, x, y ); ret = dc->funcs->pOffsetClipRgn( dc->physDev, x, y );
else if (dc->hClipRgn) { else if (dc->hClipRgn) {
ret = OffsetRgn( dc->hClipRgn, XLSTODS(dc,x), YLSTODS(dc,y)); ret = OffsetRgn( dc->hClipRgn, XLSTODS(dc,x), YLSTODS(dc,y));
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
@ -267,7 +267,7 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom ); TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
if(dc->funcs->pExcludeClipRect) if(dc->funcs->pExcludeClipRect)
ret = dc->funcs->pExcludeClipRect( dc, left, top, right, bottom ); ret = dc->funcs->pExcludeClipRect( dc->physDev, left, top, right, bottom );
else { else {
left = XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = XLPTODP( dc, right ); right = XLPTODP( dc, right );
@ -304,7 +304,7 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top,
TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom ); TRACE("%04x %dx%d,%dx%d\n", hdc, left, top, right, bottom );
if(dc->funcs->pIntersectClipRect) if(dc->funcs->pIntersectClipRect)
ret = dc->funcs->pIntersectClipRect( dc, left, top, right, bottom ); ret = dc->funcs->pIntersectClipRect( dc->physDev, left, top, right, bottom );
else { else {
left = XLPTODP( dc, left ); left = XLPTODP( dc, left );
right = XLPTODP( dc, right ); right = XLPTODP( dc, right );

View File

@ -451,7 +451,7 @@ INT WINAPI SaveDC( HDC hdc )
if(dc->funcs->pSaveDC) if(dc->funcs->pSaveDC)
{ {
ret = dc->funcs->pSaveDC( dc ); ret = dc->funcs->pSaveDC( dc->physDev );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return ret; return ret;
} }
@ -509,7 +509,7 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
if(!dc) return FALSE; if(!dc) return FALSE;
if(dc->funcs->pRestoreDC) if(dc->funcs->pRestoreDC)
{ {
success = dc->funcs->pRestoreDC( dc, level ); success = dc->funcs->pRestoreDC( dc->physDev, level );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return success; return success;
} }
@ -781,7 +781,7 @@ BOOL WINAPI DeleteDC( HDC hdc )
SelectObject( hdc, GetStockObject(SYSTEM_FONT) ); SelectObject( hdc, GetStockObject(SYSTEM_FONT) );
SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) ); SelectObject( hdc, GetStockObject(DEFAULT_BITMAP) );
funcs = dc->funcs; funcs = dc->funcs;
if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc); if (dc->funcs->pDeleteDC) dc->funcs->pDeleteDC(dc->physDev);
} }
if (dc->hClipRgn) DeleteObject( dc->hClipRgn ); if (dc->hClipRgn) DeleteObject( dc->hClipRgn );
@ -847,7 +847,7 @@ INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
if ((dc = DC_GetDCPtr( hdc ))) if ((dc = DC_GetDCPtr( hdc )))
{ {
if (dc->funcs->pGetDeviceCaps) ret = dc->funcs->pGetDeviceCaps( dc, cap ); if (dc->funcs->pGetDeviceCaps) ret = dc->funcs->pGetDeviceCaps( dc->physDev, cap );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;
@ -871,13 +871,18 @@ COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
COLORREF oldColor; COLORREF oldColor;
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0x80000000; if (!dc) return CLR_INVALID;
if (dc->funcs->pSetBkColor)
oldColor = dc->funcs->pSetBkColor(dc, color);
else {
oldColor = dc->backgroundColor; oldColor = dc->backgroundColor;
dc->backgroundColor = color; if (dc->funcs->pSetBkColor)
{
color = dc->funcs->pSetBkColor(dc->physDev, color);
if (color == CLR_INVALID) /* don't change it */
{
color = oldColor;
oldColor = CLR_INVALID;
} }
}
dc->backgroundColor = color;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return oldColor; return oldColor;
} }
@ -900,13 +905,18 @@ COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
COLORREF oldColor; COLORREF oldColor;
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0x80000000; if (!dc) return CLR_INVALID;
if (dc->funcs->pSetTextColor)
oldColor = dc->funcs->pSetTextColor(dc, color);
else {
oldColor = dc->textColor; oldColor = dc->textColor;
dc->textColor = color; if (dc->funcs->pSetTextColor)
{
color = dc->funcs->pSetTextColor(dc->physDev, color);
if (color == CLR_INVALID) /* don't change it */
{
color = oldColor;
oldColor = CLR_INVALID;
} }
}
dc->textColor = color;
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return oldColor; return oldColor;
} }
@ -929,7 +939,7 @@ UINT WINAPI SetTextAlign( HDC hdc, UINT align )
DC *dc = DC_GetDCPtr( hdc ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) return 0x0; if (!dc) return 0x0;
if (dc->funcs->pSetTextAlign) if (dc->funcs->pSetTextAlign)
prevAlign = dc->funcs->pSetTextAlign(dc, align); prevAlign = dc->funcs->pSetTextAlign(dc->physDev, align);
else { else {
prevAlign = dc->textAlign; prevAlign = dc->textAlign;
dc->textAlign = align; dc->textAlign = align;
@ -949,7 +959,7 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp )
if (!(dc = DC_GetDCPtr( hDC ))) return FALSE; if (!(dc = DC_GetDCPtr( hDC ))) return FALSE;
lpp->x = lpp->y = 0; lpp->x = lpp->y = 0;
if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc, lpp ); if (dc->funcs->pGetDCOrgEx) dc->funcs->pGetDCOrgEx( dc->physDev, lpp );
lpp->x += dc->DCOrgX; lpp->x += dc->DCOrgX;
lpp->y += dc->DCOrgY; lpp->y += dc->DCOrgY;
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hDC );
@ -1296,7 +1306,7 @@ BOOL WINAPI GetDeviceGammaRamp(HDC hDC, LPVOID ptr)
if( dc ) if( dc )
{ {
if (dc->funcs->pGetDeviceGammaRamp) if (dc->funcs->pGetDeviceGammaRamp)
ret = dc->funcs->pGetDeviceGammaRamp(dc, ptr); ret = dc->funcs->pGetDeviceGammaRamp(dc->physDev, ptr);
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hDC );
} }
return ret; return ret;
@ -1313,7 +1323,7 @@ BOOL WINAPI SetDeviceGammaRamp(HDC hDC, LPVOID ptr)
if( dc ) if( dc )
{ {
if (dc->funcs->pSetDeviceGammaRamp) if (dc->funcs->pSetDeviceGammaRamp)
ret = dc->funcs->pSetDeviceGammaRamp(dc, ptr); ret = dc->funcs->pSetDeviceGammaRamp(dc->physDev, ptr);
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hDC );
} }
return ret; return ret;

View File

@ -40,7 +40,7 @@ INT WINAPI SetBkMode( HDC hdc, INT mode )
} }
if (!(dc = DC_GetDCPtr( hdc ))) return 0; if (!(dc = DC_GetDCPtr( hdc ))) return 0;
if (dc->funcs->pSetBkMode) if (dc->funcs->pSetBkMode)
ret = dc->funcs->pSetBkMode( dc, mode ); ret = dc->funcs->pSetBkMode( dc->physDev, mode );
else else
{ {
ret = dc->backgroundMode; ret = dc->backgroundMode;
@ -65,7 +65,7 @@ INT WINAPI SetROP2( HDC hdc, INT mode )
} }
if (!(dc = DC_GetDCPtr( hdc ))) return 0; if (!(dc = DC_GetDCPtr( hdc ))) return 0;
if (dc->funcs->pSetROP2) if (dc->funcs->pSetROP2)
ret = dc->funcs->pSetROP2( dc, mode ); ret = dc->funcs->pSetROP2( dc->physDev, mode );
else else
{ {
ret = dc->ROPmode; ret = dc->ROPmode;
@ -90,7 +90,7 @@ INT WINAPI SetRelAbs( HDC hdc, INT mode )
} }
if (!(dc = DC_GetDCPtr( hdc ))) return 0; if (!(dc = DC_GetDCPtr( hdc ))) return 0;
if (dc->funcs->pSetRelAbs) if (dc->funcs->pSetRelAbs)
ret = dc->funcs->pSetRelAbs( dc, mode ); ret = dc->funcs->pSetRelAbs( dc->physDev, mode );
else else
{ {
ret = dc->relAbsMode; ret = dc->relAbsMode;
@ -115,7 +115,7 @@ INT WINAPI SetPolyFillMode( HDC hdc, INT mode )
} }
if (!(dc = DC_GetDCPtr( hdc ))) return 0; if (!(dc = DC_GetDCPtr( hdc ))) return 0;
if (dc->funcs->pSetPolyFillMode) if (dc->funcs->pSetPolyFillMode)
ret = dc->funcs->pSetPolyFillMode( dc, mode ); ret = dc->funcs->pSetPolyFillMode( dc->physDev, mode );
else else
{ {
ret = dc->polyFillMode; ret = dc->polyFillMode;
@ -140,7 +140,7 @@ INT WINAPI SetStretchBltMode( HDC hdc, INT mode )
} }
if (!(dc = DC_GetDCPtr( hdc ))) return 0; if (!(dc = DC_GetDCPtr( hdc ))) return 0;
if (dc->funcs->pSetStretchBltMode) if (dc->funcs->pSetStretchBltMode)
ret = dc->funcs->pSetStretchBltMode( dc, mode ); ret = dc->funcs->pSetStretchBltMode( dc->physDev, mode );
else else
{ {
ret = dc->stretchBltMode; ret = dc->stretchBltMode;

View File

@ -173,7 +173,7 @@ INT WINAPI StretchDIBits(HDC hdc, INT xDst, INT yDst, INT widthDst,
if(dc->funcs->pStretchDIBits) if(dc->funcs->pStretchDIBits)
{ {
heightSrc = dc->funcs->pStretchDIBits(dc, xDst, yDst, widthDst, heightSrc = dc->funcs->pStretchDIBits(dc->physDev, xDst, yDst, widthDst,
heightDst, xSrc, ySrc, widthSrc, heightDst, xSrc, ySrc, widthSrc,
heightSrc, bits, info, wUsage, dwRop); heightSrc, bits, info, wUsage, dwRop);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -264,25 +264,15 @@ INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
UINT coloruse ) UINT coloruse )
{ {
DC *dc; DC *dc;
BITMAPOBJ *bitmap; INT result = 0;
INT result;
/* Check parameters */ /* Check parameters */
if (!(dc = DC_GetDCUpdate( hdc ))) return 0; if (!(dc = DC_GetDCUpdate( hdc ))) return 0;
if (!(bitmap = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC ))) if (dc->funcs->pSetDIBits)
{ result = dc->funcs->pSetDIBits(dc->physDev, hbitmap, startscan, lines, bits, info, coloruse);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return 0;
}
result = BITMAP_Driver->pSetDIBits(bitmap, dc, startscan,
lines, bits, info,
coloruse, hbitmap);
GDI_ReleaseObj( hbitmap );
GDI_ReleaseObj( hdc );
return result; return result;
} }
@ -314,7 +304,7 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
if (!(dc = DC_GetDCUpdate( hdc ))) return 0; if (!(dc = DC_GetDCUpdate( hdc ))) return 0;
if(dc->funcs->pSetDIBitsToDevice) if(dc->funcs->pSetDIBitsToDevice)
ret = dc->funcs->pSetDIBitsToDevice( dc, xDest, yDest, cx, cy, xSrc, ret = dc->funcs->pSetDIBitsToDevice( dc->physDev, xDest, yDest, cx, cy, xSrc,
ySrc, startscan, lines, bits, ySrc, startscan, lines, bits,
info, coloruse ); info, coloruse );
else { else {
@ -338,24 +328,16 @@ UINT16 WINAPI SetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries,
/*********************************************************************** /***********************************************************************
* SetDIBColorTable (GDI32.@) * SetDIBColorTable (GDI32.@)
*/ */
UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *colors )
RGBQUAD *colors )
{ {
DC * dc; DC * dc;
BITMAPOBJ * bmp; UINT result = 0;
UINT result;
if (!(dc = DC_GetDCUpdate( hdc ))) return 0; if (!(dc = DC_GetDCUpdate( hdc ))) return 0;
if (!(bmp = (BITMAPOBJ*)GDI_GetObjPtr( dc->hBitmap, BITMAP_MAGIC ))) if (dc->funcs->pSetDIBColorTable)
{ result = dc->funcs->pSetDIBColorTable(dc->physDev, startpos, entries, colors);
GDI_ReleaseObj( hdc );
return 0;
}
result = BITMAP_Driver->pSetDIBColorTable(bmp, dc, startpos, entries, colors);
GDI_ReleaseObj( dc->hBitmap );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return result; return result;
} }
@ -372,24 +354,16 @@ UINT16 WINAPI GetDIBColorTable16( HDC16 hdc, UINT16 startpos, UINT16 entries,
/*********************************************************************** /***********************************************************************
* GetDIBColorTable (GDI32.@) * GetDIBColorTable (GDI32.@)
*/ */
UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, UINT WINAPI GetDIBColorTable( HDC hdc, UINT startpos, UINT entries, RGBQUAD *colors )
RGBQUAD *colors )
{ {
DC * dc; DC * dc;
BITMAPOBJ * bmp; UINT result = 0;
UINT result;
if (!(dc = DC_GetDCUpdate( hdc ))) return 0; if (!(dc = DC_GetDCUpdate( hdc ))) return 0;
if (!(bmp = (BITMAPOBJ*)GDI_GetObjPtr( dc->hBitmap, BITMAP_MAGIC ))) if (dc->funcs->pGetDIBColorTable)
{ result = dc->funcs->pGetDIBColorTable(dc->physDev, startpos, entries, colors);
GDI_ReleaseObj( hdc );
return 0;
}
result = BITMAP_Driver->pGetDIBColorTable(bmp, dc, startpos, entries, colors);
GDI_ReleaseObj( dc->hBitmap );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
return result; return result;
} }
@ -747,7 +721,8 @@ INT WINAPI GetDIBits(
} }
} }
/* Otherwise, get bits from the XImage */ /* Otherwise, get bits from the XImage */
else if(!BITMAP_Driver->pGetDIBits(bmp, dc, startscan, lines, bits, info, coloruse, hbitmap)) else if (!dc->funcs->pGetDIBits ||
!dc->funcs->pGetDIBits(dc->physDev, hbitmap, startscan, lines, bits, info, coloruse))
{ {
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
GDI_ReleaseObj( hbitmap ); GDI_ReleaseObj( hbitmap );
@ -949,7 +924,7 @@ HBITMAP DIB_CreateDIBSection(HDC hdc, BITMAPINFO *bmi, UINT usage,
if ((dc = DC_GetDCPtr( hdc ))) if ((dc = DC_GetDCPtr( hdc )))
{ {
hbitmap = dc->funcs->pCreateDIBSection(dc, bmi, usage, bits, section, offset, ovr_pitch); hbitmap = dc->funcs->pCreateDIBSection(dc->physDev, bmi, usage, bits, section, offset, ovr_pitch);
GDI_ReleaseObj(hdc); GDI_ReleaseObj(hdc);
} }
@ -969,36 +944,6 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, BITMAPINFO *bmi, UINT usage,
return DIB_CreateDIBSection(hdc, bmi, usage, bits, section, offset, 0); return DIB_CreateDIBSection(hdc, bmi, usage, bits, section, offset, 0);
} }
/***********************************************************************
* DIB_DeleteDIBSection
*/
void DIB_DeleteDIBSection( BITMAPOBJ *bmp )
{
if (bmp && bmp->dib)
{
DIBSECTION *dib = bmp->dib;
if (dib->dsBm.bmBits)
{
if (dib->dshSection)
{
SYSTEM_INFO SystemInfo;
GetSystemInfo( &SystemInfo );
UnmapViewOfFile( (char *)dib->dsBm.bmBits -
(dib->dsOffset % SystemInfo.dwAllocationGranularity) );
}
else if (!dib->dsOffset)
VirtualFree(dib->dsBm.bmBits, 0L, MEM_RELEASE );
}
BITMAP_Driver->pDeleteDIBSection(bmp);
HeapFree(GetProcessHeap(), 0, dib);
bmp->dib = NULL;
if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
}
}
/*********************************************************************** /***********************************************************************
* DIB_CreateDIBFromBitmap * DIB_CreateDIBFromBitmap
* Allocates a packed DIB and copies the bitmap data into it. * Allocates a packed DIB and copies the bitmap data into it.

View File

@ -901,7 +901,7 @@ INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0; if (!dc) return 0;
if (dc->funcs->pSetTextCharacterExtra) if (dc->funcs->pSetTextCharacterExtra)
prev = dc->funcs->pSetTextCharacterExtra( dc, extra ); prev = dc->funcs->pSetTextCharacterExtra( dc->physDev, extra );
else else
{ {
extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX; extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
@ -931,7 +931,7 @@ BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
DC * dc = DC_GetDCPtr( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return FALSE; if (!dc) return FALSE;
if (dc->funcs->pSetTextJustification) if (dc->funcs->pSetTextJustification)
ret = dc->funcs->pSetTextJustification( dc, extra, breaks ); ret = dc->funcs->pSetTextJustification( dc->physDev, extra, breaks );
else else
{ {
extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX); extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
@ -1080,7 +1080,7 @@ BOOL WINAPI GetTextExtentPoint32W(
if(dc->gdiFont) if(dc->gdiFont)
ret = WineEngGetTextExtentPoint(dc->gdiFont, str, count, size); ret = WineEngGetTextExtentPoint(dc->gdiFont, str, count, size);
else if(dc->funcs->pGetTextExtentPoint) else if(dc->funcs->pGetTextExtentPoint)
ret = dc->funcs->pGetTextExtentPoint( dc, str, count, size ); ret = dc->funcs->pGetTextExtentPoint( dc->physDev, str, count, size );
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
@ -1233,7 +1233,7 @@ BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
if (dc->gdiFont) if (dc->gdiFont)
ret = WineEngGetTextMetrics(dc->gdiFont, metrics); ret = WineEngGetTextMetrics(dc->gdiFont, metrics);
else if (dc->funcs->pGetTextMetrics) else if (dc->funcs->pGetTextMetrics)
ret = dc->funcs->pGetTextMetrics( dc, metrics ); ret = dc->funcs->pGetTextMetrics( dc->physDev, metrics );
if (ret) if (ret)
{ {
@ -1533,7 +1533,7 @@ BOOL WINAPI GetCharWidth32W( HDC hdc, UINT firstChar, UINT lastChar,
if (dc->gdiFont) if (dc->gdiFont)
ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer ); ret = WineEngGetCharWidth( dc->gdiFont, firstChar, lastChar, buffer );
else if (dc->funcs->pGetCharWidth) else if (dc->funcs->pGetCharWidth)
ret = dc->funcs->pGetCharWidth( dc, firstChar, lastChar, buffer); ret = dc->funcs->pGetCharWidth( dc->physDev, firstChar, lastChar, buffer);
if (ret) if (ret)
{ {
@ -1607,7 +1607,7 @@ DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag )
DWORD ret = 0; DWORD ret = 0;
if(!dc) return 0; if(!dc) return 0;
if(dc->funcs->pSetMapperFlags) if(dc->funcs->pSetMapperFlags)
ret = dc->funcs->pSetMapperFlags( dc, dwFlag ); ret = dc->funcs->pSetMapperFlags( dc->physDev, dwFlag );
else else
FIXME("(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag); FIXME("(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag);
GDI_ReleaseObj( hDC ); GDI_ReleaseObj( hDC );

View File

@ -1156,8 +1156,8 @@ static HGDIOBJ FONT_SelectObject(DC *dc, HGDIOBJ hFont)
dc->gdiFont = WineEngCreateFontInstance(hFont); dc->gdiFont = WineEngCreateFontInstance(hFont);
} }
if(dc->funcs->pSelectObject) if(dc->funcs->pSelectFont)
ret = dc->funcs->pSelectObject(dc, hFont); ret = dc->funcs->pSelectFont(dc->physDev, hFont);
if(ret && dc->gdiFont) { if(ret && dc->gdiFont) {
dc->gdiFont = 0; dc->gdiFont = 0;
@ -1188,16 +1188,39 @@ HGDIOBJ16 WINAPI SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ handle ) HGDIOBJ WINAPI SelectObject( HDC hdc, HGDIOBJ handle )
{ {
HGDIOBJ ret = 0; HGDIOBJ ret = 0;
DC * dc = DC_GetDCUpdate( hdc ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0; if (!dc) return 0;
TRACE("hdc=%04x %04x\n", hdc, handle ); TRACE("hdc=%04x %04x\n", hdc, handle );
/* Fonts get a rather different treatment so we'll handle them /* Fonts get a rather different treatment so we'll handle them
separately */ separately */
if(GetObjectType(handle) == OBJ_FONT) switch(GetObjectType( handle ))
{
case OBJ_BITMAP:
ret = dc->hBitmap;
if (dc->funcs->pSelectBitmap) handle = dc->funcs->pSelectBitmap( dc->physDev, handle );
if (handle) dc->hBitmap = handle;
else ret = 0;
break;
case OBJ_BRUSH:
ret = dc->hBrush;
if (dc->funcs->pSelectBrush) handle = dc->funcs->pSelectBrush( dc->physDev, handle );
if (handle) dc->hBrush = handle;
else ret = 0;
break;
case OBJ_PEN:
ret = dc->hPen;
if (dc->funcs->pSelectPen) handle = dc->funcs->pSelectPen( dc->physDev, handle );
if (handle) dc->hPen = handle;
else ret = 0;
break;
case OBJ_FONT:
ret = FONT_SelectObject(dc, handle); ret = FONT_SelectObject(dc, handle);
else if (dc->funcs->pSelectObject) break;
ret = dc->funcs->pSelectObject( dc, handle ); case OBJ_REGION:
GDI_ReleaseObj( hdc );
return (HGDIOBJ)SelectClipRgn( hdc, handle );
}
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
if (ret && ret != handle) if (ret && ret != handle)

View File

@ -169,7 +169,7 @@ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags,
if (dc) if (dc)
{ {
if(dc->funcs->pExtTextOut) if(dc->funcs->pExtTextOut)
ret = dc->funcs->pExtTextOut(dc,x,y,flags,lprect,str,count,lpDx); ret = dc->funcs->pExtTextOut(dc->physDev,x,y,flags,lprect,str,count,lpDx);
GDI_ReleaseObj( hdc ); GDI_ReleaseObj( hdc );
} }
return ret; return ret;