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
);
110 DecompressBitmap(sizl
, pvCompressedBits
, pvBits
, pso
->lDelta
, iFormat
);
111 fjBitmap
|= BMF_RLE_HACK
;
114 /* Mark as API bitmap */
115 psurf
->flags
|= (flags
| API_BITMAP
);
117 /* Set the bitmap bits */
118 if (!SURFACE_bSetBitmapBits(psurf
, fjBitmap
, cjWidthBytes
, pvBits
))
120 /* Bail out if that failed */
121 DPRINT1("SURFACE_bSetBitmapBits failed.\n");
122 SURFACE_FreeSurfaceByHandle(hbmp
);
126 /* Unlock the surface and return */
127 SURFACE_UnlockSurface(psurf
);
131 /* Creates a DDB surface,
132 * as in CreateCompatibleBitmap or CreateBitmap.
141 IN OPTIONAL PVOID pvBits
)
143 /* Call the extended function */
144 return GreCreateBitmapEx(nWidth
,
147 BitmapFormat(cBitsPixel
* cPlanes
, BI_RGB
),
148 0, /* no bitmap flags */
151 DDB_SURFACE
/* DDB */);
161 IN OPTIONAL LPBYTE pUnsafeBits
)
164 ULONG cjWidthBytes
, iFormat
;
166 /* NOTE: Windows also doesn't store nr. of planes separately! */
167 cBitsPixel
= BITMAP_GetRealBitsPixel(cBitsPixel
* cPlanes
);
169 /* Calculate bitmap format */
170 iFormat
= BitmapFormat(cBitsPixel
, BI_RGB
);
172 /* Check parameters */
173 if (iFormat
== 0 || nWidth
<= 0 || nWidth
>= 0x8000000 || nHeight
<= 0)
175 DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
176 nWidth
, nHeight
, cBitsPixel
);
177 EngSetLastError(ERROR_INVALID_PARAMETER
);
181 /* Make sure that cjBits will not overflow */
182 cjWidthBytes
= WIDTH_BYTES_ALIGN16(nWidth
, cBitsPixel
);
183 if ((ULONGLONG
)cjWidthBytes
* nHeight
>= 0x100000000ULL
)
185 DPRINT1("Width = %d, Height = %d BitsPixel = %d\n",
186 nWidth
, nHeight
, cBitsPixel
);
187 EngSetLastError(ERROR_INVALID_PARAMETER
);
191 /* cBitsPixel = cBitsPixel * cPlanes now! */
192 hbmp
= GreCreateBitmap(nWidth
, nHeight
, 1, cBitsPixel
, NULL
);
196 PSURFACE psurf
= SURFACE_LockSurface(hbmp
);
199 ProbeForRead(pUnsafeBits
, cjWidthBytes
* nHeight
, 1);
200 UnsafeSetBitmapBits(psurf
, 0, pUnsafeBits
);
202 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
204 SURFACE_UnlockSurface(psurf
);
205 SURFACE_FreeSurfaceByHandle(hbmp
);
206 _SEH2_YIELD(return NULL
;)
210 SURFACE_UnlockSurface(psurf
);
218 IntCreateCompatibleBitmap(
225 /* MS doc says if width or height is 0, return 1-by-1 pixel, monochrome bitmap */
226 if (0 == Width
|| 0 == Height
)
228 Bmp
= NtGdiGetStockObject(DEFAULT_BITMAP
);
232 if (Dc
->dctype
!= DC_TYPE_MEMORY
)
236 Bmp
= GreCreateBitmap(abs(Width
),
239 Dc
->ppdev
->gdiinfo
.cBitsPixel
,
241 psurf
= SURFACE_LockSurface(Bmp
);
244 psurf
->ppal
= PALETTE_ShareLockPalette(Dc
->ppdev
->devinfo
.hpalDefault
);
246 psurf
->flags
= API_BITMAP
;
247 psurf
->hdc
= NULL
; // Fixme
248 SURFACE_UnlockSurface(psurf
);
254 PSURFACE psurf
= Dc
->dclevel
.pSurface
;
255 Count
= BITMAP_GetObject(psurf
, sizeof(dibs
), &dibs
);
259 if (Count
== sizeof(BITMAP
))
263 Bmp
= GreCreateBitmap(abs(Width
),
266 dibs
.dsBm
.bmBitsPixel
,
268 psurfBmp
= SURFACE_LockSurface(Bmp
);
271 psurfBmp
->ppal
= psurf
->ppal
;
272 GDIOBJ_IncrementShareCount((POBJ
)psurf
->ppal
);
274 psurfBmp
->flags
= API_BITMAP
;
275 psurfBmp
->hdc
= NULL
; // Fixme
276 SURFACE_UnlockSurface(psurfBmp
);
280 /* A DIB section is selected in the DC */
281 BYTE buf
[sizeof(BITMAPINFOHEADER
) + 256*sizeof(RGBQUAD
)] = {0};
283 BITMAPINFO
* bi
= (BITMAPINFO
*)buf
;
285 bi
->bmiHeader
.biSize
= sizeof(bi
->bmiHeader
);
286 bi
->bmiHeader
.biWidth
= Width
;
287 bi
->bmiHeader
.biHeight
= Height
;
288 bi
->bmiHeader
.biPlanes
= dibs
.dsBmih
.biPlanes
;
289 bi
->bmiHeader
.biBitCount
= dibs
.dsBmih
.biBitCount
;
290 bi
->bmiHeader
.biCompression
= dibs
.dsBmih
.biCompression
;
291 bi
->bmiHeader
.biSizeImage
= 0;
292 bi
->bmiHeader
.biXPelsPerMeter
= dibs
.dsBmih
.biXPelsPerMeter
;
293 bi
->bmiHeader
.biYPelsPerMeter
= dibs
.dsBmih
.biYPelsPerMeter
;
294 bi
->bmiHeader
.biClrUsed
= dibs
.dsBmih
.biClrUsed
;
295 bi
->bmiHeader
.biClrImportant
= dibs
.dsBmih
.biClrImportant
;
297 if (bi
->bmiHeader
.biCompression
== BI_BITFIELDS
)
299 /* Copy the color masks */
300 RtlCopyMemory(bi
->bmiColors
, dibs
.dsBitfields
, 3*sizeof(RGBQUAD
));
302 else if (bi
->bmiHeader
.biBitCount
<= 8)
304 /* Copy the color table */
310 SetLastWin32Error(ERROR_INVALID_HANDLE
);
314 PalGDI
= PALETTE_LockPalette(psurf
->ppal
->BaseObject
.hHmgr
);
317 Index
< 256 && Index
< PalGDI
->NumColors
;
320 bi
->bmiColors
[Index
].rgbRed
= PalGDI
->IndexedColors
[Index
].peRed
;
321 bi
->bmiColors
[Index
].rgbGreen
= PalGDI
->IndexedColors
[Index
].peGreen
;
322 bi
->bmiColors
[Index
].rgbBlue
= PalGDI
->IndexedColors
[Index
].peBlue
;
323 bi
->bmiColors
[Index
].rgbReserved
= 0;
325 PALETTE_UnlockPalette(PalGDI
);
327 Bmp
= DIB_CreateDIBSection(Dc
,
344 NtGdiCreateCompatibleBitmap(
352 if (Width
<= 0 || Height
<= 0 || (Width
* Height
) > 0x3FFFFFFF)
354 SetLastWin32Error(ERROR_INVALID_PARAMETER
);
359 return GreCreateBitmap(Width
, Height
, 1, 1, 0);
363 DPRINT("NtGdiCreateCompatibleBitmap(%04x,%d,%d, bpp:%d) = \n",
364 hDC
, Width
, Height
, Dc
->ppdev
->gdiinfo
.cBitsPixel
);
368 SetLastWin32Error(ERROR_INVALID_HANDLE
);
372 Bmp
= IntCreateCompatibleBitmap(Dc
, Width
, Height
);
374 DPRINT("\t\t%04x\n", Bmp
);
380 NtGdiGetBitmapDimension(
390 psurfBmp
= SURFACE_LockSurface(hBitmap
);
391 if (psurfBmp
== NULL
)
393 SetLastWin32Error(ERROR_INVALID_HANDLE
);
399 ProbeForWrite(Dimension
, sizeof(SIZE
), 1);
400 *Dimension
= psurfBmp
->sizlDim
;
402 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
408 SURFACE_UnlockSurface(psurfBmp
);
414 NtGdiGetPixel(HDC hDC
, INT XPos
, INT YPos
)
417 COLORREF Result
= (COLORREF
)CLR_INVALID
; // default to failure
418 BOOL bInRect
= FALSE
;
428 SetLastWin32Error(ERROR_INVALID_HANDLE
);
432 if (dc
->dctype
== DC_TYPE_INFO
)
438 XPos
+= dc
->ptlDCOrig
.x
;
439 YPos
+= dc
->ptlDCOrig
.y
;
440 if (RECTL_bPointInRect(&dc
->rosdc
.CombinedClip
->rclBounds
, XPos
, YPos
))
443 psurf
= dc
->dclevel
.pSurface
;
446 pso
= &psurf
->SurfObj
;
447 EXLATEOBJ_vInitialize(&exlo
, psurf
->ppal
, &gpalRGB
, 0, 0xffffff, 0);
448 // check if this DC has a DIB behind it...
449 if (pso
->pvScan0
) // STYPE_BITMAP == pso->iType
452 Result
= XLATEOBJ_iXlate(&exlo
.xlo
,
453 DibFunctionsForBitmapFormat
[pso
->iBitmapFormat
].DIB_GetPixel(pso
, XPos
, YPos
));
456 EXLATEOBJ_vCleanup(&exlo
);
461 // if Result is still CLR_INVALID, then the "quick" method above didn't work
462 if (bInRect
&& Result
== CLR_INVALID
)
464 // FIXME: create a 1x1 32BPP DIB, and blit to it
465 HDC hDCTmp
= NtGdiCreateCompatibleDC(hDC
);
468 static const BITMAPINFOHEADER bih
= { sizeof(BITMAPINFOHEADER
), 1, 1, 1, 32, BI_RGB
, 0, 0, 0, 0, 0 };
470 RtlMoveMemory(&(bi
.bmiHeader
), &bih
, sizeof(bih
));
471 hBmpTmp
= NtGdiCreateDIBitmapInternal(hDC
,
472 bi
.bmiHeader
.biWidth
,
473 bi
.bmiHeader
.biHeight
,
478 bi
.bmiHeader
.biBitCount
,
479 bi
.bmiHeader
.biSizeImage
,
483 //HBITMAP hBmpTmp = GreCreateBitmap(1, 1, 1, 32, NULL);
486 HBITMAP hBmpOld
= (HBITMAP
)NtGdiSelectBitmap(hDCTmp
, hBmpTmp
);
491 NtGdiBitBlt(hDCTmp
, 0, 0, 1, 1, hDC
, XPos
, YPos
, SRCCOPY
, 0, 0);
492 NtGdiSelectBitmap(hDCTmp
, hBmpOld
);
494 // our bitmap is no longer selected, so we can access it's stuff...
495 psurf
= SURFACE_LockSurface(hBmpTmp
);
498 // Dont you need to convert something here?
499 Result
= *(COLORREF
*)psurf
->SurfObj
.pvScan0
;
500 SURFACE_UnlockSurface(psurf
);
503 GreDeleteObject(hBmpTmp
);
505 NtGdiDeleteObjectApp(hDCTmp
);
523 /* Don't copy more bytes than the buffer has */
524 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
527 /* FIXME: Call DDI CopyBits here if available */
530 DPRINT("Calling device specific BitmapBits\n");
531 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
533 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hbitmap
,
540 ERR_(bitmap
)("BitmapBits == NULL??\n");
547 RtlCopyMemory(Bits
, psurf
->SurfObj
.pvBits
, Bytes
);
561 LONG lDeltaDst
, lDeltaSrc
;
562 ULONG nWidth
, nHeight
, cBitsPixel
;
564 nWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
565 nHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
566 cBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
569 pjSrc
= psurf
->SurfObj
.pvScan0
;
571 lDeltaSrc
= psurf
->SurfObj
.lDelta
;
572 lDeltaDst
= WIDTH_BYTES_ALIGN16(nWidth
, cBitsPixel
);
577 RtlCopyMemory(pjDst
, pjSrc
, lDeltaDst
);
587 OUT OPTIONAL PBYTE pUnsafeBits
)
592 if (pUnsafeBits
!= NULL
&& Bytes
== 0)
597 psurf
= SURFACE_LockSurface(hBitmap
);
600 SetLastWin32Error(ERROR_INVALID_HANDLE
);
604 bmSize
= WIDTH_BYTES_ALIGN16(psurf
->SurfObj
.sizlBitmap
.cx
,
605 BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
)) *
606 abs(psurf
->SurfObj
.sizlBitmap
.cy
);
608 /* If the bits vector is null, the function should return the read size */
609 if (pUnsafeBits
== NULL
)
611 SURFACE_UnlockSurface(psurf
);
615 /* Don't copy more bytes than the buffer has */
616 Bytes
= min(Bytes
, bmSize
);
618 // FIXME: use MmSecureVirtualMemory
621 ProbeForWrite(pUnsafeBits
, Bytes
, 1);
622 UnsafeGetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
625 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
631 SURFACE_UnlockSurface(psurf
);
641 IN PBYTE pUnsafeBits
)
646 if (pUnsafeBits
== NULL
|| Bytes
== 0)
651 psurf
= SURFACE_LockSurface(hBitmap
);
654 SetLastWin32Error(ERROR_INVALID_HANDLE
);
660 ProbeForRead(pUnsafeBits
, Bytes
, 1);
661 UnsafeSetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
664 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
670 SURFACE_UnlockSurface(psurf
);
676 NtGdiSetBitmapDimension(
688 psurf
= SURFACE_LockSurface(hBitmap
);
691 SetLastWin32Error(ERROR_INVALID_HANDLE
);
699 ProbeForWrite(Size
, sizeof(SIZE
), 1);
700 *Size
= psurf
->sizlDim
;
702 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
709 /* The dimension is changed even if writing the old value failed */
710 psurf
->sizlDim
.cx
= Width
;
711 psurf
->sizlDim
.cy
= Height
;
713 SURFACE_UnlockSurface(psurf
);
718 VOID
IntHandleSpecialColorType(HDC hDC
, COLORREF
* Color
)
722 PALETTEENTRY palEntry
;
725 switch (*Color
>> 24)
727 case 0x10: /* DIBINDEX */
728 if (IntGetDIBColorTable(hDC
, LOWORD(*Color
), 1, &quad
) == 1)
730 *Color
= RGB(quad
.rgbRed
, quad
.rgbGreen
, quad
.rgbBlue
);
734 /* Out of color table bounds - use black */
735 *Color
= RGB(0, 0, 0);
738 case 0x02: /* PALETTERGB */
739 pdc
= DC_LockDc(hDC
);
740 if (pdc
->dclevel
.hpal
!= NtGdiGetStockObject(DEFAULT_PALETTE
))
742 index
= NtGdiGetNearestPaletteIndex(pdc
->dclevel
.hpal
, *Color
);
743 IntGetPaletteEntries(pdc
->dclevel
.hpal
, index
, 1, &palEntry
);
744 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
748 /* Use the pure color */
749 *Color
= *Color
& 0x00FFFFFF;
753 case 0x01: /* PALETTEINDEX */
754 pdc
= DC_LockDc(hDC
);
755 if (IntGetPaletteEntries(pdc
->dclevel
.hpal
, LOWORD(*Color
), 1, &palEntry
) == 1)
757 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
761 /* Index does not exist, use zero index */
762 IntGetPaletteEntries(pdc
->dclevel
.hpal
, 0, 1, &palEntry
);
763 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
768 DPRINT("Unsupported color type %d passed\n", *Color
>> 24);
783 if ((Color
& 0xFF000000) != 0)
785 IntHandleSpecialColorType(hDC
, &Color
);
788 hBrush
= NtGdiCreateSolidBrush(Color
, NULL
);
792 OldBrush
= NtGdiSelectBrush(hDC
, hBrush
);
793 if (OldBrush
== NULL
)
795 GreDeleteObject(hBrush
);
799 NtGdiPatBlt(hDC
, X
, Y
, 1, 1, PATCOPY
);
800 NtGdiSelectBrush(hDC
, OldBrush
);
801 GreDeleteObject(hBrush
);
813 DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
815 if (GdiSetPixelV(hDC
,X
,Y
,Color
))
817 Color
= NtGdiGetPixel(hDC
,X
,Y
);
818 DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
822 Color
= (COLORREF
)CLR_INVALID
;
823 DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
828 /* Internal Functions */
831 BITMAP_GetRealBitsPixel(UINT nBitsPixel
)
839 if (nBitsPixel
<= 16)
841 if (nBitsPixel
<= 24)
843 if (nBitsPixel
<= 32)
850 BITMAP_CopyBitmap(HBITMAP hBitmap
)
854 SURFACE
*Bitmap
, *resBitmap
;
862 Bitmap
= SURFACE_LockSurface(hBitmap
);
868 BITMAP_GetObject(Bitmap
, sizeof(BITMAP
), (PVOID
)&bm
);
870 if (Bitmap
->SurfObj
.lDelta
>= 0)
871 bm
.bmHeight
= -bm
.bmHeight
;
873 Size
.cx
= abs(bm
.bmWidth
);
874 Size
.cy
= abs(bm
.bmHeight
);
875 res
= GreCreateBitmapEx(Size
.cx
,
878 Bitmap
->SurfObj
.iBitmapFormat
,
879 Bitmap
->SurfObj
.fjBitmap
,
880 Bitmap
->SurfObj
.cjBits
,
887 resBitmap
= SURFACE_LockSurface(res
);
890 IntSetBitmapBits(resBitmap
, Bitmap
->SurfObj
.cjBits
, Bitmap
->SurfObj
.pvBits
);
891 SURFACE_UnlockSurface(resBitmap
);
895 GreDeleteObject(res
);
900 SURFACE_UnlockSurface(Bitmap
);
906 BITMAP_GetObject(SURFACE
*psurf
, INT Count
, LPVOID buffer
)
910 if (!buffer
) return sizeof(BITMAP
);
911 if ((UINT
)Count
< sizeof(BITMAP
)) return 0;
913 /* always fill a basic BITMAP structure */
916 pBitmap
->bmWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
917 pBitmap
->bmHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
918 pBitmap
->bmPlanes
= 1;
919 pBitmap
->bmBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
920 pBitmap
->bmWidthBytes
= WIDTH_BYTES_ALIGN16(pBitmap
->bmWidth
, pBitmap
->bmBitsPixel
);
922 /* Check for DIB section */
925 /* Set bmBits in this case */
926 pBitmap
->bmBits
= psurf
->SurfObj
.pvBits
;
927 /* DIBs data are 32 bits aligned */
928 pBitmap
->bmWidthBytes
= WIDTH_BYTES_ALIGN32(pBitmap
->bmWidth
, pBitmap
->bmBitsPixel
);
930 if (Count
>= sizeof(DIBSECTION
))
932 /* Fill rest of DIBSECTION */
933 PDIBSECTION pds
= buffer
;
935 pds
->dsBmih
.biSize
= sizeof(BITMAPINFOHEADER
);
936 pds
->dsBmih
.biWidth
= pds
->dsBm
.bmWidth
;
937 pds
->dsBmih
.biHeight
= pds
->dsBm
.bmHeight
;
938 pds
->dsBmih
.biPlanes
= pds
->dsBm
.bmPlanes
;
939 pds
->dsBmih
.biBitCount
= pds
->dsBm
.bmBitsPixel
;
940 if(psurf
->ppal
->flFlags
& PAL_BITFIELDS
)
942 pds
->dsBmih
.biCompression
= BI_BITFIELDS
;
946 switch (psurf
->SurfObj
.iBitmapFormat
)
954 pds
->dsBmih
.biCompression
= BI_RGB
;
957 pds
->dsBmih
.biCompression
= BI_RLE4
;
960 pds
->dsBmih
.biCompression
= BI_RLE8
;
963 pds
->dsBmih
.biCompression
= BI_JPEG
;
966 pds
->dsBmih
.biCompression
= BI_PNG
;
970 pds
->dsBmih
.biSizeImage
= psurf
->SurfObj
.cjBits
;
971 pds
->dsBmih
.biXPelsPerMeter
= 0;
972 pds
->dsBmih
.biYPelsPerMeter
= 0;
973 pds
->dsBmih
.biClrUsed
= psurf
->ppal
->NumColors
;
974 pds
->dsBmih
.biClrImportant
= psurf
->biClrImportant
;
975 pds
->dsBitfields
[0] = psurf
->ppal
->RedMask
;
976 pds
->dsBitfields
[1] = psurf
->ppal
->GreenMask
;
977 pds
->dsBitfields
[2] = psurf
->ppal
->BlueMask
;
978 pds
->dshSection
= psurf
->hDIBSection
;
979 pds
->dsOffset
= psurf
->dwOffset
;
981 return sizeof(DIBSECTION
);
986 /* not set according to wine test, confirmed in win2k */
987 pBitmap
->bmBits
= NULL
;
990 return sizeof(BITMAP
);
1002 PSURFACE psurf
= SURFACE_LockSurface(hsurf
);
1006 SURFACE_UnlockSurface(psurf
);