General tidy up of the MetaFile driver - make sure that everything

goes through the DCFuncs table.
This commit is contained in:
Huw D M Davies 1999-04-25 09:24:23 +00:00 committed by Alexandre Julliard
parent 2df1afdfa9
commit 7603deae21
19 changed files with 477 additions and 332 deletions

View File

@ -7,6 +7,7 @@ MODULE = metafiledrv
C_SRCS = \ C_SRCS = \
bitblt.c \ bitblt.c \
dc.c \
graphics.c \ graphics.c \
init.c \ init.c \
mapping.c \ mapping.c \

83
graphics/metafiledrv/dc.c Normal file
View File

@ -0,0 +1,83 @@
/*
* MetaFile driver DC value functions
*
* Copyright 1999 Huw D M Davies
*
*/
#include "metafiledrv.h"
INT MFDRV_SaveDC( DC *dc )
{
return MFDRV_MetaParam0( dc, META_SAVEDC );
}
BOOL MFDRV_RestoreDC( DC *dc, INT level )
{
if(level != -1) return FALSE;
return MFDRV_MetaParam1( dc, META_RESTOREDC, level );
}
UINT MFDRV_SetTextAlign( DC *dc, UINT align )
{
return MFDRV_MetaParam1( dc, META_SETTEXTALIGN, (WORD)align);
}
INT MFDRV_SetBkMode( DC *dc, INT mode )
{
return MFDRV_MetaParam1( dc, META_SETBKMODE, (WORD)mode);
}
INT MFDRV_SetROP2( DC *dc, INT rop )
{
return MFDRV_MetaParam1( dc, META_SETROP2, (WORD)rop);
}
INT MFDRV_SetRelAbs( DC *dc, INT mode )
{
return MFDRV_MetaParam1( dc, META_SETRELABS, (WORD)mode);
}
INT MFDRV_SetPolyFillMode( DC *dc, INT mode )
{
return MFDRV_MetaParam1( dc, META_SETPOLYFILLMODE, (WORD)mode);
}
INT MFDRV_SetStretchBltMode( DC *dc, INT mode )
{
return MFDRV_MetaParam1( dc, META_SETSTRETCHBLTMODE, (WORD)mode);
}
INT MFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT bottom )
{
return MFDRV_MetaParam4( dc, META_INTERSECTCLIPRECT, left, top, right,
bottom );
}
INT MFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT bottom )
{
return MFDRV_MetaParam4( dc, META_EXCLUDECLIPRECT, left, top, right,
bottom );
}
INT MFDRV_OffsetClipRgn( DC *dc, INT x, INT y )
{
return MFDRV_MetaParam2( dc, META_OFFSETCLIPRGN, x, y );
}
INT MFDRV_SetTextJustification( DC *dc, INT extra, INT breaks )
{
return MFDRV_MetaParam2( dc, META_SETTEXTJUSTIFICATION, extra, breaks );
}
INT MFDRV_SetTextCharacterExtra( DC *dc, INT extra )
{
return MFDRV_MetaParam1( dc, META_SETTEXTCHAREXTRA, extra );
}
DWORD MFDRV_SetMapperFlags( DC *dc, DWORD flags )
{
return MFDRV_MetaParam2( dc, META_SETMAPPERFLAGS, HIWORD(flags),
LOWORD(flags) );
}

View File

@ -317,6 +317,53 @@ MFDRV_PaintRgn( DC *dc, HRGN hrgn )
} }
/**********************************************************************
* MFDRV_InvertRgn
*/
BOOL
MFDRV_InvertRgn( DC *dc, HRGN hrgn )
{
INT16 index;
index = MFDRV_CreateRegion( dc, hrgn );
if(index == -1)
return FALSE;
return MFDRV_MetaParam1( dc, META_INVERTREGION, index );
}
/**********************************************************************
* MFDRV_FillRgn
*/
BOOL
MFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush )
{
INT16 iRgn, iBrush;
iRgn = MFDRV_CreateRegion( dc, hrgn );
if(iRgn == -1)
return FALSE;
iBrush = MFDRV_CreateBrushIndirect( dc, hbrush );
if(iBrush == -1)
return FALSE;
return MFDRV_MetaParam2( dc, META_FILLREGION, iRgn, iBrush );
}
/**********************************************************************
* MFDRV_FrameRgn
*/
BOOL
MFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT x, INT y )
{
INT16 iRgn, iBrush;
iRgn = MFDRV_CreateRegion( dc, hrgn );
if(iRgn == -1)
return FALSE;
iBrush = MFDRV_CreateBrushIndirect( dc, hbrush );
if(iBrush == -1)
return FALSE;
return MFDRV_MetaParam4( dc, META_FRAMEREGION, iRgn, iBrush, x, y );
}
/********************************************************************** /**********************************************************************
* MFDRV_SetBkColor * MFDRV_SetBkColor
*/ */

View File

@ -32,20 +32,21 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_Ellipse, /* pEllipse */ MFDRV_Ellipse, /* pEllipse */
NULL, /* pEnumDeviceFonts */ NULL, /* pEnumDeviceFonts */
NULL, /* pEscape */ NULL, /* pEscape */
NULL, /* pExcludeClipRect */ MFDRV_ExcludeClipRect, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
MFDRV_ExtFloodFill, /* pExtFloodFill */ MFDRV_ExtFloodFill, /* pExtFloodFill */
MFDRV_ExtTextOut, /* pExtTextOut */ MFDRV_ExtTextOut, /* pExtTextOut */
MFDRV_FillRgn, /* pFillRgn */
MFDRV_FrameRgn, /* pFrameRgn */
NULL, /* pGetCharWidth */ NULL, /* pGetCharWidth */
NULL, /* no implementation */ /* pGetPixel */ NULL, /* no implementation */ /* pGetPixel */
NULL, /* pGetTextExtentPoint */ NULL, /* pGetTextExtentPoint */
NULL, /* pGetTextMetrics */ NULL, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ MFDRV_IntersectClipRect, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */ MFDRV_InvertRgn, /* pInvertRgn */
MFDRV_LineTo, /* pLineTo */ MFDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */ NULL, /* pLoadOEMResource */
MFDRV_MoveToEx, /* pMoveToEx */ MFDRV_MoveToEx, /* pMoveToEx */
NULL, /* pOffsetClipRgn */ MFDRV_OffsetClipRgn, /* pOffsetClipRgn */
MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */ MFDRV_OffsetViewportOrg, /* pOffsetViewportOrg */
MFDRV_OffsetWindowOrg, /* pOffsetWindowOrg */ MFDRV_OffsetWindowOrg, /* pOffsetWindowOrg */
MFDRV_PaintRgn, /* pPaintRgn */ MFDRV_PaintRgn, /* pPaintRgn */
@ -58,29 +59,29 @@ static const DC_FUNCTIONS MFDRV_Funcs =
NULL, /* pPolyBezier */ NULL, /* pPolyBezier */
NULL, /* pRealizePalette */ NULL, /* pRealizePalette */
MFDRV_Rectangle, /* pRectangle */ MFDRV_Rectangle, /* pRectangle */
NULL, /* pRestoreDC */ MFDRV_RestoreDC, /* pRestoreDC */
MFDRV_RoundRect, /* pRoundRect */ MFDRV_RoundRect, /* pRoundRect */
NULL, /* pSaveDC */ MFDRV_SaveDC, /* pSaveDC */
MFDRV_ScaleViewportExt, /* pScaleViewportExt */ MFDRV_ScaleViewportExt, /* pScaleViewportExt */
MFDRV_ScaleWindowExt, /* pScaleWindowExt */ MFDRV_ScaleWindowExt, /* pScaleWindowExt */
NULL, /* pSelectClipRgn */ NULL, /* pSelectClipRgn */
MFDRV_SelectObject, /* pSelectObject */ MFDRV_SelectObject, /* pSelectObject */
NULL, /* pSelectPalette */ NULL, /* pSelectPalette */
MFDRV_SetBkColor, /* pSetBkColor */ MFDRV_SetBkColor, /* pSetBkColor */
NULL, /* pSetBkMode */ MFDRV_SetBkMode, /* pSetBkMode */
NULL, /* pSetDeviceClipping */ NULL, /* pSetDeviceClipping */
MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */ MFDRV_SetDIBitsToDevice, /* pSetDIBitsToDevice */
MFDRV_SetMapMode, /* pSetMapMode */ MFDRV_SetMapMode, /* pSetMapMode */
NULL, /* pSetMapperFlags */ MFDRV_SetMapperFlags, /* pSetMapperFlags */
MFDRV_SetPixel, /* pSetPixel */ MFDRV_SetPixel, /* pSetPixel */
NULL, /* pSetPolyFillMode */ MFDRV_SetPolyFillMode, /* pSetPolyFillMode */
NULL, /* pSetROP2 */ MFDRV_SetROP2, /* pSetROP2 */
NULL, /* pSetRelAbs */ MFDRV_SetRelAbs, /* pSetRelAbs */
NULL, /* pSetStretchBltMode */ MFDRV_SetStretchBltMode, /* pSetStretchBltMode */
NULL, /* pSetTextAlign */ MFDRV_SetTextAlign, /* pSetTextAlign */
NULL, /* pSetTextCharacterExtra */ MFDRV_SetTextCharacterExtra, /* pSetTextCharacterExtra */
MFDRV_SetTextColor, /* pSetTextColor */ MFDRV_SetTextColor, /* pSetTextColor */
NULL, /* pSetTextJustification */ MFDRV_SetTextJustification, /* pSetTextJustification */
MFDRV_SetViewportExt, /* pSetViewportExt */ MFDRV_SetViewportExt, /* pSetViewportExt */
MFDRV_SetViewportOrg, /* pSetViewportOrg */ MFDRV_SetViewportOrg, /* pSetViewportOrg */
MFDRV_SetWindowExt, /* pSetWindowExt */ MFDRV_SetWindowExt, /* pSetWindowExt */

View File

@ -31,47 +31,39 @@ static HBITMAP16 MFDRV_BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap,
* MFDRV_CreateBrushIndirect * MFDRV_CreateBrushIndirect
*/ */
static BOOL MFDRV_CreateBrushIndirect(DC *dc, HBRUSH16 hBrush, INT16 MFDRV_CreateBrushIndirect(DC *dc, HBRUSH hBrush )
LOGBRUSH16 *logbrush)
{ {
int index; INT16 index;
char buffer[sizeof(METARECORD) - 2 + sizeof(*logbrush)]; DWORD size;
METARECORD *mr = (METARECORD *)&buffer;
mr->rdSize = (sizeof(METARECORD) + sizeof(*logbrush) - 2) / 2;
mr->rdFunction = META_CREATEBRUSHINDIRECT;
memcpy(&(mr->rdParm), logbrush, sizeof(*logbrush));
if (!(MFDRV_WriteRecord( dc, mr, mr->rdSize * 2))) return FALSE;
mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT;
if ((index = MFDRV_AddHandleDC( dc )) == -1) return FALSE;
*(mr->rdParm) = index;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2);
}
/******************************************************************
* MFDRV_CreatePatternBrush
*/
static BOOL MFDRV_CreatePatternBrush(DC *dc, HBRUSH16 hBrush,
LOGBRUSH16 *logbrush)
{
DWORD len, bmSize, biSize;
METARECORD *mr; METARECORD *mr;
BITMAPINFO *info; BRUSHOBJ *brushObj = (BRUSHOBJ *)GDI_GetObjPtr( hBrush, BRUSH_MAGIC );
int index; if(!brushObj) return -1;
char buffer[sizeof(METARECORD)];
switch (logbrush->lbStyle) switch(brushObj->logbrush.lbStyle) {
{ case BS_SOLID:
case BS_NULL:
case BS_HATCHED:
{
LOGBRUSH16 lb16;
lb16.lbStyle = brushObj->logbrush.lbStyle;
lb16.lbColor = brushObj->logbrush.lbColor;
lb16.lbHatch = brushObj->logbrush.lbHatch;
size = sizeof(METARECORD) + sizeof(LOGBRUSH16) - 2;
mr = HeapAlloc( SystemHeap, 0, size );
mr->rdSize = size / 2;
mr->rdFunction = META_CREATEBRUSHINDIRECT;
memcpy( mr->rdParm, &lb16, sizeof(LOGBRUSH));
break;
}
case BS_PATTERN: case BS_PATTERN:
{ {
BITMAP bm; BITMAP bm;
BYTE *bits; BYTE *bits;
BITMAPINFO *info;
DWORD bmSize;
GetObjectA(logbrush->lbHatch, sizeof(bm), &bm); GetObjectA(brushObj->logbrush.lbHatch, sizeof(bm), &bm);
if(bm.bmBitsPixel != 1 || bm.bmPlanes != 1) { if(bm.bmBitsPixel != 1 || bm.bmPlanes != 1) {
FIXME(metafile, "Trying to store a colour pattern brush\n"); FIXME(metafile, "Trying to store a colour pattern brush\n");
return FALSE; return FALSE;
@ -79,13 +71,13 @@ static BOOL MFDRV_CreatePatternBrush(DC *dc, HBRUSH16 hBrush,
bmSize = DIB_GetDIBImageBytes(bm.bmWidth, bm.bmHeight, 1); bmSize = DIB_GetDIBImageBytes(bm.bmWidth, bm.bmHeight, 1);
len = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO) + size = sizeof(METARECORD) + sizeof(WORD) + sizeof(BITMAPINFO) +
sizeof(RGBQUAD) + bmSize; sizeof(RGBQUAD) + bmSize;
mr = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, len); mr = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, size);
if(!mr) return FALSE; if(!mr) return FALSE;
mr->rdFunction = META_DIBCREATEPATTERNBRUSH; mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = len / 2; mr->rdSize = size / 2;
mr->rdParm[0] = BS_PATTERN; mr->rdParm[0] = BS_PATTERN;
mr->rdParm[1] = DIB_RGB_COLORS; mr->rdParm[1] = DIB_RGB_COLORS;
info = (BITMAPINFO *)(mr->rdParm + 2); info = (BITMAPINFO *)(mr->rdParm + 2);
@ -97,76 +89,67 @@ static BOOL MFDRV_CreatePatternBrush(DC *dc, HBRUSH16 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, bits, GetDIBits(dc->hSelf, brushObj->logbrush.lbHatch, 0, bm.bmHeight,
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;
break; break;
} }
case BS_DIBPATTERN: case BS_DIBPATTERN:
info = (BITMAPINFO *)GlobalLock16((HGLOBAL16)logbrush->lbHatch); {
if (info->bmiHeader.biCompression) BITMAPINFO *info;
bmSize = info->bmiHeader.biSizeImage; DWORD bmSize, biSize;
else
bmSize = DIB_GetDIBImageBytes(info->bmiHeader.biWidth,
info->bmiHeader.biHeight,
info->bmiHeader.biBitCount);
biSize = DIB_BitmapInfoSize(info, LOWORD(logbrush->lbColor));
len = sizeof(METARECORD) + biSize + bmSize + 2;
mr = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, len);
if(!mr) return FALSE;
mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = len / 2;
*(mr->rdParm) = logbrush->lbStyle;
*(mr->rdParm + 1) = LOWORD(logbrush->lbColor);
memcpy(mr->rdParm + 2, info, biSize + bmSize);
break;
default:
return FALSE;
}
if (!(MFDRV_WriteRecord(dc, mr, len)))
{
HeapFree(SystemHeap, 0, mr);
return FALSE;
}
info = GlobalLock16((HGLOBAL16)brushObj->logbrush.lbHatch);
if (info->bmiHeader.biCompression)
bmSize = info->bmiHeader.biSizeImage;
else
bmSize = DIB_GetDIBImageBytes(info->bmiHeader.biWidth,
info->bmiHeader.biHeight,
info->bmiHeader.biBitCount);
biSize = DIB_BitmapInfoSize(info,
LOWORD(brushObj->logbrush.lbColor));
size = sizeof(METARECORD) + biSize + bmSize + 2;
mr = HeapAlloc(SystemHeap, HEAP_ZERO_MEMORY, size);
if(!mr) return FALSE;
mr->rdFunction = META_DIBCREATEPATTERNBRUSH;
mr->rdSize = size / 2;
*(mr->rdParm) = brushObj->logbrush.lbStyle;
*(mr->rdParm + 1) = LOWORD(brushObj->logbrush.lbColor);
memcpy(mr->rdParm + 2, info, biSize + bmSize);
break;
}
default:
FIXME(metafile, "Unkonwn brush style %x\n",
brushObj->logbrush.lbStyle);
return -1;
}
index = MFDRV_AddHandleDC( dc );
if(!MFDRV_WriteRecord( dc, mr, mr->rdSize * 2))
index = -1;
HeapFree(SystemHeap, 0, mr); HeapFree(SystemHeap, 0, mr);
GDI_HEAP_UNLOCK( hBrush );
mr = (METARECORD *)&buffer; return index;
mr->rdSize = sizeof(METARECORD) / 2;
mr->rdFunction = META_SELECTOBJECT;
if ((index = MFDRV_AddHandleDC( dc )) == -1) return FALSE;
*(mr->rdParm) = index;
return MFDRV_WriteRecord( dc, mr, mr->rdSize * 2);
} }
/*********************************************************************** /***********************************************************************
* MFDRV_BRUSH_SelectObject * MFDRV_BRUSH_SelectObject
*/ */
static HBRUSH MFDRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush, static HBRUSH MFDRV_BRUSH_SelectObject( DC *dc, HBRUSH hbrush,
BRUSHOBJ * brush ) BRUSHOBJ * brush )
{ {
LOGBRUSH16 logbrush; INT16 index;
METARECORD mr;
logbrush.lbStyle = brush->logbrush.lbStyle; index = MFDRV_CreateBrushIndirect( dc, hbrush );
logbrush.lbColor = brush->logbrush.lbColor; if(index == -1) return 0;
logbrush.lbHatch = brush->logbrush.lbHatch;
switch (brush->logbrush.lbStyle) mr.rdSize = sizeof(mr) / 2;
{ mr.rdFunction = META_SELECTOBJECT;
case BS_SOLID: mr.rdParm[0] = index;
case BS_HATCHED: return MFDRV_WriteRecord( dc, &mr, mr.rdSize * 2);
case BS_HOLLOW:
if (!MFDRV_CreateBrushIndirect( dc, hbrush, &logbrush )) return 0;
break;
case BS_PATTERN:
case BS_DIBPATTERN:
if (!MFDRV_CreatePatternBrush( dc, hbrush, &logbrush )) return 0;
break;
}
return 1; /* FIXME? */
} }
/****************************************************************** /******************************************************************

View File

@ -580,7 +580,13 @@ BOOL16 WINAPI FillRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush )
BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) BOOL WINAPI FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
{ {
BOOL retval; BOOL retval;
HBRUSH prevBrush = SelectObject( hdc, hbrush ); HBRUSH prevBrush;
DC * dc = DC_GetDCPtr( hdc );
if(dc->funcs->pFillRgn)
return dc->funcs->pFillRgn(dc, hrgn, hbrush);
prevBrush = SelectObject( hdc, hbrush );
if (!prevBrush) return FALSE; if (!prevBrush) return FALSE;
retval = PaintRgn( hdc, hrgn ); retval = PaintRgn( hdc, hrgn );
SelectObject( hdc, prevBrush ); SelectObject( hdc, prevBrush );
@ -604,7 +610,13 @@ BOOL16 WINAPI FrameRgn16( HDC16 hdc, HRGN16 hrgn, HBRUSH16 hbrush,
BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, BOOL WINAPI FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush,
INT nWidth, INT nHeight ) INT nWidth, INT nHeight )
{ {
HRGN tmp = CreateRectRgn( 0, 0, 0, 0 ); HRGN tmp;
DC *dc = DC_GetDCPtr( hdc );
if(dc->funcs->pFrameRgn)
return dc->funcs->pFrameRgn( dc, hrgn, hbrush, nWidth, nHeight );
tmp = CreateRectRgn( 0, 0, 0, 0 );
if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return FALSE; if(!REGION_FrameRgn( tmp, hrgn, nWidth, nHeight )) return FALSE;
FillRgn( hdc, tmp, hbrush ); FillRgn( hdc, tmp, hbrush );
DeleteObject( tmp ); DeleteObject( tmp );
@ -626,9 +638,17 @@ BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
*/ */
BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn ) BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
{ {
HBRUSH prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) ); HBRUSH prevBrush;
INT prevROP = SetROP2( hdc, R2_NOT ); INT prevROP;
BOOL retval = PaintRgn( hdc, hrgn ); BOOL retval;
DC *dc = DC_GetDCPtr( hdc );
if(dc->funcs->pInvertRgn)
return dc->funcs->pInvertRgn( dc, hrgn );
prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) );
prevROP = SetROP2( hdc, R2_NOT );
retval = PaintRgn( hdc, hrgn );
SelectObject( hdc, prevBrush ); SelectObject( hdc, prevBrush );
SetROP2( hdc, prevROP ); SetROP2( hdc, prevROP );
return retval; return retval;

View File

@ -66,10 +66,10 @@ specify whether you have optional extras such as envelope feeders. You will
therefore find a larger than normal selection of input bins in the print setup therefore find a larger than normal selection of input bins in the print setup
dialog box. I've only really tested ppd parsing on the hp4m6_v1.ppd file. dialog box. I've only really tested ppd parsing on the hp4m6_v1.ppd file.
Many graphics functions to do.
No TrueType download. No TrueType download.
StretchDIBits uses level 2 PostScript.
AdvancedSetup dialog box. AdvancedSetup dialog box.
Many partially implemented functions. Many partially implemented functions.

View File

@ -36,15 +36,16 @@ static const DC_FUNCTIONS PSDRV_Funcs =
PSDRV_EnumDeviceFonts, /* pEnumDeviceFonts */ PSDRV_EnumDeviceFonts, /* pEnumDeviceFonts */
PSDRV_Escape, /* pEscape */ PSDRV_Escape, /* pEscape */
NULL, /* pExcludeClipRect */ NULL, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
NULL, /* pExtFloodFill */ NULL, /* pExtFloodFill */
PSDRV_ExtTextOut, /* pExtTextOut */ PSDRV_ExtTextOut, /* pExtTextOut */
NULL, /* pFillRgn */
NULL, /* pFrameRgn */
PSDRV_GetCharWidth, /* pGetCharWidth */ PSDRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetPixel */ NULL, /* pGetPixel */
PSDRV_GetTextExtentPoint, /* pGetTextExtentPoint */ PSDRV_GetTextExtentPoint, /* pGetTextExtentPoint */
PSDRV_GetTextMetrics, /* pGetTextMetrics */ PSDRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */ NULL, /* pInvertRgn */
PSDRV_LineTo, /* pLineTo */ PSDRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */ NULL, /* pLoadOEMResource */
PSDRV_MoveToEx, /* pMoveToEx */ PSDRV_MoveToEx, /* pMoveToEx */

View File

@ -58,15 +58,16 @@ static const DC_FUNCTIONS WIN16DRV_Funcs =
WIN16DRV_EnumDeviceFonts, /* pEnumDeviceFonts */ WIN16DRV_EnumDeviceFonts, /* pEnumDeviceFonts */
WIN16DRV_Escape, /* pEscape */ WIN16DRV_Escape, /* pEscape */
NULL, /* pExcludeClipRect */ NULL, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
NULL, /* pExtFloodFill */ NULL, /* pExtFloodFill */
WIN16DRV_ExtTextOut, /* pExtTextOut */ WIN16DRV_ExtTextOut, /* pExtTextOut */
NULL, /* pFillRgn */
NULL, /* pFrameRgn */
WIN16DRV_GetCharWidth, /* pGetCharWidth */ WIN16DRV_GetCharWidth, /* pGetCharWidth */
NULL, /* pGetPixel */ NULL, /* pGetPixel */
WIN16DRV_GetTextExtentPoint, /* pGetTextExtentPoint */ WIN16DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
WIN16DRV_GetTextMetrics, /* pGetTextMetrics */ WIN16DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */ NULL, /* pInvertRgn */
WIN16DRV_LineTo, /* pLineTo */ WIN16DRV_LineTo, /* pLineTo */
NULL, /* pLoadOEMResource */ NULL, /* pLoadOEMResource */
WIN16DRV_MoveToEx, /* pMoveToEx */ WIN16DRV_MoveToEx, /* pMoveToEx */

View File

@ -46,15 +46,16 @@ static const DC_FUNCTIONS X11DRV_Funcs =
X11DRV_EnumDeviceFonts, /* pEnumDeviceFonts */ X11DRV_EnumDeviceFonts, /* pEnumDeviceFonts */
X11DRV_Escape, /* pEscape */ X11DRV_Escape, /* pEscape */
NULL, /* pExcludeClipRect */ NULL, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
X11DRV_ExtFloodFill, /* pExtFloodFill */ X11DRV_ExtFloodFill, /* pExtFloodFill */
X11DRV_ExtTextOut, /* pExtTextOut */ X11DRV_ExtTextOut, /* pExtTextOut */
NULL, /* pFillRgn */
NULL, /* pFrameRgn */
X11DRV_GetCharWidth, /* pGetCharWidth */ X11DRV_GetCharWidth, /* pGetCharWidth */
X11DRV_GetPixel, /* pGetPixel */ X11DRV_GetPixel, /* pGetPixel */
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */ X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
X11DRV_GetTextMetrics, /* pGetTextMetrics */ X11DRV_GetTextMetrics, /* pGetTextMetrics */
NULL, /* pIntersectClipRect */ NULL, /* pIntersectClipRect */
NULL, /* pIntersectVisRect */ NULL, /* pInvertRgn */
X11DRV_LineTo, /* pLineTo */ X11DRV_LineTo, /* pLineTo */
X11DRV_LoadOEMResource, /* pLoadOEMResource */ X11DRV_LoadOEMResource, /* pLoadOEMResource */
X11DRV_MoveToEx, /* pMoveToEx */ X11DRV_MoveToEx, /* pMoveToEx */

View File

@ -26,6 +26,9 @@
#define META_DC_MAGIC 0x4f4f #define META_DC_MAGIC 0x4f4f
#define METAFILE_MAGIC 0x4f50 #define METAFILE_MAGIC 0x4f50
#define METAFILE_DC_MAGIC 0x4f51 #define METAFILE_DC_MAGIC 0x4f51
#define ENHMETAFILE_MAGIC 0x4f52
#define ENHMETAFILE_DC_MAGIC 0x4f53
#define MAGIC_DONTCARE 0xffff #define MAGIC_DONTCARE 0xffff
typedef struct tagGDIOBJHDR typedef struct tagGDIOBJHDR
@ -161,27 +164,31 @@ typedef struct tagDC_FUNCS
{ {
BOOL (*pArc)(DC*,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pArc)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pBitBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,DWORD); BOOL (*pBitBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,DWORD);
LONG (*pBitmapBits)(HBITMAP,void*,LONG,WORD); LONG (*pBitmapBits)(HBITMAP,void*,LONG,WORD);
BOOL (*pChord)(DC*,INT,INT,INT,INT,INT,INT,INT,INT); BOOL (*pChord)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
BOOL (*pCreateBitmap)(HBITMAP); BOOL (*pCreateBitmap)(HBITMAP);
BOOL (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*); BOOL (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*);
BOOL (*pDeleteDC)(DC*); BOOL (*pDeleteDC)(DC*);
HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD); HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE,
HBITMAP16 (*pCreateDIBSection16)(DC *,BITMAPINFO *,UINT16,SEGPTR *,HANDLE,DWORD); DWORD);
HBITMAP16 (*pCreateDIBSection16)(DC *,BITMAPINFO *,UINT16,SEGPTR *,HANDLE,
DWORD);
BOOL (*pDeleteObject)(HGDIOBJ); BOOL (*pDeleteObject)(HGDIOBJ);
BOOL (*pEllipse)(DC*,INT,INT,INT,INT); BOOL (*pEllipse)(DC*,INT,INT,INT,INT);
BOOL (*pEnumDeviceFonts)(DC*,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM); BOOL (*pEnumDeviceFonts)(DC*,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM);
INT (*pEscape)(DC*,INT,INT,SEGPTR,SEGPTR); INT (*pEscape)(DC*,INT,INT,SEGPTR,SEGPTR);
INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT); INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT);
INT (*pExcludeVisRect)(DC*,INT,INT,INT,INT);
BOOL (*pExtFloodFill)(DC*,INT,INT,COLORREF,UINT); BOOL (*pExtFloodFill)(DC*,INT,INT,COLORREF,UINT);
BOOL (*pExtTextOut)(DC*,INT,INT,UINT,const RECT*,LPCSTR,UINT,const INT*); BOOL (*pExtTextOut)(DC*,INT,INT,UINT,const RECT*,LPCSTR,UINT,
const INT*);
BOOL (*pFillRgn)(DC*,HRGN,HBRUSH);
BOOL (*pFrameRgn)(DC*,HRGN,HBRUSH,INT,INT);
BOOL (*pGetCharWidth)(DC*,UINT,UINT,LPINT); BOOL (*pGetCharWidth)(DC*,UINT,UINT,LPINT);
COLORREF (*pGetPixel)(DC*,INT,INT); COLORREF (*pGetPixel)(DC*,INT,INT);
BOOL (*pGetTextExtentPoint)(DC*,LPCSTR,INT,LPSIZE); BOOL (*pGetTextExtentPoint)(DC*,LPCSTR,INT,LPSIZE);
BOOL (*pGetTextMetrics)(DC*,TEXTMETRICA*); BOOL (*pGetTextMetrics)(DC*,TEXTMETRICA*);
INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT); INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT);
INT (*pIntersectVisRect)(DC*,INT,INT,INT,INT); BOOL (*pInvertRgn)(DC*,HRGN);
BOOL (*pLineTo)(DC*,INT,INT); BOOL (*pLineTo)(DC*,INT,INT);
HANDLE (*pLoadOEMResource)(WORD,WORD); HANDLE (*pLoadOEMResource)(WORD,WORD);
BOOL (*pMoveToEx)(DC*,INT,INT,LPPOINT); BOOL (*pMoveToEx)(DC*,INT,INT,LPPOINT);
@ -206,27 +213,29 @@ typedef struct tagDC_FUNCS
INT (*pSelectClipRgn)(DC*,HRGN); INT (*pSelectClipRgn)(DC*,HRGN);
HANDLE (*pSelectObject)(DC*,HANDLE); HANDLE (*pSelectObject)(DC*,HANDLE);
HPALETTE (*pSelectPalette)(DC*,HPALETTE,BOOL); HPALETTE (*pSelectPalette)(DC*,HPALETTE,BOOL);
COLORREF (*pSetBkColor)(DC*,COLORREF); COLORREF (*pSetBkColor)(DC*,COLORREF);
WORD (*pSetBkMode)(DC*,WORD); INT (*pSetBkMode)(DC*,INT);
VOID (*pSetDeviceClipping)(DC*); VOID (*pSetDeviceClipping)(DC*);
INT (*pSetDIBitsToDevice)(DC*,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT); INT (*pSetDIBitsToDevice)(DC*,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,
LPCVOID,const BITMAPINFO*,UINT);
INT (*pSetMapMode)(DC*,INT); INT (*pSetMapMode)(DC*,INT);
DWORD (*pSetMapperFlags)(DC*,DWORD); DWORD (*pSetMapperFlags)(DC*,DWORD);
COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF); COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF);
WORD (*pSetPolyFillMode)(DC*,WORD); INT (*pSetPolyFillMode)(DC*,INT);
WORD (*pSetROP2)(DC*,WORD); INT (*pSetROP2)(DC*,INT);
WORD (*pSetRelAbs)(DC*,WORD); INT (*pSetRelAbs)(DC*,INT);
WORD (*pSetStretchBltMode)(DC*,WORD); INT (*pSetStretchBltMode)(DC*,INT);
WORD (*pSetTextAlign)(DC*,WORD); UINT (*pSetTextAlign)(DC*,UINT);
INT (*pSetTextCharacterExtra)(DC*,INT); INT (*pSetTextCharacterExtra)(DC*,INT);
DWORD (*pSetTextColor)(DC*,DWORD); DWORD (*pSetTextColor)(DC*,DWORD);
INT (*pSetTextJustification)(DC*,INT,INT); INT (*pSetTextJustification)(DC*,INT,INT);
BOOL (*pSetViewportExt)(DC*,INT,INT); BOOL (*pSetViewportExt)(DC*,INT,INT);
BOOL (*pSetViewportOrg)(DC*,INT,INT); BOOL (*pSetViewportOrg)(DC*,INT,INT);
BOOL (*pSetWindowExt)(DC*,INT,INT); BOOL (*pSetWindowExt)(DC*,INT,INT);
BOOL (*pSetWindowOrg)(DC*,INT,INT); BOOL (*pSetWindowOrg)(DC*,INT,INT);
BOOL (*pStretchBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,INT,INT,DWORD); BOOL (*pStretchBlt)(DC*,INT,INT,INT,INT,DC*,INT,INT,INT,INT,DWORD);
INT (*pStretchDIBits)(DC*,INT,INT,INT,INT,INT,INT,INT,INT,const void *,const BITMAPINFO *,UINT,DWORD); INT (*pStretchDIBits)(DC*,INT,INT,INT,INT,INT,INT,INT,INT,
const void *,const BITMAPINFO *,UINT,DWORD);
} DC_FUNCTIONS; } DC_FUNCTIONS;
/* LoadOEMResource types */ /* LoadOEMResource types */

View File

@ -31,60 +31,79 @@ extern BOOL MFDRV_MetaParam8(DC *dc, short func, short param1, short param2,
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(DC *dc, METARECORD *mr, DWORD rlen);
extern int MFDRV_AddHandleDC( DC *dc ); extern int MFDRV_AddHandleDC( DC *dc );
extern INT16 MFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush );
/* Metafile driver functions */ /* Metafile driver functions */
extern BOOL MFDRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst, extern BOOL MFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom,
INT width, INT height, struct tagDC *dcSrc, INT xstart, INT ystart, INT xend, INT yend );
INT xSrc, INT ySrc, DWORD rop ); extern BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width,
extern BOOL MFDRV_PatBlt( struct tagDC *dc, INT left, INT top, INT height, DC *dcSrc, INT xSrc, INT ySrc,
INT width, INT height, DWORD rop ); DWORD rop );
extern BOOL MFDRV_StretchBlt( struct tagDC *dcDst, INT xDst, INT yDst, extern BOOL MFDRV_Chord( DC *dc, INT left, INT top, INT right,
INT widthDst, INT heightDst,
struct tagDC *dcSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop );
extern INT MFDRV_SetMapMode( struct tagDC *dc, INT mode );
extern BOOL MFDRV_SetViewportExt( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_SetViewportOrg( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_SetWindowExt( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_SetWindowOrg( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_OffsetViewportOrg( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_OffsetWindowOrg( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_ScaleViewportExt( struct tagDC *dc, INT xNum,
INT xDenom, INT yNum, INT yDenom );
extern BOOL MFDRV_ScaleWindowExt( struct tagDC *dc, INT xNum, INT xDenom,
INT yNum, INT yDenom );
extern BOOL MFDRV_MoveToEx(struct tagDC *dc, INT x, INT y, LPPOINT pt);
extern BOOL MFDRV_LineTo( struct tagDC *dc, INT x, INT y );
extern BOOL MFDRV_Arc( struct tagDC *dc, 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_Pie( struct tagDC *dc, INT left, INT top, INT right, extern BOOL MFDRV_Ellipse( DC *dc, INT left, INT top,
INT bottom, INT xstart, INT ystart, INT xend, INT right, INT bottom );
INT yend ); extern INT MFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT
extern BOOL MFDRV_Chord( struct tagDC *dc, INT left, INT top, INT right, bottom );
INT bottom, INT xstart, INT ystart, INT xend, extern BOOL MFDRV_ExtFloodFill( DC *dc, INT x, INT y,
INT yend ); COLORREF color, UINT fillType );
extern BOOL MFDRV_Ellipse( struct tagDC *dc, INT left, INT top, extern BOOL MFDRV_ExtTextOut( DC *dc, INT x, INT y,
INT right, INT bottom ); UINT flags, const RECT *lprect, LPCSTR str,
extern BOOL MFDRV_Rectangle( struct tagDC *dc, INT left, INT top, UINT count, const INT *lpDx );
INT right, INT bottom); extern BOOL MFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush );
extern BOOL MFDRV_RoundRect( struct tagDC *dc, INT left, INT top, extern BOOL MFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT x, INT y );
INT right, INT bottom, INT ell_width, extern INT MFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT
INT ell_height ); bottom );
extern COLORREF MFDRV_SetPixel( struct tagDC *dc, INT x, INT y, COLORREF color ); extern BOOL MFDRV_InvertRgn( DC *dc, HRGN hrgn );
extern BOOL MFDRV_Polyline( struct tagDC *dc, const POINT* pt,INT count); extern BOOL MFDRV_LineTo( DC *dc, INT x, INT y );
extern BOOL MFDRV_Polygon( struct tagDC *dc, const POINT* pt, INT count ); extern BOOL MFDRV_MoveToEx( DC *dc, INT x, INT y, LPPOINT pt );
extern BOOL MFDRV_PolyPolygon( struct tagDC *dc, const POINT* pt, const INT* counts, extern INT MFDRV_OffsetClipRgn( DC *dc, INT x, INT y );
UINT polygons); extern BOOL MFDRV_OffsetViewportOrg( DC *dc, INT x, INT y );
extern BOOL MFDRV_OffsetWindowOrg( DC *dc, INT x, INT y );
extern BOOL MFDRV_PaintRgn( DC *dc, HRGN hrgn );
extern BOOL MFDRV_PatBlt( DC *dc, INT left, INT top, INT width, INT height,
DWORD rop );
extern BOOL MFDRV_Pie( DC *dc, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend );
extern BOOL MFDRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts,
UINT polygons);
extern BOOL MFDRV_Polygon( DC *dc, const POINT* pt, INT count );
extern BOOL MFDRV_Polyline( DC *dc, const POINT* pt,INT count);
extern BOOL MFDRV_Rectangle( DC *dc, INT left, INT top,
INT right, INT bottom);
extern BOOL MFDRV_RestoreDC( DC *dc, INT level );
extern BOOL MFDRV_RoundRect( DC *dc, INT left, INT top,
INT right, INT bottom, INT ell_width,
INT ell_height );
extern INT MFDRV_SaveDC( DC *dc );
extern BOOL MFDRV_ScaleViewportExt( DC *dc, INT xNum, INT xDenom, INT yNum,
INT yDenom );
extern BOOL MFDRV_ScaleWindowExt( DC *dc, INT xNum, INT xDenom, INT yNum,
INT yDenom );
extern HGDIOBJ MFDRV_SelectObject( DC *dc, HGDIOBJ handle ); extern HGDIOBJ MFDRV_SelectObject( DC *dc, HGDIOBJ handle );
extern COLORREF MFDRV_SetBkColor( DC *dc, COLORREF color ); extern COLORREF MFDRV_SetBkColor( DC *dc, COLORREF color );
extern INT MFDRV_SetBkMode( DC *dc, INT mode );
extern INT MFDRV_SetMapMode( DC *dc, INT mode );
extern DWORD MFDRV_SetMapperFlags( DC *dc, DWORD flags );
extern COLORREF MFDRV_SetPixel( DC *dc, INT x, INT y, COLORREF color );
extern INT MFDRV_SetPolyFillMode( DC *dc, INT mode );
extern INT MFDRV_SetROP2( DC *dc, INT rop );
extern INT MFDRV_SetRelAbs( DC *dc, INT mode );
extern INT MFDRV_SetStretchBltMode( DC *dc, INT mode );
extern UINT MFDRV_SetTextAlign( DC *dc, UINT align );
extern INT MFDRV_SetTextCharacterExtra( DC *dc, INT extra );
extern COLORREF MFDRV_SetTextColor( DC *dc, COLORREF color ); extern COLORREF MFDRV_SetTextColor( DC *dc, COLORREF color );
extern BOOL MFDRV_ExtFloodFill( struct tagDC *dc, INT x, INT y, extern INT MFDRV_SetTextJustification( DC *dc, INT extra, INT breaks );
COLORREF color, UINT fillType ); extern BOOL MFDRV_SetViewportExt( DC *dc, INT x, INT y );
extern BOOL MFDRV_ExtTextOut( struct tagDC *dc, INT x, INT y, extern BOOL MFDRV_SetViewportOrg( DC *dc, INT x, INT y );
UINT flags, const RECT *lprect, LPCSTR str, extern BOOL MFDRV_SetWindowExt( DC *dc, INT x, INT y );
UINT count, const INT *lpDx ); extern BOOL MFDRV_SetWindowOrg( DC *dc, INT x, INT y );
extern BOOL MFDRV_StretchBlt( DC *dcDst, INT xDst, INT yDst, INT widthDst,
INT heightDst, DC *dcSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop );
extern BOOL MFDRV_PaintRgn( DC *dc, HRGN hrgn ); extern BOOL MFDRV_PaintRgn( DC *dc, HRGN hrgn );
extern INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx, extern INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc, DWORD cy, INT xSrc, INT ySrc,

View File

@ -312,10 +312,12 @@ DECL_WINELIB_TYPE_AW(LOGCOLORSPACE)
#define BLACKONWHITE 1 #define BLACKONWHITE 1
#define WHITEONBLACK 2 #define WHITEONBLACK 2
#define COLORONCOLOR 3 #define COLORONCOLOR 3
#define HALFTONE 4
#define STRETCH_ANDSCANS BLACKONWHITE #define STRETCH_ANDSCANS BLACKONWHITE
#define STRETCH_ORSCANS WHITEONBLACK #define STRETCH_ORSCANS WHITEONBLACK
#define STRETCH_DELETESCANS COLORONCOLOR #define STRETCH_DELETESCANS COLORONCOLOR
#define STRETCH_HALFTONE HALFTONE
/* Colors */ /* Colors */

View File

@ -6,7 +6,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "dc.h" #include "dc.h"
#include "metafiledrv.h"
#include "region.h" #include "region.h"
#include "debug.h" #include "debug.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
@ -150,27 +149,20 @@ INT16 WINAPI OffsetClipRgn16( HDC16 hdc, INT16 x, INT16 y )
*/ */
INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y ) INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); INT ret = SIMPLEREGION;
if (!dc) DC *dc = DC_GetDCPtr( hdc );
{ if (!dc) return ERROR;
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return ERROR;
MFDRV_MetaParam2(dc, META_OFFSETCLIPRGN, x, y);
GDI_HEAP_UNLOCK( hdc );
return NULLREGION; /* ?? */
}
TRACE(clipping, "%04x %d,%d\n", hdc, x, y ); TRACE(clipping, "%04x %d,%d\n", hdc, x, y );
if (dc->w.hClipRgn) if(dc->funcs->pOffsetClipRgn)
{ ret = dc->funcs->pOffsetClipRgn( dc, x, y );
INT ret = OffsetRgn( dc->w.hClipRgn, XLSTODS(dc,x), YLSTODS(dc,y)); else if (dc->w.hClipRgn) {
ret = OffsetRgn( dc->w.hClipRgn, XLSTODS(dc,x), YLSTODS(dc,y));
CLIPPING_UpdateGCRegion( dc ); CLIPPING_UpdateGCRegion( dc );
GDI_HEAP_UNLOCK( hdc );
return ret;
} }
GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdc );
return SIMPLEREGION; /* Clip region == client area */ return ret;
} }
@ -255,24 +247,22 @@ INT WINAPI ExcludeClipRect( HDC hdc, INT left, INT top,
INT right, INT bottom ) INT right, INT bottom )
{ {
INT ret; INT ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) if (!dc) return ERROR;
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return ERROR;
MFDRV_MetaParam4(dc, META_EXCLUDECLIPRECT, left, top, right, bottom);
GDI_HEAP_UNLOCK( hdc );
return NULLREGION; /* ?? */
}
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
TRACE(clipping, "%04x %dx%d,%dx%d\n", TRACE(clipping, "%04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_EXCLUDE );
if(dc->funcs->pExcludeClipRect)
ret = dc->funcs->pExcludeClipRect( dc, left, top, right, bottom );
else {
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_EXCLUDE );
}
GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdc );
return ret; return ret;
} }
@ -295,24 +285,22 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top,
INT right, INT bottom ) INT right, INT bottom )
{ {
INT ret; INT ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) if (!dc) return ERROR;
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return ERROR;
MFDRV_MetaParam4(dc, META_INTERSECTCLIPRECT, left, top, right, bottom);
GDI_HEAP_UNLOCK( hdc );
return NULLREGION; /* ?? */
}
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
TRACE(clipping, "%04x %dx%d,%dx%d\n", TRACE(clipping, "%04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom ); hdc, left, top, right, bottom );
ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_INTERSECT );
if(dc->funcs->pIntersectClipRect)
ret = dc->funcs->pIntersectClipRect( dc, left, top, right, bottom );
else {
left = XLPTODP( dc, left );
right = XLPTODP( dc, right );
top = YLPTODP( dc, top );
bottom = YLPTODP( dc, bottom );
ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_INTERSECT );
}
GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdc );
return ret; return ret;
} }

View File

@ -15,7 +15,6 @@
#include "dc.h" #include "dc.h"
#include "gdi.h" #include "gdi.h"
#include "heap.h" #include "heap.h"
#include "metafiledrv.h"
#include "debug.h" #include "debug.h"
#include "font.h" #include "font.h"
#include "winerror.h" #include "winerror.h"
@ -120,7 +119,8 @@ DC *DC_GetDCPtr( HDC hdc )
{ {
GDIOBJHDR *ptr = (GDIOBJHDR *)GDI_HEAP_LOCK( hdc ); GDIOBJHDR *ptr = (GDIOBJHDR *)GDI_HEAP_LOCK( hdc );
if (!ptr) return NULL; if (!ptr) return NULL;
if ((ptr->wMagic == DC_MAGIC) || (ptr->wMagic == METAFILE_DC_MAGIC)) if ((ptr->wMagic == DC_MAGIC) || (ptr->wMagic == METAFILE_DC_MAGIC) ||
(ptr->wMagic == ENHMETAFILE_DC_MAGIC))
return (DC *)ptr; return (DC *)ptr;
GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdc );
return NULL; return NULL;
@ -407,15 +407,12 @@ INT WINAPI SaveDC( HDC hdc )
DC * dc, * dcs; DC * dc, * dcs;
INT ret; INT ret;
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); dc = DC_GetDCPtr( hdc );
if (!dc) if (!dc) return 0;
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); if(dc->funcs->pSaveDC)
if (!dc) return 0; return dc->funcs->pSaveDC( dc );
MFDRV_MetaParam0(dc, META_SAVEDC);
GDI_HEAP_UNLOCK( hdc );
return 1; /* ?? */
}
if (!(hdcs = GetDCState16( hdc ))) if (!(hdcs = GetDCState16( hdc )))
{ {
GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdc );
@ -465,20 +462,11 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
BOOL success; BOOL success;
TRACE(dc, "%04x %d\n", hdc, level ); TRACE(dc, "%04x %d\n", hdc, level );
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); dc = DC_GetDCPtr( hdc );
if (!dc) if(!dc) return FALSE;
{ if(dc->funcs->pRestoreDC)
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); return dc->funcs->pRestoreDC( dc, level );
if (!dc) return FALSE;
if (level != -1)
{
GDI_HEAP_UNLOCK( hdc );
return FALSE;
}
MFDRV_MetaParam1(dc, META_RESTOREDC, level);
GDI_HEAP_UNLOCK( hdc );
return TRUE;
}
if (level == -1) level = dc->saveLevel; if (level == -1) level = dc->saveLevel;
if ((level < 1) || (level > dc->saveLevel)) if ((level < 1) || (level > dc->saveLevel))
{ {
@ -823,37 +811,33 @@ COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
return oldColor; return oldColor;
} }
/*********************************************************************** /***********************************************************************
* SetTextAlign16 (GDI.346) * SetTextAlign16 (GDI.346)
*/ */
UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 textAlign ) UINT16 WINAPI SetTextAlign16( HDC16 hdc, UINT16 align )
{ {
return SetTextAlign( hdc, textAlign ); return SetTextAlign( hdc, align );
} }
/*********************************************************************** /***********************************************************************
* SetTextAlign32 (GDI32.336) * SetTextAlign (GDI32.336)
*/ */
UINT WINAPI SetTextAlign( HDC hdc, UINT textAlign ) UINT WINAPI SetTextAlign( HDC hdc, UINT align )
{ {
UINT prevAlign; UINT prevAlign;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC *dc = DC_GetDCPtr( hdc );
if (!dc) if (!dc) return 0x0;
{ if (dc->funcs->pSetTextAlign)
if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ))) return 0; prevAlign = dc->funcs->pSetTextAlign(dc, align);
MFDRV_MetaParam1( dc, META_SETTEXTALIGN, textAlign ); else {
GDI_HEAP_UNLOCK( hdc ); prevAlign = dc->w.textAlign;
return 1; dc->w.textAlign = align;
} }
prevAlign = dc->w.textAlign;
dc->w.textAlign = textAlign;
GDI_HEAP_UNLOCK( hdc ); GDI_HEAP_UNLOCK( hdc );
return prevAlign; return prevAlign;
} }
/*********************************************************************** /***********************************************************************
* GetDCOrgEx (GDI32.168) * GetDCOrgEx (GDI32.168)
*/ */

View File

@ -6,8 +6,7 @@
*/ */
#include "gdi.h" #include "gdi.h"
#include "metafiledrv.h" #include "dc.h"
#define DC_GET_VAL_16( func_type, func_name, dc_field ) \ #define DC_GET_VAL_16( func_type, func_name, dc_field ) \
func_type WINAPI func_name( HDC16 hdc ) \ func_type WINAPI func_name( HDC16 hdc ) \
@ -56,61 +55,45 @@ BOOL WINAPI func_name( HDC hdc, LP##type pt ) \
return TRUE; \ return TRUE; \
} }
#define DC_SET_MODE_16( func_name, dc_field, min_val, max_val, meta_func ) \ #define DC_SET_MODE( func_name, dc_field, min_val, max_val ) \
INT16 WINAPI func_name( HDC16 hdc, INT16 mode ) \ INT16 WINAPI func_name##16( HDC16 hdc, INT16 mode ) \
{ \ { \
INT16 prevMode; \ return func_name( hdc, mode ); \
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \ } \
if ((mode < min_val) || (mode > max_val)) return 0; \ \
if (!dc) { \
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); \
if (!dc) return 0; \
MFDRV_MetaParam1(dc, meta_func, mode); \
return 1; \
} \
prevMode = dc->dc_field; \
dc->dc_field = mode; \
return prevMode; \
}
#define DC_SET_MODE_32( func_name, dc_field, min_val, max_val, meta_func ) \
INT WINAPI func_name( HDC hdc, INT mode ) \ INT WINAPI func_name( HDC hdc, INT mode ) \
{ \ { \
INT prevMode; \ INT prevMode; \
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); \ DC *dc = DC_GetDCPtr( hdc ); \
if(!dc) return 0; \
if ((mode < min_val) || (mode > max_val)) return 0; \ if ((mode < min_val) || (mode > max_val)) return 0; \
if (!dc) { \ if (dc->funcs->p##func_name) { \
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC); \ prevMode = dc->funcs->p##func_name( dc, mode ); \
if (!dc) return 0; \ } else { \
MFDRV_MetaParam1(dc, meta_func, mode); \ prevMode = dc->dc_field; \
return 1; \ dc->dc_field = mode; \
} \ } \
prevMode = dc->dc_field; \ GDI_HEAP_UNLOCK( hdc ); \
dc->dc_field = mode; \
return prevMode; \ return prevMode; \
} }
DC_SET_MODE_16( SetBkMode16, w.backgroundMode, TRANSPARENT, /* GDI.2 */
OPAQUE, META_SETBKMODE ) /* GDI.2 GDI32.306 */
DC_SET_MODE_32( SetBkMode, w.backgroundMode, TRANSPARENT, /* GDI32.306 */ DC_SET_MODE( SetBkMode, w.backgroundMode, TRANSPARENT, OPAQUE )
OPAQUE, META_SETBKMODE )
DC_SET_MODE_16( SetROP216, w.ROPmode, R2_BLACK, R2_WHITE, /* GDI.4 */ /* GDI.4 GDI32.331 */
META_SETROP2 ) DC_SET_MODE( SetROP2, w.ROPmode, R2_BLACK, R2_WHITE )
DC_SET_MODE_32( SetROP2, w.ROPmode, R2_BLACK, R2_WHITE, /* GDI32.331 */
META_SETROP2 ) /* GDI.5 GDI32.333 */
DC_SET_MODE_16( SetRelAbs16, w.relAbsMode, ABSOLUTE, RELATIVE, /* GDI.5 */ DC_SET_MODE( SetRelAbs, w.relAbsMode, ABSOLUTE, RELATIVE )
META_SETRELABS )
DC_SET_MODE_32( SetRelAbs, w.relAbsMode, ABSOLUTE, RELATIVE, /* GDI32.333 */ /* GDI.6 GDI32.330 */
META_SETRELABS ) DC_SET_MODE( SetPolyFillMode, w.polyFillMode, ALTERNATE, WINDING )
DC_SET_MODE_16( SetPolyFillMode16, w.polyFillMode, /* GDI.6 */
ALTERNATE, WINDING, META_SETPOLYFILLMODE ) /* GDI.7 GDI32.334 */
DC_SET_MODE_32( SetPolyFillMode, w.polyFillMode, /* GDI32.330 */ DC_SET_MODE( SetStretchBltMode, w.stretchBltMode, BLACKONWHITE, HALFTONE )
ALTERNATE, WINDING, META_SETPOLYFILLMODE )
DC_SET_MODE_16( SetStretchBltMode16, w.stretchBltMode, /* GDI.7 */
BLACKONWHITE, COLORONCOLOR, META_SETSTRETCHBLTMODE )
DC_SET_MODE_32( SetStretchBltMode, w.stretchBltMode, /* GDI32.334 */
BLACKONWHITE, COLORONCOLOR, META_SETSTRETCHBLTMODE )
DC_GET_VAL_16( COLORREF, GetBkColor16, w.backgroundColor ) /* GDI.75 */ DC_GET_VAL_16( COLORREF, GetBkColor16, w.backgroundColor ) /* GDI.75 */
DC_GET_VAL_32( COLORREF, GetBkColor, w.backgroundColor ) /* GDI32.145 */ DC_GET_VAL_32( COLORREF, GetBkColor, w.backgroundColor ) /* GDI32.145 */
DC_GET_VAL_16( INT16, GetBkMode16, w.backgroundMode ) /* GDI.76 */ DC_GET_VAL_16( INT16, GetBkMode16, w.backgroundMode ) /* GDI.76 */

View File

@ -14,6 +14,7 @@
#include "options.h" #include "options.h"
#include "debug.h" #include "debug.h"
#include "winerror.h" #include "winerror.h"
#include "dc.h"
DECLARE_DEBUG_CHANNEL(font) DECLARE_DEBUG_CHANNEL(font)
DECLARE_DEBUG_CHANNEL(gdi) DECLARE_DEBUG_CHANNEL(gdi)
@ -659,8 +660,10 @@ INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra ) INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
{ {
INT prev; INT prev;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0; if (!dc) return 0;
if (dc->funcs->pSetTextCharacterExtra)
return dc->funcs->pSetTextCharacterExtra( dc, extra );
extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX; extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
prev = dc->w.charExtra; prev = dc->w.charExtra;
dc->w.charExtra = abs(extra); dc->w.charExtra = abs(extra);
@ -678,12 +681,14 @@ INT16 WINAPI SetTextJustification16( HDC16 hdc, INT16 extra, INT16 breaks )
/*********************************************************************** /***********************************************************************
* SetTextJustification32 (GDI32.339) * SetTextJustification (GDI32.339)
*/ */
BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks ) BOOL WINAPI SetTextJustification( HDC hdc, INT extra, INT breaks )
{ {
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ); DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0; if (!dc) return 0;
if (dc->funcs->pSetTextJustification)
return dc->funcs->pSetTextJustification( dc, extra, breaks );
extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX); extra = abs((extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX);
if (!extra) breaks = 0; if (!extra) breaks = 0;
@ -1172,8 +1177,15 @@ DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag )
*/ */
DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag ) DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag )
{ {
FIXME(font, "(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag); DC *dc = DC_GetDCPtr( hDC );
return 0; DWORD ret = 0;
if(!dc) return 0;
if(dc->funcs->pSetMapperFlags)
ret = dc->funcs->pSetMapperFlags( dc, dwFlag );
else
FIXME(font, "(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag);
GDI_HEAP_UNLOCK( hDC );
return ret;
} }
/*********************************************************************** /***********************************************************************

View File

@ -581,7 +581,12 @@ DWORD WINAPI GetObjectType( HANDLE handle )
case METAFILE_DC_MAGIC: case METAFILE_DC_MAGIC:
result = OBJ_METADC; result = OBJ_METADC;
break; break;
case ENHMETAFILE_MAGIC:
result = OBJ_ENHMETAFILE;
break;
case ENHMETAFILE_DC_MAGIC:
result = OBJ_ENHMETADC;
break;
default: default:
FIXME(gdi, "Magic %04x not implemented\n", FIXME(gdi, "Magic %04x not implemented\n",
ptr->wMagic ); ptr->wMagic );

View File

@ -737,7 +737,7 @@ static BOOL MF_Play_MetaExtTextOut(HDC16 hdc, METARECORD *mr);
* BUGS * BUGS
* The following metafile records are unimplemented: * The following metafile records are unimplemented:
* *
* FRAMEREGION, DRAWTEXT, ANIMATEPALETTE, SETPALENTRIES, * DRAWTEXT, ANIMATEPALETTE, SETPALENTRIES,
* RESIZEPALETTE, EXTFLOODFILL, RESETDC, STARTDOC, STARTPAGE, ENDPAGE, * RESIZEPALETTE, EXTFLOODFILL, RESETDC, STARTDOC, STARTPAGE, ENDPAGE,
* ABORTDOC, ENDDOC, CREATEBRUSH, CREATEBITMAPINDIRECT, and CREATEBITMAP. * ABORTDOC, ENDDOC, CREATEBRUSH, CREATEBITMAPINDIRECT, and CREATEBITMAP.
* *
@ -1001,7 +1001,7 @@ void WINAPI PlayMetaFileRecord16(
break; break;
case META_SETMAPPERFLAGS: case META_SETMAPPERFLAGS:
SetMapperFlags16(hdc, *(mr->rdParm)); SetMapperFlags16(hdc, MAKELONG(mr->rdParm[0],mr->rdParm[1]));
break; break;
case META_REALIZEPALETTE: case META_REALIZEPALETTE:
@ -1083,8 +1083,14 @@ void WINAPI PlayMetaFileRecord16(
break; break;
case META_FILLREGION: case META_FILLREGION:
FillRgn16(hdc, *(ht->objectHandle + *(mr->rdParm)), FillRgn16(hdc, *(ht->objectHandle + *(mr->rdParm+1)),
*(ht->objectHandle + *(mr->rdParm+1))); *(ht->objectHandle + *(mr->rdParm)));
break;
case META_FRAMEREGION:
FrameRgn16(hdc, *(ht->objectHandle + *(mr->rdParm+3)),
*(ht->objectHandle + *(mr->rdParm+2)),
*(mr->rdParm+1), *(mr->rdParm));
break; break;
case META_INVERTREGION: case META_INVERTREGION:
@ -1168,7 +1174,6 @@ void WINAPI PlayMetaFileRecord16(
#define META_UNIMP(x) case x: \ #define META_UNIMP(x) case x: \
FIXME(metafile, "PlayMetaFileRecord:record type "#x" not implemented.\n"); \ FIXME(metafile, "PlayMetaFileRecord:record type "#x" not implemented.\n"); \
break; break;
META_UNIMP(META_FRAMEREGION)
META_UNIMP(META_DRAWTEXT) META_UNIMP(META_DRAWTEXT)
META_UNIMP(META_ANIMATEPALETTE) META_UNIMP(META_ANIMATEPALETTE)
META_UNIMP(META_SETPALENTRIES) META_UNIMP(META_SETPALENTRIES)