Implemented a few device caps.

This commit is contained in:
Huw D M Davies 2002-08-17 00:25:05 +00:00 committed by Alexandre Julliard
parent bd0a567a2d
commit 7318acaaca
3 changed files with 46 additions and 5 deletions

View File

@ -278,3 +278,31 @@ BOOL EMFDRV_WidenPath( PHYSDEV dev )
return EMFDRV_WriteRecord( dev, &emr.emr );
}
INT EMFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
{
EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE*) dev;
switch(cap) {
case HORZRES:
return physDev->horzres;
case VERTRES:
return physDev->vertres;
case LOGPIXELSX:
return physDev->logpixelsx;
case LOGPIXELSY:
return physDev->logpixelsy;
case HORZSIZE:
return physDev->horzsize;
case VERTSIZE:
return physDev->vertsize;
case BITSPIXEL:
return physDev->bitspixel;
default:
FIXME("Unimplemented cap %d\n", cap);
return 0;
}
}

View File

@ -34,6 +34,10 @@ typedef struct
ENHMETAHEADER *emh; /* Pointer to enhanced metafile header */
UINT nextHandle; /* Next handle number */
HANDLE hFile; /* Handle for disk based MetaFile */
INT horzres, vertres;
INT horzsize, vertsize;
INT logpixelsx, logpixelsy;
INT bitspixel;
} EMFDRV_PDEVICE;
@ -69,6 +73,7 @@ extern BOOL EMFDRV_FillRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush );
extern BOOL EMFDRV_FlattenPath( PHYSDEV dev );
extern BOOL EMFDRV_FrameRgn( PHYSDEV dev, HRGN hrgn, HBRUSH hbrush, INT width,
INT height );
extern INT EMFDRV_GetDeviceCaps( PHYSDEV dev, INT cap );
extern INT EMFDRV_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right,
INT bottom );
extern BOOL EMFDRV_InvertRgn( PHYSDEV dev, HRGN hrgn );

View File

@ -67,7 +67,7 @@ static const DC_FUNCTIONS EMFDRV_Funcs =
NULL, /* pGetDCOrgEx */
NULL, /* pGetDIBColorTable */
NULL, /* pGetDIBits */
NULL, /* pGetDeviceCaps */
EMFDRV_GetDeviceCaps, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetNearestColor */
NULL, /* pGetPixel */
@ -311,6 +311,14 @@ HDC WINAPI CreateEnhMetaFileW(
physDev->nextHandle = 1;
physDev->hFile = 0;
physDev->horzres = GetDeviceCaps(hRefDC, HORZRES);
physDev->vertres = GetDeviceCaps(hRefDC, VERTRES);
physDev->logpixelsx = GetDeviceCaps(hRefDC, LOGPIXELSX);
physDev->logpixelsy = GetDeviceCaps(hRefDC, LOGPIXELSY);
physDev->horzsize = GetDeviceCaps(hRefDC, HORZSIZE);
physDev->vertsize = GetDeviceCaps(hRefDC, VERTSIZE);
physDev->bitspixel = GetDeviceCaps(hRefDC, BITSPIXEL);
physDev->emh->iType = EMR_HEADER;
physDev->emh->nSize = size;
@ -341,12 +349,12 @@ HDC WINAPI CreateEnhMetaFileW(
physDev->emh->nPalEntries = 0; /* I guess this should start at 0 */
/* Size in pixels */
physDev->emh->szlDevice.cx = GetDeviceCaps( hRefDC, HORZRES );
physDev->emh->szlDevice.cy = GetDeviceCaps( hRefDC, VERTRES );
physDev->emh->szlDevice.cx = physDev->horzres;
physDev->emh->szlDevice.cy = physDev->vertres;
/* Size in millimeters */
physDev->emh->szlMillimeters.cx = GetDeviceCaps( hRefDC, HORZSIZE );
physDev->emh->szlMillimeters.cy = GetDeviceCaps( hRefDC, VERTSIZE );
physDev->emh->szlMillimeters.cx = physDev->horzsize;
physDev->emh->szlMillimeters.cy = physDev->vertsize;
memcpy((char *)physDev->emh + sizeof(ENHMETAHEADER), description, length);