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.
diff --git a/dlls/wineps/bitblt.c b/dlls/wineps/bitblt.c
index c800a87..99ab2bc 100644
--- a/dlls/wineps/bitblt.c
+++ b/dlls/wineps/bitblt.c
@@ -30,16 +30,17 @@
*
* 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) {
case PATCOPY:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteRectangle(dc, XLPTODP(dc, x), YLPTODP(dc, y),
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteRectangle(physDev, XLPTODP(dc, x), YLPTODP(dc, y),
XLSTODS(dc, width), YLSTODS(dc, height));
- PSDRV_Brush(dc, FALSE);
- PSDRV_WriteGRestore(dc);
+ PSDRV_Brush(physDev, FALSE);
+ PSDRV_WriteGRestore(physDev);
return TRUE;
case BLACKNESS:
@@ -47,14 +48,14 @@
{
PSCOLOR pscol;
- PSDRV_WriteGSave(dc);
- PSDRV_WriteRectangle(dc, XLPTODP(dc, x), YLPTODP(dc, y),
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteRectangle(physDev, XLPTODP(dc, x), YLPTODP(dc, y),
XLSTODS(dc, width), YLSTODS(dc, height));
PSDRV_CreateColor( physDev, &pscol, (dwRop == BLACKNESS) ?
RGB(0,0,0) : RGB(0xff,0xff,0xff) );
- PSDRV_WriteSetColor(dc, &pscol);
- PSDRV_WriteFill(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteSetColor(physDev, &pscol);
+ PSDRV_WriteFill(physDev);
+ PSDRV_WriteGRestore(physDev);
return TRUE;
}
default:
diff --git a/dlls/wineps/bitmap.c b/dlls/wineps/bitmap.c
index cf11e0c..b08d1f5 100644
--- a/dlls/wineps/bitmap.c
+++ b/dlls/wineps/bitmap.c
@@ -19,13 +19,65 @@
*/
#include "psdrv.h"
-#include "wine/debug.h"
-#include "bitmap.h"
#include "winbase.h"
+#include "wine/debug.h"
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
*
@@ -35,7 +87,7 @@
* 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 widthSrc, INT heightSrc)
{
@@ -44,36 +96,36 @@
switch(info->bmiHeader.biBitCount) {
case 8:
- PSDRV_WriteIndexColorSpaceBegin(dc, 255);
+ PSDRV_WriteIndexColorSpaceBegin(physDev, 255);
for(i = 0; i < 256; i++) {
map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16;
}
- PSDRV_WriteRGB(dc, map, 256);
- PSDRV_WriteIndexColorSpaceEnd(dc);
+ PSDRV_WriteRGB(physDev, map, 256);
+ PSDRV_WriteIndexColorSpaceEnd(physDev);
break;
case 4:
- PSDRV_WriteIndexColorSpaceBegin(dc, 15);
+ PSDRV_WriteIndexColorSpaceBegin(physDev, 15);
for(i = 0; i < 16; i++) {
map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16;
}
- PSDRV_WriteRGB(dc, map, 16);
- PSDRV_WriteIndexColorSpaceEnd(dc);
+ PSDRV_WriteRGB(physDev, map, 16);
+ PSDRV_WriteIndexColorSpaceEnd(physDev);
break;
case 1:
- PSDRV_WriteIndexColorSpaceBegin(dc, 1);
+ PSDRV_WriteIndexColorSpaceBegin(physDev, 1);
for(i = 0; i < 2; i++) {
map[i] = info->bmiColors[i].rgbRed |
info->bmiColors[i].rgbGreen << 8 |
info->bmiColors[i].rgbBlue << 16;
}
- PSDRV_WriteRGB(dc, map, 2);
- PSDRV_WriteIndexColorSpaceEnd(dc);
+ PSDRV_WriteRGB(physDev, map, 2);
+ PSDRV_WriteIndexColorSpaceEnd(physDev);
break;
case 15:
@@ -84,7 +136,7 @@
PSCOLOR pscol;
pscol.type = PSCOLOR_RGB;
pscol.value.rgb.r = pscol.value.rgb.g = pscol.value.rgb.b = 0.0;
- PSDRV_WriteSetColor(dc, &pscol);
+ PSDRV_WriteSetColor(physDev, &pscol);
break;
}
@@ -94,7 +146,7 @@
break;
}
- PSDRV_WriteImageDict(dc, info->bmiHeader.biBitCount, xDst, yDst,
+ PSDRV_WriteImageDict(physDev, info->bmiHeader.biBitCount, xDst, yDst,
widthDst, heightDst, widthSrc, heightSrc, NULL);
return TRUE;
}
@@ -109,26 +161,26 @@
* bit depths.
* 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 widthSrc, INT heightSrc, const void *bits,
const BITMAPINFO *info, UINT wUsage, DWORD dwRop )
{
- DWORD fullSrcWidth;
- INT widthbytes, fullSrcHeight;
+ LONG fullSrcWidth, fullSrcHeight;
+ INT widthbytes;
WORD bpp, compression;
const char *ptr;
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);
- DIB_GetBitmapInfo((const BITMAPINFOHEADER *)info, &fullSrcWidth,
- &fullSrcHeight, &bpp, &compression);
+ if (!get_bitmap_info( info, &fullSrcWidth, &fullSrcHeight, &bpp, &compression )) return FALSE;
- 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);
@@ -145,71 +197,71 @@
switch(bpp) {
case 1:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits;
ptr += (ySrc * widthbytes);
if(xSrc & 7)
FIXME("This won't work...\n");
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;
case 4:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits;
ptr += (ySrc * widthbytes);
if(xSrc & 1)
FIXME("This won't work...\n");
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;
case 8:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits;
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
- PSDRV_WriteBytes(dc, ptr + xSrc, widthSrc);
+ PSDRV_WriteBytes(physDev, ptr + xSrc, widthSrc);
break;
case 15:
case 16:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits;
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
- PSDRV_WriteDIBits16(dc, (WORD *)ptr + xSrc, widthSrc);
+ PSDRV_WriteDIBits16(physDev, (WORD *)ptr + xSrc, widthSrc);
break;
case 24:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits;
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
- PSDRV_WriteDIBits24(dc, ptr + xSrc * 3, widthSrc);
+ PSDRV_WriteDIBits24(physDev, ptr + xSrc * 3, widthSrc);
break;
case 32:
- PSDRV_WriteGSave(dc);
- PSDRV_WriteImageHeader(dc, info, xDst, yDst, widthDst, heightDst,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteImageHeader(physDev, info, xDst, yDst, widthDst, heightDst,
widthSrc, heightSrc);
ptr = bits;
ptr += (ySrc * widthbytes);
for(line = 0; line < heightSrc; line++, ptr += widthbytes)
- PSDRV_WriteDIBits32(dc, ptr + xSrc * 3, widthSrc);
+ PSDRV_WriteDIBits32(physDev, ptr + xSrc * 3, widthSrc);
break;
default:
@@ -217,8 +269,8 @@
return FALSE;
}
- PSDRV_WriteSpool(dc, ">\n", 2); /* End-of-Data for /HexASCIIDecodeFilter */
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteSpool(physDev, ">\n", 2); /* End-of-Data for /HexASCIIDecodeFilter */
+ PSDRV_WriteGRestore(physDev);
return TRUE;
}
diff --git a/dlls/wineps/brush.c b/dlls/wineps/brush.c
index aa5cc33..6eb1845 100644
--- a/dlls/wineps/brush.c
+++ b/dlls/wineps/brush.c
@@ -25,18 +25,15 @@
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;
- HBRUSH prevbrush = dc->hBrush;
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (!GetObjectA( hbrush, sizeof(logbrush), &logbrush )) return 0;
TRACE("hbrush = %08x\n", hbrush);
- dc->hBrush = hbrush;
switch(logbrush.lbStyle) {
@@ -61,7 +58,7 @@
}
physDev->brush.set = FALSE;
- return prevbrush;
+ return hbrush;
}
@@ -70,13 +67,12 @@
* PSDRV_SetBrush
*
*/
-static BOOL PSDRV_SetBrush(DC *dc)
+static BOOL PSDRV_SetBrush(PSDRV_PDEVICE *physDev)
{
LOGBRUSH logbrush;
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");
return FALSE;
@@ -85,7 +81,7 @@
switch (logbrush.lbStyle) {
case BS_SOLID:
case BS_HATCHED:
- PSDRV_WriteSetColor(dc, &physDev->brush.color);
+ PSDRV_WriteSetColor(physDev, &physDev->brush.color);
break;
case BS_NULL:
@@ -106,12 +102,12 @@
* PSDRV_Fill
*
*/
-static BOOL PSDRV_Fill(DC *dc, BOOL EO)
+static BOOL PSDRV_Fill(PSDRV_PDEVICE *physDev, BOOL EO)
{
if(!EO)
- return PSDRV_WriteFill(dc);
+ return PSDRV_WriteFill(physDev);
else
- return PSDRV_WriteEOFill(dc);
+ return PSDRV_WriteEOFill(physDev);
}
@@ -120,12 +116,12 @@
* PSDRV_Clip
*
*/
-static BOOL PSDRV_Clip(DC *dc, BOOL EO)
+static BOOL PSDRV_Clip(PSDRV_PDEVICE *physDev, BOOL EO)
{
if(!EO)
- return PSDRV_WriteClip(dc);
+ return PSDRV_WriteClip(physDev);
else
- return PSDRV_WriteEOClip(dc);
+ return PSDRV_WriteEOClip(physDev);
}
/**********************************************************************
@@ -133,13 +129,12 @@
* PSDRV_Brush
*
*/
-BOOL PSDRV_Brush(DC *dc, BOOL EO)
+BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO)
{
LOGBRUSH logbrush;
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");
return FALSE;
@@ -147,55 +142,55 @@
switch (logbrush.lbStyle) {
case BS_SOLID:
- PSDRV_SetBrush(dc);
- PSDRV_WriteGSave(dc);
- PSDRV_Fill(dc, EO);
- PSDRV_WriteGRestore(dc);
+ PSDRV_SetBrush(physDev);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_Fill(physDev, EO);
+ PSDRV_WriteGRestore(physDev);
break;
case BS_HATCHED:
- PSDRV_SetBrush(dc);
+ PSDRV_SetBrush(physDev);
switch(logbrush.lbHatch) {
case HS_VERTICAL:
case HS_CROSS:
- PSDRV_WriteGSave(dc);
- PSDRV_Clip(dc, EO);
- PSDRV_WriteHatch(dc);
- PSDRV_WriteStroke(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_Clip(physDev, EO);
+ PSDRV_WriteHatch(physDev);
+ PSDRV_WriteStroke(physDev);
+ PSDRV_WriteGRestore(physDev);
if(logbrush.lbHatch == HS_VERTICAL)
break;
/* else fallthrough for HS_CROSS */
case HS_HORIZONTAL:
- PSDRV_WriteGSave(dc);
- PSDRV_Clip(dc, EO);
- PSDRV_WriteRotate(dc, 90.0);
- PSDRV_WriteHatch(dc);
- PSDRV_WriteStroke(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_Clip(physDev, EO);
+ PSDRV_WriteRotate(physDev, 90.0);
+ PSDRV_WriteHatch(physDev);
+ PSDRV_WriteStroke(physDev);
+ PSDRV_WriteGRestore(physDev);
break;
case HS_FDIAGONAL:
case HS_DIAGCROSS:
- PSDRV_WriteGSave(dc);
- PSDRV_Clip(dc, EO);
- PSDRV_WriteRotate(dc, -45.0);
- PSDRV_WriteHatch(dc);
- PSDRV_WriteStroke(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_Clip(physDev, EO);
+ PSDRV_WriteRotate(physDev, -45.0);
+ PSDRV_WriteHatch(physDev);
+ PSDRV_WriteStroke(physDev);
+ PSDRV_WriteGRestore(physDev);
if(logbrush.lbHatch == HS_FDIAGONAL)
break;
/* else fallthrough for HS_DIAGCROSS */
case HS_BDIAGONAL:
- PSDRV_WriteGSave(dc);
- PSDRV_Clip(dc, EO);
- PSDRV_WriteRotate(dc, 45.0);
- PSDRV_WriteHatch(dc);
- PSDRV_WriteStroke(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_Clip(physDev, EO);
+ PSDRV_WriteRotate(physDev, 45.0);
+ PSDRV_WriteHatch(physDev);
+ PSDRV_WriteStroke(physDev);
+ PSDRV_WriteGRestore(physDev);
break;
default:
@@ -219,10 +214,10 @@
GetBitmapBits(logbrush.lbHatch, bm.bmWidthBytes * bm.bmHeight, bits);
if(physDev->pi->ppd->LanguageLevel > 1) {
- PSDRV_WriteGSave(dc);
- PSDRV_WritePatternDict(dc, &bm, bits);
- PSDRV_Fill(dc, EO);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WritePatternDict(physDev, &bm, bits);
+ PSDRV_Fill(physDev, EO);
+ PSDRV_WriteGRestore(physDev);
} else {
FIXME("Trying to set a pattern brush on a level 1 printer\n");
ret = FALSE;
diff --git a/dlls/wineps/clipping.c b/dlls/wineps/clipping.c
index 5aae92a..d02c919 100644
--- a/dlls/wineps/clipping.c
+++ b/dlls/wineps/clipping.c
@@ -28,13 +28,14 @@
/***********************************************************************
* PSDRV_SetDeviceClipping
*/
-VOID PSDRV_SetDeviceClipping( DC *dc )
+VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev )
{
CHAR szArrayName[] = "clippath";
DWORD size;
RGNDATA *rgndata;
+ DC *dc = physDev->dc;
- TRACE("hdc=%04x\n", dc->hSelf);
+ TRACE("hdc=%04x\n", physDev->hdc);
if (dc->hGCClipRgn == 0) {
ERR("Rgn is 0. Please report this.\n");
@@ -55,20 +56,20 @@
GetRegionData(dc->hGCClipRgn, size, rgndata);
- PSDRV_WriteInitClip(dc);
+ PSDRV_WriteInitClip(physDev);
/* check for NULL region */
if (rgndata->rdh.nCount == 0)
{
/* 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 */
else if (rgndata->rdh.nCount == 1)
{
RECT *pRect = (RECT *)rgndata->Buffer;
- PSDRV_WriteRectClip(dc, pRect->left, pRect->top,
+ PSDRV_WriteRectClip(physDev, pRect->left, pRect->top,
pRect->right - pRect->left,
pRect->bottom - pRect->top);
}
@@ -77,21 +78,21 @@
INT i;
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++)
{
- PSDRV_WriteArrayPut(dc, szArrayName, i * 4,
+ PSDRV_WriteArrayPut(physDev, szArrayName, i * 4,
pRect->left);
- PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 1,
+ PSDRV_WriteArrayPut(physDev, szArrayName, i * 4 + 1,
pRect->top);
- PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 2,
+ PSDRV_WriteArrayPut(physDev, szArrayName, i * 4 + 2,
pRect->right - pRect->left);
- PSDRV_WriteArrayPut(dc, szArrayName, i * 4 + 3,
+ PSDRV_WriteArrayPut(physDev, szArrayName, i * 4 + 3,
pRect->bottom - pRect->top);
}
- PSDRV_WriteRectClip2(dc, szArrayName);
+ PSDRV_WriteRectClip2(physDev, szArrayName);
}
HeapFree( GetProcessHeap(), 0, rgndata );
diff --git a/dlls/wineps/color.c b/dlls/wineps/color.c
index a75e536..fa3b600 100644
--- a/dlls/wineps/color.c
+++ b/dlls/wineps/color.c
@@ -117,33 +117,20 @@
/***********************************************************************
* 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);
-
- return oldColor;
+ return color;
}
/***********************************************************************
* 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);
physDev->font.set = FALSE;
- return oldColor;
+ return color;
}
diff --git a/dlls/wineps/escape.c b/dlls/wineps/escape.c
index 54e139a..a6ba990 100644
--- a/dlls/wineps/escape.c
+++ b/dlls/wineps/escape.c
@@ -30,11 +30,9 @@
/**********************************************************************
* 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 )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
-
switch(nEscape)
{
case QUERYESCSUPPORT:
@@ -84,7 +82,7 @@
r->bottom = 0;
TRACE("NEXTBAND rect to 0,0 - 0,0\n" );
physDev->job.banding = FALSE;
- return EndPage( dc->hSelf );
+ return EndPage( physDev->hdc );
}
case SETCOPYCOUNT:
@@ -223,16 +221,14 @@
/************************************************************************
* PSDRV_StartPage
*/
-INT PSDRV_StartPage( DC *dc )
+INT PSDRV_StartPage( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
-
if(!physDev->job.OutOfPage) {
FIXME("Already started a page?\n");
return 1;
}
physDev->job.PageNo++;
- if(!PSDRV_WriteNewPage( dc ))
+ if(!PSDRV_WriteNewPage( physDev ))
return 0;
physDev->job.OutOfPage = FALSE;
return 1;
@@ -242,15 +238,13 @@
/************************************************************************
* PSDRV_EndPage
*/
-INT PSDRV_EndPage( DC *dc )
+INT PSDRV_EndPage( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
-
if(physDev->job.OutOfPage) {
FIXME("Already ended a page?\n");
return 1;
}
- if(!PSDRV_WriteEndPage( dc ))
+ if(!PSDRV_WriteEndPage( physDev ))
return 0;
physDev->job.OutOfPage = TRUE;
return 1;
@@ -260,10 +254,8 @@
/************************************************************************
* 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) {
FIXME("hJob != 0. Now what?\n");
return 0;
@@ -274,8 +266,7 @@
physDev->job.output = HeapAlloc( PSDRV_Heap, 0, strlen(doc->lpszOutput)+1 );
strcpy( physDev->job.output, doc->lpszOutput );
}
- physDev->job.hJob = OpenJob16(physDev->job.output, doc->lpszDocName,
- dc->hSelf);
+ physDev->job.hJob = OpenJob16(physDev->job.output, doc->lpszDocName, physDev->hdc );
if(!physDev->job.hJob) {
WARN("OpenJob failed\n");
return 0;
@@ -283,7 +274,7 @@
physDev->job.banding = FALSE;
physDev->job.OutOfPage = TRUE;
physDev->job.PageNo = 0;
- if(!PSDRV_WriteHeader( dc, doc->lpszDocName ))
+ if(!PSDRV_WriteHeader( physDev, doc->lpszDocName ))
return 0;
return physDev->job.hJob;
@@ -293,10 +284,8 @@
/************************************************************************
* PSDRV_EndDoc
*/
-INT PSDRV_EndDoc( DC *dc )
+INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
-
if(!physDev->job.hJob) {
FIXME("hJob == 0. Now what?\n");
return 0;
@@ -304,9 +293,9 @@
if(!physDev->job.OutOfPage) {
WARN("Somebody forgot a EndPage\n");
- PSDRV_EndPage( dc );
+ PSDRV_EndPage( physDev );
}
- if(!PSDRV_WriteFooter( dc ))
+ if(!PSDRV_WriteFooter( physDev ))
return 0;
if( CloseJob16( physDev->job.hJob ) == SP_ERROR ) {
diff --git a/dlls/wineps/font.c b/dlls/wineps/font.c
index 0ecc99d..c02b15a 100644
--- a/dlls/wineps/font.c
+++ b/dlls/wineps/font.c
@@ -138,12 +138,11 @@
}
/***********************************************************************
- * PSDRV_FONT_SelectObject
+ * PSDRV_SelectFont (WINEPS.@)
*/
-HFONT PSDRV_FONT_SelectObject( DC * dc, HFONT hfont )
+HFONT PSDRV_SelectFont( PSDRV_PDEVICE *physDev, HFONT hfont )
{
LOGFONTW lf;
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
BOOL bd = FALSE, it = FALSE;
AFMLISTENTRY *afmle;
FONTFAMILY *family;
@@ -257,7 +256,7 @@
physDev->font.afm = afmle->afm;
/* 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,
&(physDev->font), &(physDev->font.tm));
@@ -274,10 +273,8 @@
/***********************************************************************
* 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));
return TRUE;
}
@@ -324,9 +321,9 @@
/***********************************************************************
* 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;
float width = 0.0;
@@ -349,9 +346,8 @@
/***********************************************************************
* 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;
TRACE("U+%.4X U+%.4X\n", firstChar, lastChar);
@@ -376,14 +372,12 @@
/***********************************************************************
* PSDRV_SetFont
*/
-BOOL PSDRV_SetFont( DC *dc )
+BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
-
- PSDRV_WriteSetColor(dc, &physDev->font.color);
+ PSDRV_WriteSetColor(physDev, &physDev->font.color);
if(physDev->font.set) return TRUE;
- PSDRV_WriteSetFont(dc);
+ PSDRV_WriteSetFont(physDev);
physDev->font.set = TRUE;
return TRUE;
}
diff --git a/dlls/wineps/graphics.c b/dlls/wineps/graphics.c
index 0b3509f..aadaa69 100644
--- a/dlls/wineps/graphics.c
+++ b/dlls/wineps/graphics.c
@@ -38,16 +38,18 @@
/***********************************************************************
* 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);
- PSDRV_SetPen(dc);
- PSDRV_WriteMoveTo(dc, INTERNAL_XWPTODP(dc, dc->CursPosX, dc->CursPosY),
- INTERNAL_YWPTODP(dc, dc->CursPosX, dc->CursPosY));
- PSDRV_WriteLineTo(dc, INTERNAL_XWPTODP(dc, x, y),
- INTERNAL_YWPTODP(dc, x, y));
- PSDRV_DrawLine(dc);
+ PSDRV_SetPen(physDev);
+ PSDRV_WriteMoveTo(physDev, INTERNAL_XWPTODP(dc, dc->CursPosX, dc->CursPosY),
+ INTERNAL_YWPTODP(dc, dc->CursPosX, dc->CursPosY));
+ PSDRV_WriteLineTo(physDev, INTERNAL_XWPTODP(dc, x, y),
+ INTERNAL_YWPTODP(dc, x, y));
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -56,21 +58,20 @@
/***********************************************************************
* PSDRV_Rectangle
*/
-BOOL PSDRV_Rectangle( DC *dc, INT left, INT top, INT right,
- INT bottom )
+BOOL PSDRV_Rectangle( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom )
{
INT width;
INT height;
+ DC *dc = physDev->dc;
TRACE("%d %d - %d %d\n", left, top, right, bottom);
width = INTERNAL_XWSTODS(dc, right - left);
height = INTERNAL_YWSTODS(dc, bottom - top);
- PSDRV_WriteRectangle(dc, INTERNAL_XWPTODP(dc, left, top),
- INTERNAL_YWPTODP(dc, left, top),
- width, height);
- PSDRV_Brush(dc,0);
- PSDRV_SetPen(dc);
- PSDRV_DrawLine(dc);
+ PSDRV_WriteRectangle(physDev, INTERNAL_XWPTODP(dc, left, top),
+ INTERNAL_YWPTODP(dc, left, top), width, height);
+ PSDRV_Brush(physDev,0);
+ PSDRV_SetPen(physDev);
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -78,9 +79,11 @@
/***********************************************************************
* PSDRV_RoundRect
*/
-BOOL PSDRV_RoundRect( DC *dc, INT left, INT top, INT right,
- INT bottom, INT ell_width, INT ell_height )
+BOOL PSDRV_RoundRect( PSDRV_PDEVICE *physDev, INT left, INT top, INT right,
+ INT bottom, INT ell_width, INT ell_height )
{
+ DC *dc = physDev->dc;
+
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
@@ -94,23 +97,23 @@
if(ell_width > right - left) ell_width = right - left;
if(ell_height > bottom - top) ell_height = bottom - top;
- PSDRV_WriteMoveTo( dc, left, top + ell_height/2 );
- PSDRV_WriteArc( dc, left + ell_width/2, top + ell_height/2, ell_width,
+ PSDRV_WriteMoveTo( physDev, left, top + ell_height/2 );
+ PSDRV_WriteArc( physDev, left + ell_width/2, top + ell_height/2, ell_width,
ell_height, 90.0, 180.0);
- PSDRV_WriteLineTo( dc, right - ell_width/2, top );
- PSDRV_WriteArc( dc, right - ell_width/2, top + ell_height/2, ell_width,
+ PSDRV_WriteLineTo( physDev, right - ell_width/2, top );
+ PSDRV_WriteArc( physDev, right - ell_width/2, top + ell_height/2, ell_width,
ell_height, 0.0, 90.0);
- PSDRV_WriteLineTo( dc, right, bottom - ell_height/2 );
- PSDRV_WriteArc( dc, right - ell_width/2, bottom - ell_height/2, ell_width,
+ PSDRV_WriteLineTo( physDev, right, bottom - ell_height/2 );
+ PSDRV_WriteArc( physDev, right - ell_width/2, bottom - ell_height/2, ell_width,
ell_height, -90.0, 0.0);
- PSDRV_WriteLineTo( dc, right - ell_width/2, bottom);
- PSDRV_WriteArc( dc, left + ell_width/2, bottom - ell_height/2, ell_width,
+ PSDRV_WriteLineTo( physDev, right - ell_width/2, bottom);
+ PSDRV_WriteArc( physDev, left + ell_width/2, bottom - ell_height/2, ell_width,
ell_height, 180.0, -90.0);
- PSDRV_WriteClosePath( dc );
+ PSDRV_WriteClosePath( physDev );
- PSDRV_Brush(dc,0);
- PSDRV_SetPen(dc);
- PSDRV_DrawLine(dc);
+ PSDRV_Brush(physDev,0);
+ PSDRV_SetPen(physDev);
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -119,12 +122,11 @@
*
* 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,
- INT right, INT bottom,
- INT xstart, INT ystart,
- INT xend, INT yend,
- int lines )
+static BOOL PSDRV_DrawArc( PSDRV_PDEVICE *physDev, INT left, INT top,
+ INT right, INT bottom, INT xstart, INT ystart,
+ INT xend, INT yend, int lines )
{
+ DC *dc = physDev->dc;
INT x, y, h, w;
double start_angle, end_angle, ratio;
@@ -148,17 +150,17 @@
end_angle *= 180.0 / PI;
if(lines == 2) /* pie */
- PSDRV_WriteMoveTo(dc, x, y);
+ PSDRV_WriteMoveTo(physDev, x, y);
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 */
- PSDRV_WriteClosePath(dc);
- PSDRV_Brush(dc,0);
+ PSDRV_WriteClosePath(physDev);
+ PSDRV_Brush(physDev,0);
}
- PSDRV_SetPen(dc);
- PSDRV_DrawLine(dc);
+ PSDRV_SetPen(physDev);
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -166,41 +168,39 @@
/***********************************************************************
* PSDRV_Arc
*/
-BOOL PSDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom,
- INT xstart, INT ystart, INT xend, INT yend )
+BOOL PSDRV_Arc( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
+ INT xstart, INT ystart, INT xend, INT yend )
{
- return PSDRV_DrawArc( dc, left, top, right, bottom, xstart, ystart,
- xend, yend, 0 );
+ return PSDRV_DrawArc( physDev, left, top, right, bottom, xstart, ystart, xend, yend, 0 );
}
/***********************************************************************
* PSDRV_Chord
*/
-BOOL PSDRV_Chord( DC *dc, INT left, INT top, INT right, INT bottom,
- INT xstart, INT ystart, INT xend, INT yend )
+BOOL PSDRV_Chord( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
+ INT xstart, INT ystart, INT xend, INT yend )
{
- return PSDRV_DrawArc( dc, left, top, right, bottom, xstart, ystart,
- xend, yend, 1 );
+ return PSDRV_DrawArc( physDev, left, top, right, bottom, xstart, ystart, xend, yend, 1 );
}
/***********************************************************************
* PSDRV_Pie
*/
-BOOL PSDRV_Pie( DC *dc, INT left, INT top, INT right, INT bottom,
- INT xstart, INT ystart, INT xend, INT yend )
+BOOL PSDRV_Pie( PSDRV_PDEVICE *physDev, INT left, INT top, INT right, INT bottom,
+ INT xstart, INT ystart, INT xend, INT yend )
{
- return PSDRV_DrawArc( dc, left, top, right, bottom, xstart, ystart,
- xend, yend, 2 );
+ return PSDRV_DrawArc( physDev, left, top, right, bottom, xstart, ystart, xend, yend, 2 );
}
/***********************************************************************
* 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;
+ DC *dc = physDev->dc;
TRACE("%d %d - %d %d\n", left, top, right, bottom);
@@ -210,12 +210,12 @@
w = XLSTODS(dc, (right - left));
h = YLSTODS(dc, (bottom - top));
- PSDRV_WriteNewPath(dc);
- PSDRV_WriteArc(dc, x, y, w, h, 0.0, 360.0);
- PSDRV_WriteClosePath(dc);
- PSDRV_Brush(dc,0);
- PSDRV_SetPen(dc);
- PSDRV_DrawLine(dc);
+ PSDRV_WriteNewPath(physDev);
+ PSDRV_WriteArc(physDev, x, y, w, h, 0.0, 360.0);
+ PSDRV_WriteClosePath(physDev);
+ PSDRV_Brush(physDev,0);
+ PSDRV_SetPen(physDev);
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -223,24 +223,26 @@
/***********************************************************************
* 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 polyline, line;
const POINT* pt;
+ DC *dc = physDev->dc;
+
TRACE("\n");
pt = pts;
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++;
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++;
}
}
- PSDRV_SetPen(dc);
- PSDRV_DrawLine(dc);
+ PSDRV_SetPen(physDev);
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -248,39 +250,41 @@
/***********************************************************************
* 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
*/
-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 )
{
DWORD polygon, line;
const POINT* pt;
+ DC *dc = physDev->dc;
+
TRACE("\n");
pt = pts;
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++;
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++;
}
- PSDRV_WriteClosePath(dc);
+ PSDRV_WriteClosePath(physDev);
}
- if(dc->polyFillMode == ALTERNATE)
- PSDRV_Brush(dc, 1);
+ if(GetPolyFillMode( physDev->hdc ) == ALTERNATE)
+ PSDRV_Brush(physDev, 1);
else /* WINDING */
- PSDRV_Brush(dc, 0);
- PSDRV_SetPen(dc);
- PSDRV_DrawLine(dc);
+ PSDRV_Brush(physDev, 0);
+ PSDRV_SetPen(physDev);
+ PSDRV_DrawLine(physDev);
return TRUE;
}
@@ -288,27 +292,27 @@
/***********************************************************************
* 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
*/
-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;
+ DC *dc = physDev->dc;
x = INTERNAL_XWPTODP(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_WriteSetColor( dc, &pscolor );
- PSDRV_WriteFill( dc );
+ PSDRV_WriteSetColor( physDev, &pscolor );
+ PSDRV_WriteFill( physDev );
return color;
}
@@ -316,12 +320,10 @@
/***********************************************************************
* 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)
- PSDRV_WriteNewPath(dc);
+ PSDRV_WriteNewPath(physDev);
else
- PSDRV_WriteStroke(dc);
+ PSDRV_WriteStroke(physDev);
}
diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c
index 2c15932..4a5f049 100644
--- a/dlls/wineps/init.c
+++ b/dlls/wineps/init.c
@@ -171,7 +171,9 @@
physDev = (PSDRV_PDEVICE *)HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY,
sizeof(*physDev) );
if (!physDev) return FALSE;
- dc->physDev = physDev;
+ dc->physDev = (PHYSDEV)physDev;
+ physDev->hdc = dc->hSelf;
+ physDev->dc = dc;
physDev->pi = pi;
@@ -251,16 +253,14 @@
/**********************************************************************
* PSDRV_DeleteDC
*/
-BOOL PSDRV_DeleteDC( DC *dc )
+BOOL PSDRV_DeleteDC( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
-
TRACE("\n");
HeapFree( PSDRV_Heap, 0, physDev->Devmode );
HeapFree( PSDRV_Heap, 0, physDev->job.output );
+ physDev->dc->physDev = NULL;
HeapFree( PSDRV_Heap, 0, physDev );
- dc->physDev = NULL;
return TRUE;
}
@@ -342,9 +342,8 @@
/***********************************************************************
* GetDeviceCaps (WINEPS.@)
*/
-INT PSDRV_GetDeviceCaps( DC *dc, INT cap )
+INT PSDRV_GetDeviceCaps( PSDRV_PDEVICE *physDev, INT cap )
{
- PSDRV_PDEVICE *physDev = dc->physDev;
POINT pt;
switch(cap)
@@ -427,7 +426,7 @@
case BTLALIGNMENT:
return 0;
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;
}
}
diff --git a/dlls/wineps/objects.c b/dlls/wineps/objects.c
index 48d3835..ad6126b 100644
--- a/dlls/wineps/objects.c
+++ b/dlls/wineps/objects.c
@@ -24,46 +24,10 @@
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");
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;
-}
diff --git a/dlls/wineps/pen.c b/dlls/wineps/pen.c
index 1f9c3a2..fb3e547 100644
--- a/dlls/wineps/pen.c
+++ b/dlls/wineps/pen.c
@@ -30,21 +30,17 @@
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;
- HPEN prevpen = dc->hPen;
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
if (!GetObjectA( hpen, sizeof(logpen), &logpen )) return 0;
TRACE("hpen = %08x colour = %08lx\n", hpen, logpen.lopnColor);
- dc->hPen = hpen;
-
- physDev->pen.width = INTERNAL_XWSTODS(dc, logpen.lopnWidth.x);
+ physDev->pen.width = INTERNAL_XWSTODS(physDev->dc, logpen.lopnWidth.x);
if(physDev->pen.width < 0)
physDev->pen.width = -physDev->pen.width;
@@ -82,7 +78,7 @@
}
physDev->pen.set = FALSE;
- return prevpen;
+ return hpen;
}
@@ -91,15 +87,13 @@
* 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) {
- PSDRV_WriteSetColor(dc, &physDev->pen.color);
+ PSDRV_WriteSetColor(physDev, &physDev->pen.color);
if(!physDev->pen.set) {
- PSDRV_WriteSetPen(dc);
+ PSDRV_WriteSetPen(physDev);
physDev->pen.set = TRUE;
}
}
diff --git a/dlls/wineps/ps.c b/dlls/wineps/ps.c
index 6f8d67c..d0c30e6 100644
--- a/dlls/wineps/ps.c
+++ b/dlls/wineps/ps.c
@@ -188,12 +188,10 @@
"/%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( !PSDRV_StartPage(dc) )
+ if( !PSDRV_StartPage(physDev) )
return FALSE;
}
return WriteSpool16( physDev->job.hJob, lpData, cch );
@@ -221,9 +219,8 @@
-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;
INPUTSLOT *slot;
PAGESIZE *page;
@@ -296,9 +293,8 @@
}
-INT PSDRV_WriteFooter( DC *dc )
+INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf;
buf = (char *)HeapAlloc( PSDRV_Heap, 0, sizeof(psfooter) + 100 );
@@ -321,10 +317,8 @@
-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 ) !=
sizeof(psendpage)-1 ) {
WARN("WriteSpool error\n");
@@ -336,9 +330,8 @@
-INT PSDRV_WriteNewPage( DC *dc )
+INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char *buf;
char name[100];
signed int xtrans, ytrans, rotation;
@@ -382,49 +375,49 @@
}
-BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y)
+BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y)
{
char buf[100];
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];
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)
{
char buf[100];
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)
{
char buf[100];
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)
{
char buf[256];
@@ -432,12 +425,11 @@
/* Make angles -ve and swap order because we're working with an upside
down y-axis */
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;
buf = (char *)HeapAlloc( PSDRV_Heap, 0,
@@ -452,14 +444,13 @@
physDev->font.size, -physDev->font.size,
-physDev->font.escapement);
- PSDRV_WriteSpool(dc, buf, strlen(buf));
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
HeapFree(PSDRV_Heap, 0, buf);
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];
PSDRV_CopyColor(&physDev->inkColor, color);
@@ -467,11 +458,11 @@
case PSCOLOR_RGB:
sprintf(buf, pssetrgbcolor, color->value.rgb.r, color->value.rgb.g,
color->value.rgb.b);
- return PSDRV_WriteSpool(dc, buf, strlen(buf));
+ return PSDRV_WriteSpool(physDev, buf, strlen(buf));
case PSCOLOR_GRAY:
sprintf(buf, pssetgray, color->value.gray.i);
- return PSDRV_WriteSpool(dc, buf, strlen(buf));
+ return PSDRV_WriteSpool(physDev, buf, strlen(buf));
default:
ERR("Unkonwn colour type %d\n", color->type);
@@ -481,23 +472,22 @@
return FALSE;
}
-BOOL PSDRV_WriteSetPen(DC *dc)
+BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev)
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
char buf[256];
sprintf(buf, pssetlinewidth, physDev->pen.width);
- PSDRV_WriteSpool(dc, buf, strlen(buf));
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(physDev->pen.dash) {
sprintf(buf, pssetdash, physDev->pen.dash, 0);
- PSDRV_WriteSpool(dc, buf, strlen(buf));
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
}
return TRUE;
}
-BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count)
+BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count)
{
char buf[128];
int i;
@@ -507,8 +497,7 @@
LPCSTR name;
int l;
- name = PSDRV_UVMetrics(str[i],
- ((PSDRV_PDEVICE *)dc->physDev)->font.afm)->N->sz;
+ name = PSDRV_UVMetrics(str[i], physDev->font.afm)->N->sz;
l = snprintf(buf, sizeof(buf), psglyphshow, name);
if (l < sizeof(psglyphshow) - 2 || l > sizeof(buf) - 1)
@@ -517,84 +506,84 @@
continue;
}
- PSDRV_WriteSpool(dc, buf, l);
+ PSDRV_WriteSpool(physDev, buf, l);
}
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];
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];
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";
- 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;
int i;
@@ -606,13 +595,13 @@
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7;
}
- PSDRV_WriteSpool(dc, buf, number * 7);
+ PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf);
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 heightSrc, char *bits)
{
@@ -631,7 +620,7 @@
sprintf(buf, start, xDst, yDst, widthDst, heightDst, widthSrc, heightSrc,
(depth < 8) ? depth : 8, widthSrc, -heightSrc, heightSrc);
- PSDRV_WriteSpool(dc, buf, strlen(buf));
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
switch(depth) {
case 8:
@@ -651,13 +640,13 @@
break;
}
- PSDRV_WriteSpool(dc, buf, strlen(buf));
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(!bits)
- PSDRV_WriteSpool(dc, end, sizeof(end) - 1);
+ PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
else {
sprintf(buf, endbits, bits);
- PSDRV_WriteSpool(dc, buf, strlen(buf));
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
}
HeapFree(PSDRV_Heap, 0, buf);
@@ -665,7 +654,7 @@
}
-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 *ptr;
@@ -678,13 +667,13 @@
((i & 0xf) == 0xf) || (i == number - 1) ? '\n' : ' ');
ptr += 3;
}
- PSDRV_WriteSpool(dc, buf, number * 3);
+ PSDRV_WriteSpool(physDev, buf, number * 3);
HeapFree(PSDRV_Heap, 0, buf);
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 *ptr;
@@ -707,13 +696,13 @@
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7;
}
- PSDRV_WriteSpool(dc, buf, number * 7);
+ PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf);
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 *ptr;
@@ -727,13 +716,13 @@
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7;
}
- PSDRV_WriteSpool(dc, buf, number * 7);
+ PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf);
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 *ptr;
@@ -747,53 +736,53 @@
((i & 0x7) == 0x7) || (i == number - 1) ? '\n' : ' ');
ptr += 7;
}
- PSDRV_WriteSpool(dc, buf, number * 7);
+ PSDRV_WriteSpool(physDev, buf, number * 7);
HeapFree(PSDRV_Heap, 0, buf);
return TRUE;
}
-BOOL PSDRV_WriteArrayGet(DC *dc, CHAR *pszArrayName, INT nIndex)
+BOOL PSDRV_WriteArrayGet(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex)
{
char buf[100];
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];
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];
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];
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];
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 "
"/BBox [0 0 %d %d]\n /XStep %d\n /YStep %d\n /PaintProc {\n begin\n";
@@ -808,12 +797,12 @@
buf = HeapAlloc(PSDRV_Heap, 0, sizeof(start) + 100);
sprintf(buf, start, w, h, w, h);
- PSDRV_WriteSpool(dc, buf, strlen(buf));
- PSDRV_WriteIndexColorSpaceBegin(dc, 1);
- map[0] = dc->textColor;
- map[1] = dc->backgroundColor;
- PSDRV_WriteRGB(dc, map, 2);
- PSDRV_WriteIndexColorSpaceEnd(dc);
+ PSDRV_WriteSpool(physDev, buf, strlen(buf));
+ PSDRV_WriteIndexColorSpaceBegin(physDev, 1);
+ map[0] = GetTextColor( physDev->hdc );
+ map[1] = GetBkColor( physDev->hdc );
+ PSDRV_WriteRGB(physDev, map, 2);
+ PSDRV_WriteIndexColorSpaceEnd(physDev);
ptr = buf;
for(y = h-1; y >= 0; y--) {
for(x = 0; x < w/8; x++) {
@@ -821,8 +810,8 @@
ptr += 2;
}
}
- PSDRV_WriteImageDict(dc, 1, 0, 0, 8, 8, 8, 8, buf);
- PSDRV_WriteSpool(dc, end, sizeof(end) - 1);
+ PSDRV_WriteImageDict(physDev, 1, 0, 0, 8, 8, 8, 8, buf);
+ PSDRV_WriteSpool(physDev, end, sizeof(end) - 1);
HeapFree(PSDRV_Heap, 0, buf);
return TRUE;
}
diff --git a/dlls/wineps/psdrv.h b/dlls/wineps/psdrv.h
index 0e1009e..675fd58 100644
--- a/dlls/wineps/psdrv.h
+++ b/dlls/wineps/psdrv.h
@@ -267,6 +267,8 @@
} JOB;
typedef struct {
+ HDC hdc;
+ DC *dc;
PSFONT font; /* Current PS font */
PSPEN pen;
PSBRUSH brush;
@@ -327,13 +329,10 @@
extern void PSDRV_FreeAFMList( FONTFAMILY *head );
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_SetFont( DC *dc );
-extern BOOL PSDRV_SetPen( DC *dc );
+extern BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO);
+extern BOOL PSDRV_SetFont( PSDRV_PDEVICE *physDev );
+extern BOOL PSDRV_SetPen( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_CmpColor(PSCOLOR *col1, PSCOLOR *col2);
extern BOOL PSDRV_CopyColor(PSCOLOR *col1, PSCOLOR *col2);
@@ -341,98 +340,95 @@
COLORREF wincolor );
extern char PSDRV_UnicodeToANSI(int u);
-extern INT PSDRV_WriteHeader( DC *dc, LPCSTR title );
-extern INT PSDRV_WriteFooter( DC *dc );
-extern INT PSDRV_WriteNewPage( DC *dc );
-extern INT PSDRV_WriteEndPage( DC *dc );
-extern BOOL PSDRV_WriteMoveTo(DC *dc, INT x, INT y);
-extern BOOL PSDRV_WriteLineTo(DC *dc, INT x, INT y);
-extern BOOL PSDRV_WriteStroke(DC *dc);
-extern BOOL PSDRV_WriteRectangle(DC *dc, INT x, INT y, INT width,
+extern INT PSDRV_WriteHeader( PSDRV_PDEVICE *physDev, LPCSTR title );
+extern INT PSDRV_WriteFooter( PSDRV_PDEVICE *physDev );
+extern INT PSDRV_WriteNewPage( PSDRV_PDEVICE *physDev );
+extern INT PSDRV_WriteEndPage( PSDRV_PDEVICE *physDev );
+extern BOOL PSDRV_WriteMoveTo(PSDRV_PDEVICE *physDev, INT x, INT y);
+extern BOOL PSDRV_WriteLineTo(PSDRV_PDEVICE *physDev, INT x, INT y);
+extern BOOL PSDRV_WriteStroke(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteRectangle(PSDRV_PDEVICE *physDev, INT x, INT y, INT width,
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);
-extern BOOL PSDRV_WriteSetFont(DC *dc);
-extern BOOL PSDRV_WriteGlyphShow(DC *dc, LPCWSTR str, INT count);
-extern BOOL PSDRV_WriteSetPen(DC *dc);
-extern BOOL PSDRV_WriteArc(DC *dc, INT x, INT y, INT w, INT h,
+extern BOOL PSDRV_WriteSetFont(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteGlyphShow(PSDRV_PDEVICE *physDev, LPCWSTR str, INT count);
+extern BOOL PSDRV_WriteSetPen(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteArc(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h,
double ang1, double ang2);
-extern BOOL PSDRV_WriteSetColor(DC *dc, PSCOLOR *color);
-extern BOOL PSDRV_WriteSetBrush(DC *dc);
-extern BOOL PSDRV_WriteFill(DC *dc);
-extern BOOL PSDRV_WriteEOFill(DC *dc);
-extern BOOL PSDRV_WriteGSave(DC *dc);
-extern BOOL PSDRV_WriteGRestore(DC *dc);
-extern BOOL PSDRV_WriteNewPath(DC *dc);
-extern BOOL PSDRV_WriteClosePath(DC *dc);
-extern BOOL PSDRV_WriteInitClip(DC *dc);
-extern BOOL PSDRV_WriteClip(DC *dc);
-extern BOOL PSDRV_WriteRectClip(DC *dc, INT x, INT y, INT w, INT h);
-extern BOOL PSDRV_WriteRectClip2(DC *dc, CHAR *pszArrayName);
-extern BOOL PSDRV_WriteEOClip(DC *dc);
-extern BOOL PSDRV_WriteHatch(DC *dc);
-extern BOOL PSDRV_WriteRotate(DC *dc, float ang);
-extern BOOL PSDRV_WriteIndexColorSpaceBegin(DC *dc, int size);
-extern BOOL PSDRV_WriteIndexColorSpaceEnd(DC *dc);
-extern BOOL PSDRV_WriteRGB(DC *dc, COLORREF *map, int number);
-extern BOOL PSDRV_WriteImageDict(DC *dc, WORD depth, INT xDst, INT yDst,
+extern BOOL PSDRV_WriteSetColor(PSDRV_PDEVICE *physDev, PSCOLOR *color);
+extern BOOL PSDRV_WriteSetBrush(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteFill(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteEOFill(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteGSave(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteGRestore(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteNewPath(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteClosePath(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteInitClip(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteClip(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteRectClip(PSDRV_PDEVICE *physDev, INT x, INT y, INT w, INT h);
+extern BOOL PSDRV_WriteRectClip2(PSDRV_PDEVICE *physDev, CHAR *pszArrayName);
+extern BOOL PSDRV_WriteEOClip(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteHatch(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteRotate(PSDRV_PDEVICE *physDev, float ang);
+extern BOOL PSDRV_WriteIndexColorSpaceBegin(PSDRV_PDEVICE *physDev, int size);
+extern BOOL PSDRV_WriteIndexColorSpaceEnd(PSDRV_PDEVICE *physDev);
+extern BOOL PSDRV_WriteRGB(PSDRV_PDEVICE *physDev, COLORREF *map, int number);
+extern BOOL PSDRV_WriteImageDict(PSDRV_PDEVICE *physDev, WORD depth, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT widthSrc,
INT heightSrc, char *bits);
-extern BOOL PSDRV_WriteBytes(DC *dc, const BYTE *bytes, int number);
-extern BOOL PSDRV_WriteDIBits16(DC *dc, const WORD *words, int number);
-extern BOOL PSDRV_WriteDIBits24(DC *dc, const BYTE *bits, int number);
-extern BOOL PSDRV_WriteDIBits32(DC *dc, const BYTE *bits, int number);
-extern int PSDRV_WriteSpool(DC *dc, LPSTR lpData, WORD cch);
-extern BOOL PSDRV_WritePatternDict(DC *dc, BITMAP *bm, BYTE *bits);
-extern BOOL PSDRV_WriteArrayPut(DC *dc, CHAR *pszArrayName, INT nIndex, LONG lCoord);
-extern BOOL PSDRV_WriteArrayDef(DC *dc, CHAR *pszArrayName, INT nSize);
+extern BOOL PSDRV_WriteBytes(PSDRV_PDEVICE *physDev, const BYTE *bytes, int number);
+extern BOOL PSDRV_WriteDIBits16(PSDRV_PDEVICE *physDev, const WORD *words, int number);
+extern BOOL PSDRV_WriteDIBits24(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
+extern BOOL PSDRV_WriteDIBits32(PSDRV_PDEVICE *physDev, const BYTE *bits, int number);
+extern int PSDRV_WriteSpool(PSDRV_PDEVICE *physDev, LPSTR lpData, WORD cch);
+extern BOOL PSDRV_WritePatternDict(PSDRV_PDEVICE *physDev, BITMAP *bm, BYTE *bits);
+extern BOOL PSDRV_WriteArrayPut(PSDRV_PDEVICE *physDev, CHAR *pszArrayName, INT nIndex, LONG lCoord);
+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 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 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 );
-extern INT PSDRV_EndDoc( DC *dc );
-extern INT PSDRV_EndPage( DC *dc );
+extern INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev );
+extern INT PSDRV_EndPage( PSDRV_PDEVICE *physDev );
extern BOOL PSDRV_EnumDeviceFonts( HDC hdc, LPLOGFONTW plf,
DEVICEFONTENUMPROC proc, LPARAM lp );
-extern INT PSDRV_Escape( DC *dc, INT nEscape, INT cbInput,
- SEGPTR lpInData, SEGPTR lpOutData );
-extern BOOL PSDRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
+extern BOOL PSDRV_ExtTextOut( PSDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
const RECT *lprect, LPCWSTR str, UINT count,
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 );
-extern BOOL PSDRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count,
+extern BOOL PSDRV_GetTextExtentPoint( PSDRV_PDEVICE *physDev, LPCWSTR str, INT count,
LPSIZE size );
-extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics );
-extern BOOL PSDRV_LineTo( DC *dc, INT x, INT y );
-extern BOOL PSDRV_PatBlt( DC *dc, INT x, INT y, INT width, INT height, DWORD
+extern BOOL PSDRV_GetTextMetrics( PSDRV_PDEVICE *physDev, TEXTMETRICW *metrics );
+extern BOOL PSDRV_LineTo( PSDRV_PDEVICE *physDev, INT x, INT y );
+extern BOOL PSDRV_PatBlt( PSDRV_PDEVICE *physDev, INT x, INT y, INT width, INT height, DWORD
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 xend, INT yend );
-extern BOOL PSDRV_Polygon( DC *dc, const POINT* pt, INT count );
-extern BOOL PSDRV_Polyline( DC *dc, const POINT* pt, INT count );
-extern BOOL PSDRV_PolyPolygon( DC *dc, const POINT* pts, const INT* counts,
+extern BOOL PSDRV_Polygon( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
+extern BOOL PSDRV_Polyline( PSDRV_PDEVICE *physDev, const POINT* pt, INT count );
+extern BOOL PSDRV_PolyPolygon( PSDRV_PDEVICE *physDev, const POINT* pts, const INT* counts,
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 );
-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 );
-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);
-extern HGDIOBJ PSDRV_SelectObject( DC *dc, HGDIOBJ handle );
-extern COLORREF PSDRV_SetBkColor( DC *dc, COLORREF color );
-extern VOID PSDRV_SetDeviceClipping( DC *dc );
-extern COLORREF PSDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color );
-extern COLORREF PSDRV_SetTextColor( DC *dc, COLORREF color );
-extern INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc );
-extern INT PSDRV_StartPage( DC *dc );
-extern INT PSDRV_StretchDIBits( DC *dc, INT xDst, INT yDst,
+extern COLORREF PSDRV_SetBkColor( PSDRV_PDEVICE *physDev, COLORREF color );
+extern VOID PSDRV_SetDeviceClipping( PSDRV_PDEVICE *physDev );
+extern COLORREF PSDRV_SetPixel( PSDRV_PDEVICE *physDev, INT x, INT y, COLORREF color );
+extern COLORREF PSDRV_SetTextColor( PSDRV_PDEVICE *physDev, COLORREF color );
+extern INT PSDRV_StartDoc( PSDRV_PDEVICE *physDev, const DOCINFOA *doc );
+extern INT PSDRV_StartPage( PSDRV_PDEVICE *physDev );
+extern INT PSDRV_StretchDIBits( PSDRV_PDEVICE *physDev, INT xDst, INT yDst,
INT widthDst, INT heightDst, INT xSrc,
INT ySrc, INT widthSrc, INT heightSrc,
const void *bits, const BITMAPINFO *info,
@@ -447,7 +443,7 @@
LPCSTR lpszPort,
WORD fwCapability, LPSTR lpszOutput,
LPDEVMODEA lpdm);
-VOID PSDRV_DrawLine( DC *dc );
+VOID PSDRV_DrawLine( PSDRV_PDEVICE *physDev );
INT PSDRV_GlyphListInit(void);
const GLYPHNAME *PSDRV_GlyphName(LPCSTR szName);
VOID PSDRV_IndexGlyphList(void);
diff --git a/dlls/wineps/text.c b/dlls/wineps/text.c
index 56c8fa6..8b36fba 100644
--- a/dlls/wineps/text.c
+++ b/dlls/wineps/text.c
@@ -24,27 +24,27 @@
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);
/***********************************************************************
* 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 INT *lpDx )
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
BOOL bResult = TRUE;
BOOL bClipped = FALSE;
BOOL bOpaque = FALSE;
RECT rect;
+ DC *dc = physDev->dc;
TRACE("(x=%d, y=%d, flags=0x%08x, str=%s, count=%d, lpDx=%p)\n", x, y,
flags, debugstr_wn(str, count), count, lpDx);
/* write font if not already written */
- PSDRV_SetFont(dc);
+ PSDRV_SetFont(physDev);
/* set clipping and/or draw background */
if ((flags & (ETO_CLIPPED | ETO_OPAQUE)) && (lprect != NULL))
@@ -54,31 +54,31 @@
rect.top = INTERNAL_YWPTODP(dc, lprect->left, lprect->top);
rect.bottom = INTERNAL_YWPTODP(dc, lprect->right, lprect->bottom);
- PSDRV_WriteGSave(dc);
- PSDRV_WriteRectangle(dc, rect.left, rect.top, rect.right - rect.left,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteRectangle(physDev, rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top);
if (flags & ETO_OPAQUE)
{
bOpaque = TRUE;
- PSDRV_WriteGSave(dc);
- PSDRV_WriteSetColor(dc, &physDev->bkColor);
- PSDRV_WriteFill(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteSetColor(physDev, &physDev->bkColor);
+ PSDRV_WriteFill(physDev);
+ PSDRV_WriteGRestore(physDev);
}
if (flags & ETO_CLIPPED)
{
bClipped = TRUE;
- PSDRV_WriteClip(dc);
+ PSDRV_WriteClip(physDev);
}
- bResult = PSDRV_Text(dc, x, y, str, count, !(bClipped && bOpaque), lpDx);
- PSDRV_WriteGRestore(dc);
+ bResult = PSDRV_Text(physDev, x, y, str, count, !(bClipped && bOpaque), lpDx);
+ PSDRV_WriteGRestore(physDev);
}
else
{
- bResult = PSDRV_Text(dc, x, y, str, count, TRUE, lpDx);
+ bResult = PSDRV_Text(physDev, x, y, str, count, TRUE, lpDx);
}
return bResult;
@@ -87,12 +87,13 @@
/***********************************************************************
* 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)
{
- PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
LPWSTR strbuf;
SIZE sz;
+ DC *dc = physDev->dc;
+ UINT align = GetTextAlign( physDev->hdc );
if (!count)
return TRUE;
@@ -103,7 +104,7 @@
return FALSE;
}
- if(dc->textAlign & TA_UPDATECP) {
+ if(align & TA_UPDATECP) {
x = dc->CursPosX;
y = dc->CursPosY;
}
@@ -111,12 +112,12 @@
x = INTERNAL_XWPTODP(dc, x, y);
y = INTERNAL_YWPTODP(dc, x, y);
- GetTextExtentPoint32W(dc->hSelf, str, count, &sz);
+ GetTextExtentPoint32W(physDev->hdc, str, count, &sz);
if(lpDx) {
SIZE tmpsz;
INT i;
/* 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++)
tmpsz.cx += lpDx[i];
sz.cx = tmpsz.cx; /* sz.cy remains untouched */
@@ -124,10 +125,10 @@
sz.cx = INTERNAL_XWSTODS(dc, sz.cx);
sz.cy = INTERNAL_YWSTODS(dc, sz.cy);
- TRACE("textAlign = %x\n", dc->textAlign);
- switch(dc->textAlign & (TA_LEFT | TA_CENTER | TA_RIGHT) ) {
+ TRACE("textAlign = %x\n", align);
+ switch(align & (TA_LEFT | TA_CENTER | TA_RIGHT) ) {
case TA_LEFT:
- if(dc->textAlign & TA_UPDATECP) {
+ if(align & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP(dc, x + sz.cx, y);
}
break;
@@ -138,13 +139,13 @@
case TA_RIGHT:
x -= sz.cx;
- if(dc->textAlign & TA_UPDATECP) {
+ if(align & TA_UPDATECP) {
dc->CursPosX = INTERNAL_XDPTOWP(dc, x, y);
}
break;
}
- switch(dc->textAlign & (TA_TOP | TA_BASELINE | TA_BOTTOM) ) {
+ switch(align & (TA_TOP | TA_BASELINE | TA_BOTTOM) ) {
case TA_TOP:
y += physDev->font.tm.tmAscent;
break;
@@ -160,22 +161,22 @@
memcpy(strbuf, str, count * sizeof(WCHAR));
*(strbuf + count) = '\0';
- if ((dc->backgroundMode != TRANSPARENT) && (bDrawBackground != FALSE))
+ if ((GetBkMode( physDev->hdc ) != TRANSPARENT) && bDrawBackground)
{
- PSDRV_WriteGSave(dc);
- PSDRV_WriteNewPath(dc);
- PSDRV_WriteRectangle(dc, x, y - physDev->font.tm.tmAscent, sz.cx,
+ PSDRV_WriteGSave(physDev);
+ PSDRV_WriteNewPath(physDev);
+ PSDRV_WriteRectangle(physDev, x, y - physDev->font.tm.tmAscent, sz.cx,
physDev->font.tm.tmAscent +
physDev->font.tm.tmDescent);
- PSDRV_WriteSetColor(dc, &physDev->bkColor);
- PSDRV_WriteFill(dc);
- PSDRV_WriteGRestore(dc);
+ PSDRV_WriteSetColor(physDev, &physDev->bkColor);
+ PSDRV_WriteFill(physDev);
+ PSDRV_WriteGRestore(physDev);
}
- PSDRV_WriteMoveTo(dc, x, y);
+ PSDRV_WriteMoveTo(physDev, x, y);
if(!lpDx)
- PSDRV_WriteGlyphShow(dc, strbuf, lstrlenW(strbuf));
+ PSDRV_WriteGlyphShow(physDev, strbuf, lstrlenW(strbuf));
else {
INT i;
float dx = 0.0, dy = 0.0;
@@ -183,13 +184,13 @@
float sin_theta = sin(physDev->font.escapement * M_PI / 1800.0);
for(i = 0; i < count-1; 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;
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));
}
- PSDRV_WriteGlyphShow(dc, &strbuf[i], 1);
+ PSDRV_WriteGlyphShow(physDev, &strbuf[i], 1);
}
/*
@@ -210,56 +211,56 @@
/* 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);
/* Do the underline */
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 */
{
- PSDRV_WriteGSave(dc); /* save the graphics state */
- PSDRV_WriteMoveTo(dc, x, y); /* move to the start */
+ PSDRV_WriteGSave(physDev); /* save the graphics state */
+ PSDRV_WriteMoveTo(physDev, x, y); /* move to the start */
/* temporarily rotate the coord system */
- PSDRV_WriteRotate(dc, -escapement/10);
+ PSDRV_WriteRotate(physDev, -escapement/10);
/* 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
- 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 */
- PSDRV_WriteGRestore(dc); /* restore the graphics state */
+ PSDRV_WriteGRestore(physDev); /* restore the graphics state */
}
/* Do the strikeout */
if (physDev->font.tm.tmStruckOut) {
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 */
{
- PSDRV_WriteGSave(dc); /* save the graphics state */
- PSDRV_WriteMoveTo(dc, x, y); /* move to the start */
+ PSDRV_WriteGSave(physDev); /* save the graphics state */
+ PSDRV_WriteMoveTo(physDev, x, y); /* move to the start */
/* temporarily rotate the coord system */
- PSDRV_WriteRotate(dc, -escapement/10);
+ PSDRV_WriteRotate(physDev, -escapement/10);
/* 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
- 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 */
- PSDRV_WriteGRestore(dc); /* restore the graphics state */
+ PSDRV_WriteGRestore(physDev); /* restore the graphics state */
}
}
diff --git a/dlls/wineps/wineps.spec b/dlls/wineps/wineps.spec
index ef1fc3a..a8df866 100644
--- a/dlls/wineps/wineps.spec
+++ b/dlls/wineps/wineps.spec
@@ -39,7 +39,10 @@
@ cdecl Polyline(ptr ptr long) PSDRV_Polyline
@ cdecl Rectangle(ptr long long long long) PSDRV_Rectangle
@ 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 SetDeviceClipping(ptr) PSDRV_SetDeviceClipping
@ cdecl SetPixel(ptr long long long) PSDRV_SetPixel