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 = \
bitblt.c \
dc.c \
graphics.c \
init.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
*/

View File

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

View File

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

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 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;
retval = PaintRgn( hdc, hrgn );
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,
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;
FillRgn( hdc, tmp, hbrush );
DeleteObject( tmp );
@ -626,9 +638,17 @@ BOOL16 WINAPI InvertRgn16( HDC16 hdc, HRGN16 hrgn )
*/
BOOL WINAPI InvertRgn( HDC hdc, HRGN hrgn )
{
HBRUSH prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) );
INT prevROP = SetROP2( hdc, R2_NOT );
BOOL retval = PaintRgn( hdc, hrgn );
HBRUSH prevBrush;
INT prevROP;
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 );
SetROP2( hdc, prevROP );
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
dialog box. I've only really tested ppd parsing on the hp4m6_v1.ppd file.
Many graphics functions to do.
No TrueType download.
StretchDIBits uses level 2 PostScript.
AdvancedSetup dialog box.
Many partially implemented functions.

View File

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

View File

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

View File

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

View File

@ -26,6 +26,9 @@
#define META_DC_MAGIC 0x4f4f
#define METAFILE_MAGIC 0x4f50
#define METAFILE_DC_MAGIC 0x4f51
#define ENHMETAFILE_MAGIC 0x4f52
#define ENHMETAFILE_DC_MAGIC 0x4f53
#define MAGIC_DONTCARE 0xffff
typedef struct tagGDIOBJHDR
@ -161,27 +164,31 @@ typedef struct tagDC_FUNCS
{
BOOL (*pArc)(DC*,INT,INT,INT,INT,INT,INT,INT,INT);
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 (*pCreateBitmap)(HBITMAP);
BOOL (*pCreateDC)(DC*,LPCSTR,LPCSTR,LPCSTR,const DEVMODE16*);
BOOL (*pDeleteDC)(DC*);
HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE,DWORD);
HBITMAP16 (*pCreateDIBSection16)(DC *,BITMAPINFO *,UINT16,SEGPTR *,HANDLE,DWORD);
HBITMAP (*pCreateDIBSection)(DC *,BITMAPINFO *,UINT,LPVOID *,HANDLE,
DWORD);
HBITMAP16 (*pCreateDIBSection16)(DC *,BITMAPINFO *,UINT16,SEGPTR *,HANDLE,
DWORD);
BOOL (*pDeleteObject)(HGDIOBJ);
BOOL (*pEllipse)(DC*,INT,INT,INT,INT);
BOOL (*pEnumDeviceFonts)(DC*,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM);
INT (*pEscape)(DC*,INT,INT,SEGPTR,SEGPTR);
INT (*pExcludeClipRect)(DC*,INT,INT,INT,INT);
INT (*pExcludeVisRect)(DC*,INT,INT,INT,INT);
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);
COLORREF (*pGetPixel)(DC*,INT,INT);
COLORREF (*pGetPixel)(DC*,INT,INT);
BOOL (*pGetTextExtentPoint)(DC*,LPCSTR,INT,LPSIZE);
BOOL (*pGetTextMetrics)(DC*,TEXTMETRICA*);
INT (*pIntersectClipRect)(DC*,INT,INT,INT,INT);
INT (*pIntersectVisRect)(DC*,INT,INT,INT,INT);
BOOL (*pInvertRgn)(DC*,HRGN);
BOOL (*pLineTo)(DC*,INT,INT);
HANDLE (*pLoadOEMResource)(WORD,WORD);
BOOL (*pMoveToEx)(DC*,INT,INT,LPPOINT);
@ -206,27 +213,29 @@ typedef struct tagDC_FUNCS
INT (*pSelectClipRgn)(DC*,HRGN);
HANDLE (*pSelectObject)(DC*,HANDLE);
HPALETTE (*pSelectPalette)(DC*,HPALETTE,BOOL);
COLORREF (*pSetBkColor)(DC*,COLORREF);
WORD (*pSetBkMode)(DC*,WORD);
VOID (*pSetDeviceClipping)(DC*);
INT (*pSetDIBitsToDevice)(DC*,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,LPCVOID,const BITMAPINFO*,UINT);
COLORREF (*pSetBkColor)(DC*,COLORREF);
INT (*pSetBkMode)(DC*,INT);
VOID (*pSetDeviceClipping)(DC*);
INT (*pSetDIBitsToDevice)(DC*,INT,INT,DWORD,DWORD,INT,INT,UINT,UINT,
LPCVOID,const BITMAPINFO*,UINT);
INT (*pSetMapMode)(DC*,INT);
DWORD (*pSetMapperFlags)(DC*,DWORD);
COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF);
WORD (*pSetPolyFillMode)(DC*,WORD);
WORD (*pSetROP2)(DC*,WORD);
WORD (*pSetRelAbs)(DC*,WORD);
WORD (*pSetStretchBltMode)(DC*,WORD);
WORD (*pSetTextAlign)(DC*,WORD);
DWORD (*pSetMapperFlags)(DC*,DWORD);
COLORREF (*pSetPixel)(DC*,INT,INT,COLORREF);
INT (*pSetPolyFillMode)(DC*,INT);
INT (*pSetROP2)(DC*,INT);
INT (*pSetRelAbs)(DC*,INT);
INT (*pSetStretchBltMode)(DC*,INT);
UINT (*pSetTextAlign)(DC*,UINT);
INT (*pSetTextCharacterExtra)(DC*,INT);
DWORD (*pSetTextColor)(DC*,DWORD);
DWORD (*pSetTextColor)(DC*,DWORD);
INT (*pSetTextJustification)(DC*,INT,INT);
BOOL (*pSetViewportExt)(DC*,INT,INT);
BOOL (*pSetViewportOrg)(DC*,INT,INT);
BOOL (*pSetWindowExt)(DC*,INT,INT);
BOOL (*pSetWindowOrg)(DC*,INT,INT);
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;
/* 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);
extern BOOL MFDRV_WriteRecord(DC *dc, METARECORD *mr, DWORD rlen);
extern int MFDRV_AddHandleDC( DC *dc );
extern INT16 MFDRV_CreateBrushIndirect( DC *dc, HBRUSH hBrush );
/* Metafile driver functions */
extern BOOL MFDRV_BitBlt( struct tagDC *dcDst, INT xDst, INT yDst,
INT width, INT height, struct tagDC *dcSrc,
INT xSrc, INT ySrc, DWORD rop );
extern BOOL MFDRV_PatBlt( struct tagDC *dc, INT left, INT top,
INT width, INT height, DWORD rop );
extern BOOL MFDRV_StretchBlt( struct tagDC *dcDst, INT xDst, INT yDst,
INT widthDst, INT heightDst,
struct tagDC *dcSrc, INT xSrc, INT ySrc,
INT widthSrc, INT heightSrc, DWORD rop );
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,
extern BOOL MFDRV_Arc( DC *dc, INT left, INT top, INT right, INT bottom,
INT xstart, INT ystart, INT xend, INT yend );
extern BOOL MFDRV_BitBlt( DC *dcDst, INT xDst, INT yDst, INT width,
INT height, DC *dcSrc, INT xSrc, INT ySrc,
DWORD rop );
extern BOOL MFDRV_Chord( DC *dc, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend );
extern BOOL MFDRV_Pie( struct tagDC *dc, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend );
extern BOOL MFDRV_Chord( struct tagDC *dc, INT left, INT top, INT right,
INT bottom, INT xstart, INT ystart, INT xend,
INT yend );
extern BOOL MFDRV_Ellipse( struct tagDC *dc, INT left, INT top,
INT right, INT bottom );
extern BOOL MFDRV_Rectangle( struct tagDC *dc, INT left, INT top,
INT right, INT bottom);
extern BOOL MFDRV_RoundRect( struct tagDC *dc, INT left, INT top,
INT right, INT bottom, INT ell_width,
INT ell_height );
extern COLORREF MFDRV_SetPixel( struct tagDC *dc, INT x, INT y, COLORREF color );
extern BOOL MFDRV_Polyline( struct tagDC *dc, const POINT* pt,INT count);
extern BOOL MFDRV_Polygon( struct tagDC *dc, const POINT* pt, INT count );
extern BOOL MFDRV_PolyPolygon( struct tagDC *dc, const POINT* pt, const INT* counts,
UINT polygons);
extern BOOL MFDRV_Ellipse( DC *dc, INT left, INT top,
INT right, INT bottom );
extern INT MFDRV_ExcludeClipRect( DC *dc, INT left, INT top, INT right, INT
bottom );
extern BOOL MFDRV_ExtFloodFill( DC *dc, INT x, INT y,
COLORREF color, UINT fillType );
extern BOOL MFDRV_ExtTextOut( DC *dc, INT x, INT y,
UINT flags, const RECT *lprect, LPCSTR str,
UINT count, const INT *lpDx );
extern BOOL MFDRV_FillRgn( DC *dc, HRGN hrgn, HBRUSH hbrush );
extern BOOL MFDRV_FrameRgn( DC *dc, HRGN hrgn, HBRUSH hbrush, INT x, INT y );
extern INT MFDRV_IntersectClipRect( DC *dc, INT left, INT top, INT right, INT
bottom );
extern BOOL MFDRV_InvertRgn( DC *dc, HRGN hrgn );
extern BOOL MFDRV_LineTo( DC *dc, INT x, INT y );
extern BOOL MFDRV_MoveToEx( DC *dc, INT x, INT y, LPPOINT pt );
extern INT MFDRV_OffsetClipRgn( DC *dc, INT x, INT y );
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 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 BOOL MFDRV_ExtFloodFill( struct tagDC *dc, INT x, INT y,
COLORREF color, UINT fillType );
extern BOOL MFDRV_ExtTextOut( struct tagDC *dc, INT x, INT y,
UINT flags, const RECT *lprect, LPCSTR str,
UINT count, const INT *lpDx );
extern INT MFDRV_SetTextJustification( DC *dc, INT extra, INT breaks );
extern BOOL MFDRV_SetViewportExt( DC *dc, INT x, INT y );
extern BOOL MFDRV_SetViewportOrg( DC *dc, INT x, INT y );
extern BOOL MFDRV_SetWindowExt( DC *dc, INT x, INT y );
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 INT MFDRV_SetDIBitsToDevice( DC *dc, INT xDest, INT yDest, DWORD cx,
DWORD cy, INT xSrc, INT ySrc,

View File

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

View File

@ -6,7 +6,6 @@
#include <stdlib.h>
#include "dc.h"
#include "metafiledrv.h"
#include "region.h"
#include "debug.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 )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
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; /* ?? */
}
INT ret = SIMPLEREGION;
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return ERROR;
TRACE(clipping, "%04x %d,%d\n", hdc, x, y );
if (dc->w.hClipRgn)
{
INT ret = OffsetRgn( dc->w.hClipRgn, XLSTODS(dc,x), YLSTODS(dc,y));
if(dc->funcs->pOffsetClipRgn)
ret = dc->funcs->pOffsetClipRgn( dc, x, y );
else if (dc->w.hClipRgn) {
ret = OffsetRgn( dc->w.hClipRgn, XLSTODS(dc,x), YLSTODS(dc,y));
CLIPPING_UpdateGCRegion( dc );
GDI_HEAP_UNLOCK( hdc );
return ret;
}
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 ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
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 );
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return ERROR;
TRACE(clipping, "%04x %dx%d,%dx%d\n",
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 );
return ret;
}
@ -295,24 +285,22 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top,
INT right, INT bottom )
{
INT ret;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
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 );
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return ERROR;
TRACE(clipping, "%04x %dx%d,%dx%d\n",
hdc, left, top, right, bottom );
ret = CLIPPING_IntersectClipRect( dc, left, top, right, bottom, CLIP_INTERSECT );
hdc, left, top, right, bottom );
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 );
return ret;
}

View File

@ -15,7 +15,6 @@
#include "dc.h"
#include "gdi.h"
#include "heap.h"
#include "metafiledrv.h"
#include "debug.h"
#include "font.h"
#include "winerror.h"
@ -120,7 +119,8 @@ DC *DC_GetDCPtr( HDC hdc )
{
GDIOBJHDR *ptr = (GDIOBJHDR *)GDI_HEAP_LOCK( hdc );
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;
GDI_HEAP_UNLOCK( hdc );
return NULL;
@ -407,15 +407,12 @@ INT WINAPI SaveDC( HDC hdc )
DC * dc, * dcs;
INT ret;
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0;
MFDRV_MetaParam0(dc, META_SAVEDC);
GDI_HEAP_UNLOCK( hdc );
return 1; /* ?? */
}
dc = DC_GetDCPtr( hdc );
if (!dc) return 0;
if(dc->funcs->pSaveDC)
return dc->funcs->pSaveDC( dc );
if (!(hdcs = GetDCState16( hdc )))
{
GDI_HEAP_UNLOCK( hdc );
@ -465,20 +462,11 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level )
BOOL success;
TRACE(dc, "%04x %d\n", hdc, level );
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
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;
}
dc = DC_GetDCPtr( hdc );
if(!dc) return FALSE;
if(dc->funcs->pRestoreDC)
return dc->funcs->pRestoreDC( dc, level );
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;
}
/***********************************************************************
* 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;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
if (!(dc = (DC *)GDI_GetObjPtr( hdc, METAFILE_DC_MAGIC ))) return 0;
MFDRV_MetaParam1( dc, META_SETTEXTALIGN, textAlign );
GDI_HEAP_UNLOCK( hdc );
return 1;
DC *dc = DC_GetDCPtr( hdc );
if (!dc) return 0x0;
if (dc->funcs->pSetTextAlign)
prevAlign = dc->funcs->pSetTextAlign(dc, align);
else {
prevAlign = dc->w.textAlign;
dc->w.textAlign = align;
}
prevAlign = dc->w.textAlign;
dc->w.textAlign = textAlign;
GDI_HEAP_UNLOCK( hdc );
return prevAlign;
}
/***********************************************************************
* GetDCOrgEx (GDI32.168)
*/

View File

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

View File

@ -14,6 +14,7 @@
#include "options.h"
#include "debug.h"
#include "winerror.h"
#include "dc.h"
DECLARE_DEBUG_CHANNEL(font)
DECLARE_DEBUG_CHANNEL(gdi)
@ -659,8 +660,10 @@ INT16 WINAPI SetTextCharacterExtra16( HDC16 hdc, INT16 extra )
INT WINAPI SetTextCharacterExtra( HDC hdc, INT extra )
{
INT prev;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
DC * dc = DC_GetDCPtr( hdc );
if (!dc) return 0;
if (dc->funcs->pSetTextCharacterExtra)
return dc->funcs->pSetTextCharacterExtra( dc, extra );
extra = (extra * dc->vportExtX + dc->wndExtX / 2) / dc->wndExtX;
prev = dc->w.charExtra;
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 )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
DC * dc = DC_GetDCPtr( hdc );
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);
if (!extra) breaks = 0;
@ -1172,8 +1177,15 @@ DWORD WINAPI SetMapperFlags16( HDC16 hDC, DWORD dwFlag )
*/
DWORD WINAPI SetMapperFlags( HDC hDC, DWORD dwFlag )
{
FIXME(font, "(0x%04x, 0x%08lx): stub - harmless\n", hDC, dwFlag);
return 0;
DC *dc = DC_GetDCPtr( hDC );
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:
result = OBJ_METADC;
break;
case ENHMETAFILE_MAGIC:
result = OBJ_ENHMETAFILE;
break;
case ENHMETAFILE_DC_MAGIC:
result = OBJ_ENHMETADC;
break;
default:
FIXME(gdi, "Magic %04x not implemented\n",
ptr->wMagic );

View File

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