gdi32: Don't allow CreateCompatibleDC on a metafile DC.
This commit is contained in:
parent
cef1832bfb
commit
c331a1a6cd
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(metafile);
|
WINE_DEFAULT_DEBUG_CHANNEL(metafile);
|
||||||
|
|
||||||
|
static BOOL MFDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev );
|
||||||
static BOOL MFDRV_DeleteDC( PHYSDEV dev );
|
static BOOL MFDRV_DeleteDC( PHYSDEV dev );
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +92,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
|
|||||||
MFDRV_Chord, /* pChord */
|
MFDRV_Chord, /* pChord */
|
||||||
MFDRV_CloseFigure, /* pCloseFigure */
|
MFDRV_CloseFigure, /* pCloseFigure */
|
||||||
NULL, /* pCreateBitmap */
|
NULL, /* pCreateBitmap */
|
||||||
NULL, /* pCreateCompatibleDC */
|
MFDRV_CreateCompatibleDC, /* pCreateCompatibleDC */
|
||||||
NULL, /* pCreateDC */
|
NULL, /* pCreateDC */
|
||||||
NULL, /* pCreateDIBSection */
|
NULL, /* pCreateDIBSection */
|
||||||
NULL, /* pDeleteBitmap */
|
NULL, /* pDeleteBitmap */
|
||||||
@ -246,6 +247,16 @@ static DC *MFDRV_AllocMetaFile(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* MFDRV_CreateCompatibleDC
|
||||||
|
*/
|
||||||
|
static BOOL MFDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
|
||||||
|
{
|
||||||
|
/* not supported on metafile DCs */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* MFDRV_DeleteDC
|
* MFDRV_DeleteDC
|
||||||
*/
|
*/
|
||||||
|
@ -265,20 +265,50 @@ static void test_GdiConvertToDevmodeW(void)
|
|||||||
static void test_CreateCompatibleDC(void)
|
static void test_CreateCompatibleDC(void)
|
||||||
{
|
{
|
||||||
BOOL bRet;
|
BOOL bRet;
|
||||||
HDC hDC;
|
HDC hdc, hNewDC, hdcMetafile;
|
||||||
HDC hNewDC;
|
HBITMAP bitmap;
|
||||||
|
INT caps;
|
||||||
|
|
||||||
|
bitmap = CreateBitmap( 10, 10, 1, 1, NULL );
|
||||||
|
|
||||||
/* Create a DC compatible with the screen */
|
/* Create a DC compatible with the screen */
|
||||||
hDC = CreateCompatibleDC(NULL);
|
hdc = CreateCompatibleDC(NULL);
|
||||||
ok(hDC != NULL, "CreateCompatibleDC returned %p\n", hDC);
|
ok(hdc != NULL, "CreateCompatibleDC returned %p\n", hdc);
|
||||||
|
ok( SelectObject( hdc, bitmap ) != 0, "SelectObject failed\n" );
|
||||||
|
caps = GetDeviceCaps( hdc, TECHNOLOGY );
|
||||||
|
ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
|
||||||
|
|
||||||
/* Delete this DC, this should succeed */
|
/* Delete this DC, this should succeed */
|
||||||
bRet = DeleteDC(hDC);
|
bRet = DeleteDC(hdc);
|
||||||
ok(bRet == TRUE, "DeleteDC returned %u\n", bRet);
|
ok(bRet == TRUE, "DeleteDC returned %u\n", bRet);
|
||||||
|
|
||||||
/* Try to create a DC compatible to the deleted DC. This has to fail */
|
/* Try to create a DC compatible to the deleted DC. This has to fail */
|
||||||
hNewDC = CreateCompatibleDC(hDC);
|
hNewDC = CreateCompatibleDC(hdc);
|
||||||
ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC);
|
ok(hNewDC == NULL, "CreateCompatibleDC returned %p\n", hNewDC);
|
||||||
|
|
||||||
|
hdc = GetDC( 0 );
|
||||||
|
hdcMetafile = CreateEnhMetaFileA(hdc, NULL, NULL, NULL);
|
||||||
|
ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
|
||||||
|
hNewDC = CreateCompatibleDC( hdcMetafile );
|
||||||
|
ok(hNewDC != NULL, "CreateCompatibleDC failed\n");
|
||||||
|
ok( SelectObject( hNewDC, bitmap ) != 0, "SelectObject failed\n" );
|
||||||
|
caps = GetDeviceCaps( hdcMetafile, TECHNOLOGY );
|
||||||
|
ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
|
||||||
|
caps = GetDeviceCaps( hNewDC, TECHNOLOGY );
|
||||||
|
ok( caps == DT_RASDISPLAY, "wrong caps %u\n", caps );
|
||||||
|
DeleteDC( hNewDC );
|
||||||
|
DeleteEnhMetaFile( CloseEnhMetaFile( hdcMetafile ));
|
||||||
|
ReleaseDC( 0, hdc );
|
||||||
|
|
||||||
|
hdcMetafile = CreateMetaFileA(NULL);
|
||||||
|
ok(hdcMetafile != 0, "CreateEnhMetaFileA failed\n");
|
||||||
|
hNewDC = CreateCompatibleDC( hdcMetafile );
|
||||||
|
ok(hNewDC == NULL, "CreateCompatibleDC succeeded\n");
|
||||||
|
caps = GetDeviceCaps( hdcMetafile, TECHNOLOGY );
|
||||||
|
ok( caps == DT_METAFILE, "wrong caps %u\n", caps );
|
||||||
|
DeleteMetaFile( CloseMetaFile( hdcMetafile ));
|
||||||
|
|
||||||
|
DeleteObject( bitmap );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_DC_bitmap(void)
|
static void test_DC_bitmap(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user