c3582a130b739ef9ada0591a2bc729cd2b090852
[reactos.git] / subsys / win32k / objects / objconv.c
1 #undef WIN32_LEAN_AND_MEAN
2 #include <windows.h>
3 #include <ddk/ntddk.h>
4
5 /* FIXME: Surely we should just have one include file that includes all of these.. */
6 #include <win32k/bitmaps.h>
7 #include <win32k/coord.h>
8 #include <win32k/driver.h>
9 #include <win32k/dc.h>
10 #include <win32k/print.h>
11 #include <win32k/region.h>
12 #include <win32k/gdiobj.h>
13 #include <win32k/pen.h>
14 #include "../eng/objects.h"
15
16 //#define NDEBUG
17 #include <win32k/debug1.h>
18
19
20 PBRUSHOBJ PenToBrushObj(PDC dc, PENOBJ *pen)
21 {
22   BRUSHOBJ *BrushObj;
23   XLATEOBJ *RGBtoVGA16;
24
25   ASSERT( pen );
26
27   BrushObj = ExAllocatePool(NonPagedPool, sizeof(BRUSHOBJ));
28   BrushObj->iSolidColor = pen->logpen.lopnColor;
29
30   return BrushObj;
31 }
32
33 VOID BitmapToSurf(HDC hdc, PSURFGDI SurfGDI, PSURFOBJ SurfObj, PBITMAPOBJ Bitmap)
34 {
35   ASSERT( SurfGDI );
36   if( Bitmap ){
37         if(Bitmap->dib)
38         {
39           SurfGDI->BitsPerPixel = Bitmap->dib->dsBm.bmBitsPixel;
40           SurfObj->lDelta       = Bitmap->dib->dsBm.bmWidthBytes;
41           SurfObj->pvBits       = Bitmap->dib->dsBm.bmBits;
42           SurfObj->cjBits       = Bitmap->dib->dsBm.bmHeight * Bitmap->dib->dsBm.bmWidthBytes;
43         } else {
44           SurfGDI->BitsPerPixel = Bitmap->bitmap.bmBitsPixel;
45           SurfObj->lDelta         = Bitmap->bitmap.bmWidthBytes;
46           SurfObj->pvBits         = Bitmap->bitmap.bmBits;
47           SurfObj->cjBits       = Bitmap->bitmap.bmHeight * Bitmap->bitmap.bmWidthBytes;
48         }
49         SurfObj->sizlBitmap     = Bitmap->size; // FIXME: alloc memory for our own struct?
50   }
51
52   SurfObj->dhsurf       = NULL;
53   SurfObj->hsurf        = NULL;
54   SurfObj->dhpdev       = NULL;
55   SurfObj->hdev         = NULL;
56   SurfObj->pvScan0      = SurfObj->pvBits; // start of bitmap
57   SurfObj->iUniq         = 0; // not sure..
58   SurfObj->iBitmapFormat = BitmapFormat(SurfGDI->BitsPerPixel, BI_RGB);
59   SurfObj->iType         = STYPE_BITMAP;
60   SurfObj->fjBitmap      = BMF_TOPDOWN;
61 }