Fix for CreateCompatibleDC

svn path=/trunk/; revision=2380
This commit is contained in:
Jason Filby 2001-11-19 12:06:23 +00:00
parent 303f10c6fd
commit 0e27bfa7dd

View file

@ -1,4 +1,4 @@
/* $Id: dc.c,v 1.28 2001/11/02 06:10:11 rex Exp $ /* $Id: dc.c,v 1.29 2001/11/19 12:06:23 jfilby Exp $
* *
* DC.C - Device context functions * DC.C - Device context functions
* *
@ -92,19 +92,19 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
{ {
PDC NewDC, OrigDC = NULL; PDC NewDC, OrigDC = NULL;
HBITMAP hBitmap; HBITMAP hBitmap;
SIZEL onebyone;
OrigDC = DC_HandleToPtr(hDC); OrigDC = DC_HandleToPtr(hDC);
if (OrigDC == NULL) if (OrigDC == NULL)
{ {
return 0; NewDC = DC_AllocDC(L"DISPLAY");
} else {
/* Allocate a new DC based on the original DC's device */
NewDC = DC_AllocDC(OrigDC->DriverName);
} }
/* Allocate a new DC based on the original DC's device */
NewDC = DC_AllocDC(OrigDC->DriverName);
if (NewDC == NULL) if (NewDC == NULL)
{ {
// DRIVER_ReferenceDriver (NewDC->DriverName);
return NULL; return NULL;
} }
@ -112,28 +112,36 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
NewDC->hSelf = NewDC; NewDC->hSelf = NewDC;
/* FIXME: Should this DC request its own PDEV? */ /* FIXME: Should this DC request its own PDEV? */
NewDC->PDev = OrigDC->PDev; if(OrigDC == NULL) {
NewDC->DMW = OrigDC->DMW; } else {
memcpy(NewDC->FillPatternSurfaces, NewDC->PDev = OrigDC->PDev;
OrigDC->FillPatternSurfaces, NewDC->DMW = OrigDC->DMW;
sizeof OrigDC->FillPatternSurfaces); memcpy(NewDC->FillPatternSurfaces,
NewDC->GDIInfo = OrigDC->GDIInfo; OrigDC->FillPatternSurfaces,
NewDC->DevInfo = OrigDC->DevInfo; sizeof OrigDC->FillPatternSurfaces);
NewDC->GDIInfo = OrigDC->GDIInfo;
NewDC->DevInfo = OrigDC->DevInfo;
}
/* FIXME: Should this DC request its own surface? */ // Create a 1x1 monochrome bitmap surface
/* Yes, in fact, a 1x1 monochrome surface (to be implemented..) */ onebyone.cx = 1;
NewDC->Surface = OrigDC->Surface; onebyone.cy = 1;
NewDC->Surface = EngCreateBitmap(onebyone, 1, BMF_1BPP, 0, NULL);
/* DriverName is copied in the AllocDC routine */ /* DriverName is copied in the AllocDC routine */
NewDC->DeviceDriver = OrigDC->DeviceDriver; if(OrigDC == NULL) {
NewDC->wndOrgX = OrigDC->wndOrgX; NewDC->DeviceDriver = DRIVER_FindMPDriver(NewDC->DriverName);
NewDC->wndOrgY = OrigDC->wndOrgY; } else {
NewDC->wndExtX = OrigDC->wndExtX; NewDC->DeviceDriver = OrigDC->DeviceDriver;
NewDC->wndExtY = OrigDC->wndExtY; NewDC->wndOrgX = OrigDC->wndOrgX;
NewDC->vportOrgX = OrigDC->vportOrgX; NewDC->wndOrgY = OrigDC->wndOrgY;
NewDC->vportOrgY = OrigDC->vportOrgY; NewDC->wndExtX = OrigDC->wndExtX;
NewDC->vportExtX = OrigDC->vportExtX; NewDC->wndExtY = OrigDC->wndExtY;
NewDC->vportExtY = OrigDC->vportExtY; NewDC->vportOrgX = OrigDC->vportOrgX;
NewDC->vportOrgY = OrigDC->vportOrgY;
NewDC->vportExtX = OrigDC->vportExtX;
NewDC->vportExtY = OrigDC->vportExtY;
}
DC_InitDC(NewDC); DC_InitDC(NewDC);
@ -148,9 +156,13 @@ HDC STDCALL W32kCreateCompatableDC(HDC hDC)
NewDC->w.bitsPerPixel = 1; NewDC->w.bitsPerPixel = 1;
NewDC->w.hBitmap = hBitmap; NewDC->w.hBitmap = hBitmap;
NewDC->w.hFirstBitmap = hBitmap; NewDC->w.hFirstBitmap = hBitmap;
NewDC->w.hPalette = OrigDC->w.hPalette;
NewDC->w.textColor = OrigDC->w.textColor; if(OrigDC != NULL)
NewDC->w.textAlign = OrigDC->w.textAlign; {
NewDC->w.hPalette = OrigDC->w.hPalette;
NewDC->w.textColor = OrigDC->w.textColor;
NewDC->w.textAlign = OrigDC->w.textAlign;
}
return DC_PtrToHandle(NewDC); return DC_PtrToHandle(NewDC);
} }