Fix memory DC so CreateCompatibleDC with null will create it. Based on msdn2 info, we need to setup display surface, etc.

svn path=/trunk/; revision=28375
This commit is contained in:
James Tabor 2007-08-17 00:08:48 +00:00
parent f0415590e9
commit 2a6ac07ef7
3 changed files with 10 additions and 16 deletions

View file

@ -789,15 +789,12 @@ GetObjectType(
case GDI_OBJECT_TYPE_ENHMETAFILE:
Ret = OBJ_ENHMETAFILE;
break;
case GDI_OBJECT_TYPE_ENHMETADC:
Ret = OBJ_ENHMETADC;
break;
case GDI_OBJECT_TYPE_METADC:
Ret = OBJ_METADC;
break;
case GDI_OBJECT_TYPE_EXTPEN:
Ret = OBJ_EXTPEN;
break;
case GDI_OBJECT_TYPE_MEMDC:
Ret = OBJ_MEMDC;
break;
default:
DPRINT1("GetObjectType: Magic 0x%08x not implemented\n", Type);

View file

@ -166,7 +166,8 @@ NtGdiCreateCompatibleDC(HDC hDC)
HDC hNewDC, DisplayDC;
HRGN hVisRgn;
UNICODE_STRING DriverName;
INT DC_Type = DC_TYPE_DIRECT;
DisplayDC = NULL;
if (hDC == NULL)
{
@ -177,6 +178,7 @@ NtGdiCreateCompatibleDC(HDC hDC)
return NULL;
}
hDC = DisplayDC;
DC_Type = DC_TYPE_MEMORY; // Null hDC == Memory DC.
}
/* Allocate a new DC based on the original DC's device */
@ -205,7 +207,8 @@ NtGdiCreateCompatibleDC(HDC hDC)
/* Copy information from original DC to new DC */
NewDC->hSelf = hNewDC;
NewDC->IsIC = FALSE;
NewDC->DC_Type = DC_Type;
NewDC->PDev = OrigDC->PDev;
memcpy(NewDC->FillPatternSurfaces,
OrigDC->FillPatternSurfaces,
@ -891,6 +894,7 @@ IntGdiCreateDC(PUNICODE_STRING Driver,
return NULL;
}
NewDC->DC_Type = DC_TYPE_DIRECT;
NewDC->IsIC = CreateAsIC;
NewDC->DevInfo = &PrimarySurface.DevInfo;
NewDC->GDIInfo = &PrimarySurface.GDIInfo;
@ -2174,12 +2178,7 @@ NtGdiGetDCDword(
case GdiGetFontLanguageInfo:
break;
case GdiGetIsMemDc:
{
if (dc->w.flags & DC_MEMORY)
SafeResult = DC_TYPE_MEMORY; // = dc->DC_Type;
else
SafeResult = DC_TYPE_DIRECT;
}
SafeResult = dc->DC_Type;
break;
case GdiGetMapMode:
SafeResult = dc->Dc_Attr.iMapMode;

View file

@ -84,8 +84,6 @@ GDI_OBJ_INFO ObjInfo[] =
{GDI_OBJECT_TYPE_METADC, sizeof(DC), GDI_CleanupDummy},
{GDI_OBJECT_TYPE_METAFILE, sizeof(DC), GDI_CleanupDummy},
{GDI_OBJECT_TYPE_ENHMETAFILE, 0, GDI_CleanupDummy},
{GDI_OBJECT_TYPE_ENHMETADC, 0, GDI_CleanupDummy},
{GDI_OBJECT_TYPE_MEMDC, 0, GDI_CleanupDummy},
{GDI_OBJECT_TYPE_EMF, 0, GDI_CleanupDummy}
};