typedef VOID (*PFN_Synchronize)(DHPDEV, PRECTL);
+typedef VOID (*PFN_MovePointer)(PSURFOBJ, LONG, LONG, PRECTL);
+
+typedef HBITMAP (*PFN_CreateDeviceBitmap)(DHPDEV, SIZEL, ULONG);
+
typedef struct _SURFGDI {
BYTE BytesPerPixel;
PFN_CopyBits CopyBits;
PFN_Synchronize Synchronize;
BOOL SynchronizeAccess;
+ PFN_CreateDeviceBitmap CreateDeviceBitmap;
} SURFGDI, *PSURFGDI;
typedef struct _XFORMGDI {
{
SurfGDI->BitBlt = NULL;
SurfGDI->CopyBits = NULL;
+ SurfGDI->CreateDeviceBitmap = NULL;
}
HBITMAP EngCreateDeviceBitmap(DHSURF dhsurf, SIZEL Size, ULONG Format)
{
HBITMAP NewBitmap;
SURFOBJ *SurfObj;
- SURFGDI *SurfGDI;
-
- SurfObj = EngAllocMem(FL_ZERO_MEMORY, sizeof(SURFOBJ), NULL);
- SurfGDI = EngAllocMem(FL_ZERO_MEMORY, sizeof(SURFGDI), NULL);
-
- NewBitmap = CreateGDIHandle(SurfGDI, SurfObj);
- InitializeHooks(SurfGDI);
-
- SurfGDI->BytesPerPixel = bytesPerPixel(Format);
-
- SurfObj->dhsurf = dhsurf;
- SurfObj->hsurf = dhsurf; // FIXME: Is this correct??
- SurfObj->sizlBitmap = Size;
- SurfObj->iBitmapFormat = Format;
- SurfObj->lDelta = SurfGDI->BytesPerPixel * Size.cx;
- SurfObj->iType = STYPE_DEVBITMAP;
+ NewBitmap = EngCreateBitmap(Size, bytesPerPixel(Format) * Size.cx, Format, 0, NULL);
+ SurfObj = AccessUserObject(NewBitmap);
+ SurfObj->dhpdev = dhsurf;
return NewBitmap;
+
+ return 0;
}
HBITMAP EngCreateBitmap(IN SIZEL Size,
IN ULONG Flags,
IN PVOID Bits)
{
-
-/* SHOULD CALL THIS */
-/* HBITMAP STDCALL W32kCreateBitmap(INT Width,
- INT Height,
- UINT Planes,
- UINT BitsPerPel,
- CONST VOID *Bits) */
-
HBITMAP NewBitmap;
SURFOBJ *SurfObj;
SURFGDI *SurfGDI;
InitializeHooks(SurfGDI);
SurfGDI->BytesPerPixel = bytesPerPixel(Format);
- SurfObj->cjBits = Width * Size.cy;
+ SurfObj->lDelta = ((bytesPerPixel(Format) * Width) + 31) & ~31; // round up 4 bytes
+ SurfObj->cjBits = SurfObj->lDelta * Size.cy;
if(Bits!=NULL)
{
}
}
- SurfObj->dhsurf = 0;
+ SurfObj->dhsurf = 0; // device managed surface
SurfObj->hsurf = 0;
SurfObj->sizlBitmap = Size;
SurfObj->iBitmapFormat = Format;
- SurfObj->lDelta = Width;
SurfObj->iType = STYPE_BITMAP;
// Use flags to determine bitmap type -- TOP_DOWN or whatever
SURFOBJ *SurfObj;
SURFGDI *SurfGDI;
- // DrvCreateDeviceSurface???
-
SurfObj = EngAllocMem(FL_ZERO_MEMORY, sizeof(SURFOBJ), NULL);
SurfGDI = EngAllocMem(FL_ZERO_MEMORY, sizeof(SURFGDI), NULL);
// it looks like this Dev is actually a pointer to the DC!
PDC Dc = (PDC)Dev;
-
+DbgPrint("Associate 1\n");
// DRVENABLEDATA *DED;
SurfGDI = AccessInternalObject(Surface);
if(Hooks & HOOK_SYNCHRONIZE) SurfGDI->Synchronize = Dc->DriverFunctions.Synchronize;
if(Hooks & HOOK_SYNCHRONIZEACCESS) SurfGDI->SynchronizeAccess = TRUE;
+ SurfGDI->CreateDeviceBitmap = Dc->DriverFunctions.CreateDeviceBitmap;
+
return TRUE;
}