wineps.drv: Use the HDC from the gdi_physdev structure.

This commit is contained in:
Alexandre Julliard 2011-07-07 12:47:05 +02:00
parent 10dcba499f
commit b49aaf1fed
10 changed files with 29 additions and 31 deletions

View File

@ -37,7 +37,7 @@ HBRUSH CDECL PSDRV_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
TRACE("hbrush = %p\n", hbrush); TRACE("hbrush = %p\n", hbrush);
if (hbrush == GetStockObject( DC_BRUSH )) if (hbrush == GetStockObject( DC_BRUSH ))
logbrush.lbColor = GetDCBrushColor( physDev->hdc ); logbrush.lbColor = GetDCBrushColor( dev->hdc );
switch(logbrush.lbStyle) { switch(logbrush.lbStyle) {
@ -73,7 +73,7 @@ COLORREF CDECL PSDRV_SetDCBrushColor( PHYSDEV dev, COLORREF color )
{ {
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
if (GetCurrentObject( physDev->hdc, OBJ_BRUSH ) == GetStockObject( DC_BRUSH )) if (GetCurrentObject( dev->hdc, OBJ_BRUSH ) == GetStockObject( DC_BRUSH ))
{ {
PSDRV_CreateColor( dev, &physDev->brush.color, color ); PSDRV_CreateColor( dev, &physDev->brush.color, color );
physDev->brush.set = FALSE; physDev->brush.set = FALSE;
@ -93,7 +93,7 @@ static BOOL PSDRV_SetBrush( PHYSDEV dev )
LOGBRUSH logbrush; LOGBRUSH logbrush;
BOOL ret = TRUE; BOOL ret = TRUE;
if (!GetObjectA( GetCurrentObject(physDev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush )) if (!GetObjectA( GetCurrentObject(dev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush ))
{ {
ERR("Can't get BRUSHOBJ\n"); ERR("Can't get BRUSHOBJ\n");
return FALSE; return FALSE;
@ -159,7 +159,7 @@ BOOL PSDRV_Brush(PHYSDEV dev, BOOL EO)
if(physDev->pathdepth) if(physDev->pathdepth)
return FALSE; return FALSE;
if (!GetObjectA( GetCurrentObject(physDev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush )) if (!GetObjectA( GetCurrentObject(dev->hdc,OBJ_BRUSH), sizeof(logbrush), &logbrush ))
{ {
ERR("Can't get BRUSHOBJ\n"); ERR("Can't get BRUSHOBJ\n");
return FALSE; return FALSE;

View File

@ -218,7 +218,7 @@ BOOL PSDRV_SelectBuiltinFont(PHYSDEV dev, HFONT hfont,
POINT pts[2]; POINT pts[2];
pts[0].x = pts[0].y = pts[1].x = 0; pts[0].x = pts[0].y = pts[1].x = 0;
pts[1].y = height; pts[1].y = height;
LPtoDP(physDev->hdc, pts, 2); LPtoDP(dev->hdc, pts, 2);
height = pts[1].y - pts[0].y; height = pts[1].y - pts[0].y;
} }
ScaleFont(physDev->font.fontinfo.Builtin.afm, height, ScaleFont(physDev->font.fontinfo.Builtin.afm, height,
@ -437,7 +437,7 @@ BOOL CDECL PSDRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW pro
UINT fm; UINT fm;
TRACE("Got '%s'\n", afmle->afm->FontName); TRACE("Got '%s'\n", afmle->afm->FontName);
fm = PSDRV_GetFontMetric( physDev->hdc, afmle->afm, &tm, &lf ); fm = PSDRV_GetFontMetric( dev->hdc, afmle->afm, &tm, &lf );
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )) ) if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )) )
bRet = b; bRet = b;
else break; else break;
@ -451,7 +451,7 @@ BOOL CDECL PSDRV_EnumDeviceFonts( PHYSDEV dev, LPLOGFONTW plf, FONTENUMPROCW pro
afmle = family->afmlist; afmle = family->afmlist;
TRACE("Got '%s'\n", afmle->afm->FontName); TRACE("Got '%s'\n", afmle->afm->FontName);
fm = PSDRV_GetFontMetric( physDev->hdc, afmle->afm, &tm, &lf ); fm = PSDRV_GetFontMetric( dev->hdc, afmle->afm, &tm, &lf );
if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )) ) if( (b = (*proc)( &lf.elfLogFont, (TEXTMETRICW *)&tm, fm, lp )) )
bRet = b; bRet = b;
else break; else break;

View File

@ -44,14 +44,14 @@ void PSDRV_SetClip( PHYSDEV dev )
HRGN hrgn = CreateRectRgn(0,0,0,0); HRGN hrgn = CreateRectRgn(0,0,0,0);
BOOL empty; BOOL empty;
TRACE("hdc=%p\n", physDev->hdc); TRACE("hdc=%p\n", dev->hdc);
if(physDev->pathdepth) { if(physDev->pathdepth) {
TRACE("inside a path, so not clipping\n"); TRACE("inside a path, so not clipping\n");
goto end; goto end;
} }
empty = !GetClipRgn(physDev->hdc, hrgn); empty = !GetClipRgn(dev->hdc, hrgn);
if(!empty) { if(!empty) {
size = GetRegionData(hrgn, 0, NULL); size = GetRegionData(hrgn, 0, NULL);
@ -121,7 +121,7 @@ void PSDRV_ResetClip( PHYSDEV dev )
HRGN hrgn = CreateRectRgn(0,0,0,0); HRGN hrgn = CreateRectRgn(0,0,0,0);
BOOL empty; BOOL empty;
empty = !GetClipRgn(physDev->hdc, hrgn); empty = !GetClipRgn(dev->hdc, hrgn);
if(!empty && !physDev->pathdepth) if(!empty && !physDev->pathdepth)
PSDRV_WriteGRestore(dev); PSDRV_WriteGRestore(dev);
DeleteObject(hrgn); DeleteObject(hrgn);

View File

@ -252,7 +252,7 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev)
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
char *ps_name; char *ps_name;
LPOUTLINETEXTMETRICA potm; LPOUTLINETEXTMETRICA potm;
DWORD len = GetOutlineTextMetricsA(physDev->hdc, 0, NULL); DWORD len = GetOutlineTextMetricsA(dev->hdc, 0, NULL);
DOWNLOAD *pdl; DOWNLOAD *pdl;
LOGFONTW lf; LOGFONTW lf;
UINT ppem; UINT ppem;
@ -261,20 +261,20 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev)
assert(physDev->font.fontloc == Download); assert(physDev->font.fontloc == Download);
potm = HeapAlloc(GetProcessHeap(), 0, len); potm = HeapAlloc(GetProcessHeap(), 0, len);
GetOutlineTextMetricsA(physDev->hdc, len, potm); GetOutlineTextMetricsA(dev->hdc, len, potm);
get_download_name(dev, potm, &ps_name); get_download_name(dev, potm, &ps_name);
physDev->font.fontinfo.Download = is_font_downloaded(physDev, ps_name); physDev->font.fontinfo.Download = is_font_downloaded(physDev, ps_name);
if (!GetObjectW( GetCurrentObject(physDev->hdc, OBJ_FONT), sizeof(lf), &lf )) if (!GetObjectW( GetCurrentObject(dev->hdc, OBJ_FONT), sizeof(lf), &lf ))
return FALSE; return FALSE;
ppem = calc_ppem_for_height(physDev->hdc, lf.lfHeight); ppem = calc_ppem_for_height(dev->hdc, lf.lfHeight);
/* Retrieve the world -> device transform */ /* Retrieve the world -> device transform */
GetTransform(physDev->hdc, 0x204, &xform); GetTransform(dev->hdc, 0x204, &xform);
if(GetGraphicsMode(physDev->hdc) == GM_COMPATIBLE) if(GetGraphicsMode(dev->hdc) == GM_COMPATIBLE)
{ {
xform.eM11 = xform.eM22 = fabs(xform.eM22); xform.eM11 = xform.eM22 = fabs(xform.eM22);
xform.eM21 = xform.eM12 = 0; xform.eM21 = xform.eM12 = 0;
@ -294,7 +294,7 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev)
RECT bbox; RECT bbox;
UINT emsize; UINT emsize;
if (!get_bbox(physDev->hdc, &bbox, &emsize)) { if (!get_bbox(dev->hdc, &bbox, &emsize)) {
HeapFree(GetProcessHeap(), 0, potm); HeapFree(GetProcessHeap(), 0, potm);
return FALSE; return FALSE;
} }
@ -320,7 +320,7 @@ BOOL PSDRV_WriteSetDownloadFont(PHYSDEV dev)
if(pdl->type == Type42) { if(pdl->type == Type42) {
char g_name[MAX_G_NAME + 1]; char g_name[MAX_G_NAME + 1];
get_glyph_name(physDev->hdc, 0, g_name); get_glyph_name(dev->hdc, 0, g_name);
T42_download_glyph(dev, pdl, 0, g_name); T42_download_glyph(dev, pdl, 0, g_name);
} }
} }
@ -357,7 +357,7 @@ BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glyphs,
switch(physDev->font.fontinfo.Download->type) { switch(physDev->font.fontinfo.Download->type) {
case Type42: case Type42:
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
get_glyph_name(physDev->hdc, glyphs[i], g_name); get_glyph_name(dev->hdc, glyphs[i], g_name);
T42_download_glyph(dev, physDev->font.fontinfo.Download, glyphs[i], g_name); T42_download_glyph(dev, physDev->font.fontinfo.Download, glyphs[i], g_name);
PSDRV_WriteGlyphShow(dev, g_name); PSDRV_WriteGlyphShow(dev, g_name);
} }
@ -365,7 +365,7 @@ BOOL PSDRV_WriteDownloadGlyphShow(PHYSDEV dev, WORD *glyphs,
case Type1: case Type1:
for(i = 0; i < count; i++) { for(i = 0; i < count; i++) {
get_glyph_name(physDev->hdc, glyphs[i], g_name); get_glyph_name(dev->hdc, glyphs[i], g_name);
T1_download_glyph(dev, physDev->font.fontinfo.Download, glyphs[i], g_name); T1_download_glyph(dev, physDev->font.fontinfo.Download, glyphs[i], g_name);
PSDRV_WriteGlyphShow(dev, g_name); PSDRV_WriteGlyphShow(dev, g_name);
} }

View File

@ -155,7 +155,7 @@ INT CDECL PSDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_dat
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( physDev->hdc ); return EndPage( dev->hdc );
} }
case SETCOPYCOUNT: case SETCOPYCOUNT:

View File

@ -107,12 +107,12 @@ BOOL CDECL PSDRV_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT botto
rect.top = top; rect.top = top;
rect.right = right; rect.right = right;
rect.bottom = bottom; rect.bottom = bottom;
LPtoDP( physDev->hdc, (POINT *)&rect, 2 ); LPtoDP( dev->hdc, (POINT *)&rect, 2 );
/* Windows does something truly hacky here. If we're in passthrough mode /* Windows does something truly hacky here. If we're in passthrough mode
and our rop is R2_NOP, then we output the string below. This is used in and our rop is R2_NOP, then we output the string below. This is used in
Office 2k when inserting eps files */ Office 2k when inserting eps files */
if(physDev->job.in_passthrough && !physDev->job.had_passthrough_rect && GetROP2(physDev->hdc) == R2_NOP) { if(physDev->job.in_passthrough && !physDev->job.had_passthrough_rect && GetROP2(dev->hdc) == R2_NOP) {
char buf[256]; char buf[256];
sprintf(buf, "N %d %d %d %d B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top); sprintf(buf, "N %d %d %d %d B\n", rect.right - rect.left, rect.bottom - rect.top, rect.left, rect.top);
write_spool(dev, buf, strlen(buf)); write_spool(dev, buf, strlen(buf));

View File

@ -342,7 +342,6 @@ BOOL CDECL PSDRV_CreateDC( HDC hdc, PSDRV_PDEVICE **pdev, LPCWSTR driver, LPCWST
physDev = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*physDev) ); physDev = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*physDev) );
if (!physDev) return FALSE; if (!physDev) return FALSE;
*pdev = physDev; *pdev = physDev;
physDev->hdc = hdc;
physDev->pi = pi; physDev->pi = pi;
@ -408,7 +407,7 @@ HDC CDECL PSDRV_ResetDC( PHYSDEV dev, const DEVMODEW *lpInitData )
HeapFree(PSDRV_Heap, 0, devmodeA); HeapFree(PSDRV_Heap, 0, devmodeA);
PSDRV_UpdateDevCaps(physDev); PSDRV_UpdateDevCaps(physDev);
} }
return physDev->hdc; return dev->hdc;
} }
/*********************************************************************** /***********************************************************************
@ -520,7 +519,7 @@ INT CDECL PSDRV_GetDeviceCaps( PHYSDEV dev, INT cap )
case SHADEBLENDCAPS: case SHADEBLENDCAPS:
return SB_NONE; return SB_NONE;
default: default:
FIXME("(%p): unsupported capability %d, will return 0\n", physDev->hdc, cap ); FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
return 0; return 0;
} }
} }

View File

@ -71,7 +71,7 @@ HPEN CDECL PSDRV_SelectPen( PHYSDEV dev, HPEN hpen )
if(physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width; if(physDev->pen.width < 0) physDev->pen.width = -physDev->pen.width;
} }
if (hpen == GetStockObject( DC_PEN )) if (hpen == GetStockObject( DC_PEN ))
logpen.lopnColor = GetDCPenColor( physDev->hdc ); logpen.lopnColor = GetDCPenColor( dev->hdc );
switch (logpen.lopnStyle & PS_JOIN_MASK) switch (logpen.lopnStyle & PS_JOIN_MASK)
{ {
@ -134,7 +134,7 @@ COLORREF CDECL PSDRV_SetDCPenColor( PHYSDEV dev, COLORREF color )
{ {
PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); PSDRV_PDEVICE *physDev = get_psdrv_dev( dev );
if (GetCurrentObject( physDev->hdc, OBJ_PEN ) == GetStockObject( DC_PEN )) if (GetCurrentObject( dev->hdc, OBJ_PEN ) == GetStockObject( DC_PEN ))
PSDRV_CreateColor( dev, &physDev->pen.color, color ); PSDRV_CreateColor( dev, &physDev->pen.color, color );
return color; return color;
} }

View File

@ -839,8 +839,8 @@ BOOL PSDRV_WritePatternDict(PHYSDEV dev, BITMAP *bm, BYTE *bits)
PSDRV_WriteSpool(dev, "def\n", 4); PSDRV_WriteSpool(dev, "def\n", 4);
PSDRV_WriteIndexColorSpaceBegin(dev, 1); PSDRV_WriteIndexColorSpaceBegin(dev, 1);
map[0] = GetTextColor( physDev->hdc ); map[0] = GetTextColor( dev->hdc );
map[1] = GetBkColor( physDev->hdc ); map[1] = GetBkColor( dev->hdc );
PSDRV_WriteRGB(dev, map, 2); PSDRV_WriteRGB(dev, map, 2);
PSDRV_WriteIndexColorSpaceEnd(dev); PSDRV_WriteIndexColorSpaceEnd(dev);

View File

@ -355,7 +355,6 @@ typedef struct {
typedef struct typedef struct
{ {
struct gdi_physdev dev; struct gdi_physdev dev;
HDC hdc;
PSFONT font; /* Current PS font */ PSFONT font; /* Current PS font */
DOWNLOAD *downloaded_fonts; DOWNLOAD *downloaded_fonts;
PSPEN pen; PSPEN pen;