2 * ReactOS W32 Subsystem
3 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 /* Don't copy more bytes than the buffer has */
32 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
34 RtlCopyMemory(psurf
->SurfObj
.pvBits
, Bits
, Bytes
);
47 LONG lDeltaDst
, lDeltaSrc
;
48 ULONG nWidth
, nHeight
, cBitsPixel
;
50 nWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
51 nHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
52 cBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
55 pjDst
= psurf
->SurfObj
.pvScan0
;
57 lDeltaDst
= psurf
->SurfObj
.lDelta
;
58 lDeltaSrc
= WIDTH_BYTES_ALIGN16(nWidth
, cBitsPixel
);
63 memcpy(pjDst
, pjSrc
, lDeltaSrc
);
75 IN ULONG cjWidthBytes
,
79 IN OPTIONAL PVOID pvBits
,
85 PVOID pvCompressedBits
;
89 if (iFormat
< BMF_1BPP
|| iFormat
> BMF_PNG
) return NULL
;
91 /* Allocate a surface */
92 psurf
= SURFACE_AllocSurface(STYPE_BITMAP
, nWidth
, nHeight
, iFormat
);
95 DPRINT1("SURFACE_AllocSurface failed.\n");
99 /* Get the handle for the bitmap and the surfobj */
100 hbmp
= (HBITMAP
)psurf
->SurfObj
.hsurf
;
101 pso
= &psurf
->SurfObj
;
103 /* The infamous RLE hack */
104 if (iFormat
== BMF_4RLE
|| iFormat
== BMF_8RLE
)
108 pvCompressedBits
= pvBits
;
109 pvBits
= EngAllocMem(FL_ZERO_MEMORY
, pso
->cjBits
, TAG_DIB
);
112 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
113 SURFACE_FreeSurfaceByHandle(hbmp
);
116 DecompressBitmap(sizl
, pvCompressedBits
, pvBits
, pso
->lDelta
, iFormat
);
117 fjBitmap
|= BMF_RLE_HACK
;
120 /* Mark as API bitmap */
121 psurf
->flags
|= (flags
| API_BITMAP
);
123 /* Set the bitmap bits */
124 if (!SURFACE_bSetBitmapBits(psurf
, fjBitmap
, cjWidthBytes
, pvBits
))
126 /* Bail out if that failed */
127 DPRINT1("SURFACE_bSetBitmapBits failed.\n");
128 EngSetLastError(ERROR_NOT_ENOUGH_MEMORY
);
129 SURFACE_FreeSurfaceByHandle(hbmp
);
133 /* Unlock the surface and return */
134 SURFACE_UnlockSurface(psurf
);
138 /* Creates a DDB surface,
139 * as in CreateCompatibleBitmap or CreateBitmap.
148 IN OPTIONAL PVOID pvBits
)
150 /* Call the extended function */
151 return GreCreateBitmapEx(nWidth
,
154 BitmapFormat(cBitsPixel
* cPlanes
, BI_RGB
),
155 0, /* no bitmap flags */
158 DDB_SURFACE
/* DDB */);
168 IN OPTIONAL LPBYTE pUnsafeBits
)
171 ULONG cRealBpp
, cjWidthBytes
, iFormat
;
174 /* Calculate bitmap format and real bits per pixel. */
175 iFormat
= BitmapFormat(cBitsPixel
* cPlanes
, BI_RGB
);
176 cRealBpp
= gajBitsPerFormat
[iFormat
];
178 /* Calculate width and image size in bytes */
179 cjWidthBytes
= WIDTH_BYTES_ALIGN16(nWidth
, cRealBpp
);
180 cjSize
= cjWidthBytes
* nHeight
;
182 /* Check parameters (possible overflow of cjWidthBytes!) */
183 if (iFormat
== 0 || nWidth
<= 0 || nWidth
>= 0x8000000 || nHeight
<= 0 ||
184 cBitsPixel
> 32 || cPlanes
> 32 || cjSize
>= 0x100000000ULL
)
186 DPRINT1("Invalid bitmap format! Width=%d, Height=%d, Bpp=%d, Planes=%d\n",
187 nWidth
, nHeight
, cBitsPixel
, cPlanes
);
188 EngSetLastError(ERROR_INVALID_PARAMETER
);
192 /* Call internal function. */
193 hbmp
= GreCreateBitmapEx(nWidth
, nHeight
, 0, iFormat
, 0, 0, NULL
, DDB_SURFACE
);
195 if (pUnsafeBits
&& hbmp
)
197 PSURFACE psurf
= SURFACE_LockSurface(hbmp
);
200 ProbeForRead(pUnsafeBits
, cjSize
, 1);
201 UnsafeSetBitmapBits(psurf
, 0, pUnsafeBits
);
203 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
205 SURFACE_UnlockSurface(psurf
);
206 SURFACE_FreeSurfaceByHandle(hbmp
);
207 _SEH2_YIELD(return NULL
;)
211 SURFACE_UnlockSurface(psurf
);
219 IntCreateCompatibleBitmap(
226 /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
227 if (0 == Width
|| 0 == Height
)
229 Bmp
= NtGdiGetStockObject(DEFAULT_BITMAP
);
233 if (Dc
->dctype
!= DC_TYPE_MEMORY
)
237 Bmp
= GreCreateBitmap(abs(Width
),
240 Dc
->ppdev
->gdiinfo
.cBitsPixel
,
242 psurf
= SURFACE_LockSurface(Bmp
);
245 psurf
->ppal
= PALETTE_ShareLockPalette(Dc
->ppdev
->devinfo
.hpalDefault
);
247 psurf
->flags
= API_BITMAP
;
248 psurf
->hdc
= NULL
; // Fixme
249 SURFACE_UnlockSurface(psurf
);
255 PSURFACE psurf
= Dc
->dclevel
.pSurface
;
256 Count
= BITMAP_GetObject(psurf
, sizeof(dibs
), &dibs
);
260 if (Count
== sizeof(BITMAP
))
264 Bmp
= GreCreateBitmap(abs(Width
),
267 dibs
.dsBm
.bmBitsPixel
,
269 psurfBmp
= SURFACE_LockSurface(Bmp
);
272 psurfBmp
->ppal
= psurf
->ppal
;
273 GDIOBJ_IncrementShareCount((POBJ
)psurf
->ppal
);
275 psurfBmp
->flags
= API_BITMAP
;
276 psurfBmp
->hdc
= NULL
; // Fixme
277 SURFACE_UnlockSurface(psurfBmp
);
281 /* A DIB section is selected in the DC */
282 BYTE buf
[sizeof(BITMAPINFOHEADER
) + 256*sizeof(RGBQUAD
)] = {0};
284 BITMAPINFO
* bi
= (BITMAPINFO
*)buf
;
286 bi
->bmiHeader
.biSize
= sizeof(bi
->bmiHeader
);
287 bi
->bmiHeader
.biWidth
= Width
;
288 bi
->bmiHeader
.biHeight
= Height
;
289 bi
->bmiHeader
.biPlanes
= dibs
.dsBmih
.biPlanes
;
290 bi
->bmiHeader
.biBitCount
= dibs
.dsBmih
.biBitCount
;
291 bi
->bmiHeader
.biCompression
= dibs
.dsBmih
.biCompression
;
292 bi
->bmiHeader
.biSizeImage
= 0;
293 bi
->bmiHeader
.biXPelsPerMeter
= dibs
.dsBmih
.biXPelsPerMeter
;
294 bi
->bmiHeader
.biYPelsPerMeter
= dibs
.dsBmih
.biYPelsPerMeter
;
295 bi
->bmiHeader
.biClrUsed
= dibs
.dsBmih
.biClrUsed
;
296 bi
->bmiHeader
.biClrImportant
= dibs
.dsBmih
.biClrImportant
;
298 if (bi
->bmiHeader
.biCompression
== BI_BITFIELDS
)
300 /* Copy the color masks */
301 RtlCopyMemory(bi
->bmiColors
, dibs
.dsBitfields
, 3*sizeof(RGBQUAD
));
303 else if (bi
->bmiHeader
.biBitCount
<= 8)
305 /* Copy the color table */
311 EngSetLastError(ERROR_INVALID_HANDLE
);
315 PalGDI
= PALETTE_LockPalette(psurf
->ppal
->BaseObject
.hHmgr
);
318 Index
< 256 && Index
< PalGDI
->NumColors
;
321 bi
->bmiColors
[Index
].rgbRed
= PalGDI
->IndexedColors
[Index
].peRed
;
322 bi
->bmiColors
[Index
].rgbGreen
= PalGDI
->IndexedColors
[Index
].peGreen
;
323 bi
->bmiColors
[Index
].rgbBlue
= PalGDI
->IndexedColors
[Index
].peBlue
;
324 bi
->bmiColors
[Index
].rgbReserved
= 0;
326 PALETTE_UnlockPalette(PalGDI
);
328 Bmp
= DIB_CreateDIBSection(Dc
,
345 NtGdiCreateCompatibleBitmap(
353 if (Width
<= 0 || Height
<= 0 || (Width
* Height
) > 0x3FFFFFFF)
355 EngSetLastError(ERROR_INVALID_PARAMETER
);
360 return GreCreateBitmap(Width
, Height
, 1, 1, 0);
364 DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n",
365 hDC
, Width
, Height
, Dc
->ppdev
->gdiinfo
.cBitsPixel
);
369 EngSetLastError(ERROR_INVALID_HANDLE
);
373 Bmp
= IntCreateCompatibleBitmap(Dc
, Width
, Height
);
375 DPRINT("\t\t%04x\n", Bmp
);
381 NtGdiGetBitmapDimension(
391 psurfBmp
= SURFACE_LockSurface(hBitmap
);
392 if (psurfBmp
== NULL
)
394 EngSetLastError(ERROR_INVALID_HANDLE
);
400 ProbeForWrite(Dimension
, sizeof(SIZE
), 1);
401 *Dimension
= psurfBmp
->sizlDim
;
403 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
409 SURFACE_UnlockSurface(psurfBmp
);
415 NtGdiGetPixel(HDC hDC
, INT XPos
, INT YPos
)
418 COLORREF Result
= (COLORREF
)CLR_INVALID
; // default to failure
419 BOOL bInRect
= FALSE
;
429 EngSetLastError(ERROR_INVALID_HANDLE
);
433 if (dc
->dctype
== DC_TYPE_INFO
)
439 XPos
+= dc
->ptlDCOrig
.x
;
440 YPos
+= dc
->ptlDCOrig
.y
;
441 if (RECTL_bPointInRect(&dc
->rosdc
.CombinedClip
->rclBounds
, XPos
, YPos
))
444 psurf
= dc
->dclevel
.pSurface
;
447 pso
= &psurf
->SurfObj
;
448 EXLATEOBJ_vInitialize(&exlo
, psurf
->ppal
, &gpalRGB
, 0, 0xffffff, 0);
449 // check if this DC has a DIB behind it...
450 if (pso
->pvScan0
) // STYPE_BITMAP == pso->iType
453 Result
= XLATEOBJ_iXlate(&exlo
.xlo
,
454 DibFunctionsForBitmapFormat
[pso
->iBitmapFormat
].DIB_GetPixel(pso
, XPos
, YPos
));
457 EXLATEOBJ_vCleanup(&exlo
);
462 // if Result is still CLR_INVALID, then the "quick" method above didn't work
463 if (bInRect
&& Result
== CLR_INVALID
)
465 // FIXME: create a 1x1 32BPP DIB, and blit to it
466 HDC hDCTmp
= NtGdiCreateCompatibleDC(hDC
);
469 static const BITMAPINFOHEADER bih
= { sizeof(BITMAPINFOHEADER
), 1, 1, 1, 32, BI_RGB
, 0, 0, 0, 0, 0 };
471 RtlMoveMemory(&(bi
.bmiHeader
), &bih
, sizeof(bih
));
472 hBmpTmp
= NtGdiCreateDIBitmapInternal(hDC
,
473 bi
.bmiHeader
.biWidth
,
474 bi
.bmiHeader
.biHeight
,
479 bi
.bmiHeader
.biBitCount
,
480 bi
.bmiHeader
.biSizeImage
,
484 //HBITMAP hBmpTmp = GreCreateBitmap(1, 1, 1, 32, NULL);
487 HBITMAP hBmpOld
= (HBITMAP
)NtGdiSelectBitmap(hDCTmp
, hBmpTmp
);
492 NtGdiBitBlt(hDCTmp
, 0, 0, 1, 1, hDC
, XPos
, YPos
, SRCCOPY
, 0, 0);
493 NtGdiSelectBitmap(hDCTmp
, hBmpOld
);
495 // our bitmap is no longer selected, so we can access it's stuff...
496 psurf
= SURFACE_LockSurface(hBmpTmp
);
499 // Dont you need to convert something here?
500 Result
= *(COLORREF
*)psurf
->SurfObj
.pvScan0
;
501 SURFACE_UnlockSurface(psurf
);
504 GreDeleteObject(hBmpTmp
);
506 NtGdiDeleteObjectApp(hDCTmp
);
524 /* Don't copy more bytes than the buffer has */
525 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
528 /* FIXME: Call DDI CopyBits here if available */
531 DPRINT("Calling device specific BitmapBits\n");
532 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
534 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hbitmap
,
541 ERR_(bitmap
)("BitmapBits == NULL??\n");
548 RtlCopyMemory(Bits
, psurf
->SurfObj
.pvBits
, Bytes
);
562 LONG lDeltaDst
, lDeltaSrc
;
563 ULONG nWidth
, nHeight
, cBitsPixel
;
565 nWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
566 nHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
567 cBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
570 pjSrc
= psurf
->SurfObj
.pvScan0
;
572 lDeltaSrc
= psurf
->SurfObj
.lDelta
;
573 lDeltaDst
= WIDTH_BYTES_ALIGN16(nWidth
, cBitsPixel
);
578 RtlCopyMemory(pjDst
, pjSrc
, lDeltaDst
);
588 OUT OPTIONAL PBYTE pUnsafeBits
)
593 if (pUnsafeBits
!= NULL
&& Bytes
== 0)
598 psurf
= SURFACE_LockSurface(hBitmap
);
601 EngSetLastError(ERROR_INVALID_HANDLE
);
605 bmSize
= WIDTH_BYTES_ALIGN16(psurf
->SurfObj
.sizlBitmap
.cx
,
606 BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
)) *
607 abs(psurf
->SurfObj
.sizlBitmap
.cy
);
609 /* If the bits vector is null, the function should return the read size */
610 if (pUnsafeBits
== NULL
)
612 SURFACE_UnlockSurface(psurf
);
616 /* Don't copy more bytes than the buffer has */
617 Bytes
= min(Bytes
, bmSize
);
619 // FIXME: use MmSecureVirtualMemory
622 ProbeForWrite(pUnsafeBits
, Bytes
, 1);
623 UnsafeGetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
626 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
632 SURFACE_UnlockSurface(psurf
);
642 IN PBYTE pUnsafeBits
)
647 if (pUnsafeBits
== NULL
|| Bytes
== 0)
652 psurf
= SURFACE_LockSurface(hBitmap
);
655 EngSetLastError(ERROR_INVALID_HANDLE
);
661 ProbeForRead(pUnsafeBits
, Bytes
, 1);
662 UnsafeSetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
665 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
671 SURFACE_UnlockSurface(psurf
);
677 NtGdiSetBitmapDimension(
689 psurf
= SURFACE_LockSurface(hBitmap
);
692 EngSetLastError(ERROR_INVALID_HANDLE
);
700 ProbeForWrite(Size
, sizeof(SIZE
), 1);
701 *Size
= psurf
->sizlDim
;
703 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
710 /* The dimension is changed even if writing the old value failed */
711 psurf
->sizlDim
.cx
= Width
;
712 psurf
->sizlDim
.cy
= Height
;
714 SURFACE_UnlockSurface(psurf
);
719 VOID
IntHandleSpecialColorType(HDC hDC
, COLORREF
* Color
)
723 PALETTEENTRY palEntry
;
726 switch (*Color
>> 24)
728 case 0x10: /* DIBINDEX */
729 if (IntGetDIBColorTable(hDC
, LOWORD(*Color
), 1, &quad
) == 1)
731 *Color
= RGB(quad
.rgbRed
, quad
.rgbGreen
, quad
.rgbBlue
);
735 /* Out of color table bounds - use black */
736 *Color
= RGB(0, 0, 0);
739 case 0x02: /* PALETTERGB */
740 pdc
= DC_LockDc(hDC
);
741 if (pdc
->dclevel
.hpal
!= NtGdiGetStockObject(DEFAULT_PALETTE
))
743 index
= NtGdiGetNearestPaletteIndex(pdc
->dclevel
.hpal
, *Color
);
744 IntGetPaletteEntries(pdc
->dclevel
.hpal
, index
, 1, &palEntry
);
745 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
749 /* Use the pure color */
750 *Color
= *Color
& 0x00FFFFFF;
754 case 0x01: /* PALETTEINDEX */
755 pdc
= DC_LockDc(hDC
);
756 if (IntGetPaletteEntries(pdc
->dclevel
.hpal
, LOWORD(*Color
), 1, &palEntry
) == 1)
758 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
762 /* Index does not exist, use zero index */
763 IntGetPaletteEntries(pdc
->dclevel
.hpal
, 0, 1, &palEntry
);
764 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
769 DPRINT("Unsupported color type %d passed\n", *Color
>> 24);
784 if ((Color
& 0xFF000000) != 0)
786 IntHandleSpecialColorType(hDC
, &Color
);
789 hBrush
= NtGdiCreateSolidBrush(Color
, NULL
);
793 OldBrush
= NtGdiSelectBrush(hDC
, hBrush
);
794 if (OldBrush
== NULL
)
796 GreDeleteObject(hBrush
);
800 NtGdiPatBlt(hDC
, X
, Y
, 1, 1, PATCOPY
);
801 NtGdiSelectBrush(hDC
, OldBrush
);
802 GreDeleteObject(hBrush
);
814 DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
816 if (GdiSetPixelV(hDC
,X
,Y
,Color
))
818 Color
= NtGdiGetPixel(hDC
,X
,Y
);
819 DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
823 Color
= (COLORREF
)CLR_INVALID
;
824 DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
829 /* Internal Functions */
832 BITMAP_CopyBitmap(HBITMAP hBitmap
)
836 SURFACE
*Bitmap
, *resBitmap
;
844 Bitmap
= SURFACE_LockSurface(hBitmap
);
850 BITMAP_GetObject(Bitmap
, sizeof(BITMAP
), (PVOID
)&bm
);
852 if (Bitmap
->SurfObj
.lDelta
>= 0)
853 bm
.bmHeight
= -bm
.bmHeight
;
855 Size
.cx
= abs(bm
.bmWidth
);
856 Size
.cy
= abs(bm
.bmHeight
);
857 res
= GreCreateBitmapEx(Size
.cx
,
860 Bitmap
->SurfObj
.iBitmapFormat
,
861 Bitmap
->SurfObj
.fjBitmap
,
862 Bitmap
->SurfObj
.cjBits
,
869 resBitmap
= SURFACE_LockSurface(res
);
872 IntSetBitmapBits(resBitmap
, Bitmap
->SurfObj
.cjBits
, Bitmap
->SurfObj
.pvBits
);
873 SURFACE_UnlockSurface(resBitmap
);
877 GreDeleteObject(res
);
882 SURFACE_UnlockSurface(Bitmap
);
888 BITMAP_GetObject(SURFACE
*psurf
, INT Count
, LPVOID buffer
)
892 if (!buffer
) return sizeof(BITMAP
);
893 if ((UINT
)Count
< sizeof(BITMAP
)) return 0;
895 /* always fill a basic BITMAP structure */
898 pBitmap
->bmWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
899 pBitmap
->bmHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
900 pBitmap
->bmPlanes
= 1;
901 pBitmap
->bmBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
902 pBitmap
->bmWidthBytes
= WIDTH_BYTES_ALIGN16(pBitmap
->bmWidth
, pBitmap
->bmBitsPixel
);
904 /* Check for DIB section */
907 /* Set bmBits in this case */
908 pBitmap
->bmBits
= psurf
->SurfObj
.pvBits
;
909 /* DIBs data are 32 bits aligned */
910 pBitmap
->bmWidthBytes
= WIDTH_BYTES_ALIGN32(pBitmap
->bmWidth
, pBitmap
->bmBitsPixel
);
912 if (Count
>= sizeof(DIBSECTION
))
914 /* Fill rest of DIBSECTION */
915 PDIBSECTION pds
= buffer
;
917 pds
->dsBmih
.biSize
= sizeof(BITMAPINFOHEADER
);
918 pds
->dsBmih
.biWidth
= pds
->dsBm
.bmWidth
;
919 pds
->dsBmih
.biHeight
= pds
->dsBm
.bmHeight
;
920 pds
->dsBmih
.biPlanes
= pds
->dsBm
.bmPlanes
;
921 pds
->dsBmih
.biBitCount
= pds
->dsBm
.bmBitsPixel
;
922 if(psurf
->ppal
->flFlags
& PAL_BITFIELDS
)
924 pds
->dsBmih
.biCompression
= BI_BITFIELDS
;
928 switch (psurf
->SurfObj
.iBitmapFormat
)
936 pds
->dsBmih
.biCompression
= BI_RGB
;
939 pds
->dsBmih
.biCompression
= BI_RLE4
;
942 pds
->dsBmih
.biCompression
= BI_RLE8
;
945 pds
->dsBmih
.biCompression
= BI_JPEG
;
948 pds
->dsBmih
.biCompression
= BI_PNG
;
952 pds
->dsBmih
.biSizeImage
= psurf
->SurfObj
.cjBits
;
953 pds
->dsBmih
.biXPelsPerMeter
= 0;
954 pds
->dsBmih
.biYPelsPerMeter
= 0;
955 pds
->dsBmih
.biClrUsed
= psurf
->ppal
->NumColors
;
956 pds
->dsBmih
.biClrImportant
= psurf
->biClrImportant
;
957 pds
->dsBitfields
[0] = psurf
->ppal
->RedMask
;
958 pds
->dsBitfields
[1] = psurf
->ppal
->GreenMask
;
959 pds
->dsBitfields
[2] = psurf
->ppal
->BlueMask
;
960 pds
->dshSection
= psurf
->hDIBSection
;
961 pds
->dsOffset
= psurf
->dwOffset
;
963 return sizeof(DIBSECTION
);
968 /* not set according to wine test, confirmed in win2k */
969 pBitmap
->bmBits
= NULL
;
972 return sizeof(BITMAP
);
984 PSURFACE psurf
= SURFACE_LockSurface(hsurf
);
988 SURFACE_UnlockSurface(psurf
);