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 ((dc
->rosdc
.CombinedClip
== NULL
) ||
442 (RECTL_bPointInRect(&dc
->rosdc
.CombinedClip
->rclBounds
, XPos
, YPos
)))
445 psurf
= dc
->dclevel
.pSurface
;
448 pso
= &psurf
->SurfObj
;
449 EXLATEOBJ_vInitialize(&exlo
, psurf
->ppal
, &gpalRGB
, 0, 0xffffff, 0);
450 // check if this DC has a DIB behind it...
451 if (pso
->pvScan0
) // STYPE_BITMAP == pso->iType
454 Result
= XLATEOBJ_iXlate(&exlo
.xlo
,
455 DibFunctionsForBitmapFormat
[pso
->iBitmapFormat
].DIB_GetPixel(pso
, XPos
, YPos
));
458 EXLATEOBJ_vCleanup(&exlo
);
463 // if Result is still CLR_INVALID, then the "quick" method above didn't work
464 if (bInRect
&& Result
== CLR_INVALID
)
466 // FIXME: create a 1x1 32BPP DIB, and blit to it
467 HDC hDCTmp
= NtGdiCreateCompatibleDC(hDC
);
470 static const BITMAPINFOHEADER bih
= { sizeof(BITMAPINFOHEADER
), 1, 1, 1, 32, BI_RGB
, 0, 0, 0, 0, 0 };
472 RtlMoveMemory(&(bi
.bmiHeader
), &bih
, sizeof(bih
));
473 hBmpTmp
= NtGdiCreateDIBitmapInternal(hDC
,
474 bi
.bmiHeader
.biWidth
,
475 bi
.bmiHeader
.biHeight
,
480 bi
.bmiHeader
.biBitCount
,
481 bi
.bmiHeader
.biSizeImage
,
485 //HBITMAP hBmpTmp = GreCreateBitmap(1, 1, 1, 32, NULL);
488 HBITMAP hBmpOld
= (HBITMAP
)NtGdiSelectBitmap(hDCTmp
, hBmpTmp
);
493 NtGdiBitBlt(hDCTmp
, 0, 0, 1, 1, hDC
, XPos
, YPos
, SRCCOPY
, 0, 0);
494 NtGdiSelectBitmap(hDCTmp
, hBmpOld
);
496 // our bitmap is no longer selected, so we can access it's stuff...
497 psurf
= SURFACE_LockSurface(hBmpTmp
);
500 // Dont you need to convert something here?
501 Result
= *(COLORREF
*)psurf
->SurfObj
.pvScan0
;
502 SURFACE_UnlockSurface(psurf
);
505 GreDeleteObject(hBmpTmp
);
507 NtGdiDeleteObjectApp(hDCTmp
);
525 /* Don't copy more bytes than the buffer has */
526 Bytes
= min(Bytes
, psurf
->SurfObj
.cjBits
);
529 /* FIXME: Call DDI CopyBits here if available */
532 DPRINT("Calling device specific BitmapBits\n");
533 if (psurf
->DDBitmap
->funcs
->pBitmapBits
)
535 ret
= psurf
->DDBitmap
->funcs
->pBitmapBits(hbitmap
,
542 ERR_(bitmap
)("BitmapBits == NULL??\n");
549 RtlCopyMemory(Bits
, psurf
->SurfObj
.pvBits
, Bytes
);
563 LONG lDeltaDst
, lDeltaSrc
;
564 ULONG nWidth
, nHeight
, cBitsPixel
;
566 nWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
567 nHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
568 cBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
571 pjSrc
= psurf
->SurfObj
.pvScan0
;
573 lDeltaSrc
= psurf
->SurfObj
.lDelta
;
574 lDeltaDst
= WIDTH_BYTES_ALIGN16(nWidth
, cBitsPixel
);
579 RtlCopyMemory(pjDst
, pjSrc
, lDeltaDst
);
589 OUT OPTIONAL PBYTE pUnsafeBits
)
594 if (pUnsafeBits
!= NULL
&& Bytes
== 0)
599 psurf
= SURFACE_LockSurface(hBitmap
);
602 EngSetLastError(ERROR_INVALID_HANDLE
);
606 bmSize
= WIDTH_BYTES_ALIGN16(psurf
->SurfObj
.sizlBitmap
.cx
,
607 BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
)) *
608 abs(psurf
->SurfObj
.sizlBitmap
.cy
);
610 /* If the bits vector is null, the function should return the read size */
611 if (pUnsafeBits
== NULL
)
613 SURFACE_UnlockSurface(psurf
);
617 /* Don't copy more bytes than the buffer has */
618 Bytes
= min(Bytes
, bmSize
);
620 // FIXME: use MmSecureVirtualMemory
623 ProbeForWrite(pUnsafeBits
, Bytes
, 1);
624 UnsafeGetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
627 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
633 SURFACE_UnlockSurface(psurf
);
643 IN PBYTE pUnsafeBits
)
648 if (pUnsafeBits
== NULL
|| Bytes
== 0)
653 psurf
= SURFACE_LockSurface(hBitmap
);
656 EngSetLastError(ERROR_INVALID_HANDLE
);
662 ProbeForRead(pUnsafeBits
, Bytes
, 1);
663 UnsafeSetBitmapBits(psurf
, Bytes
, pUnsafeBits
);
666 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
672 SURFACE_UnlockSurface(psurf
);
678 NtGdiSetBitmapDimension(
690 psurf
= SURFACE_LockSurface(hBitmap
);
693 EngSetLastError(ERROR_INVALID_HANDLE
);
701 ProbeForWrite(Size
, sizeof(SIZE
), 1);
702 *Size
= psurf
->sizlDim
;
704 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
711 /* The dimension is changed even if writing the old value failed */
712 psurf
->sizlDim
.cx
= Width
;
713 psurf
->sizlDim
.cy
= Height
;
715 SURFACE_UnlockSurface(psurf
);
720 VOID
IntHandleSpecialColorType(HDC hDC
, COLORREF
* Color
)
724 PALETTEENTRY palEntry
;
727 switch (*Color
>> 24)
729 case 0x10: /* DIBINDEX */
730 if (IntGetDIBColorTable(hDC
, LOWORD(*Color
), 1, &quad
) == 1)
732 *Color
= RGB(quad
.rgbRed
, quad
.rgbGreen
, quad
.rgbBlue
);
736 /* Out of color table bounds - use black */
737 *Color
= RGB(0, 0, 0);
740 case 0x02: /* PALETTERGB */
741 pdc
= DC_LockDc(hDC
);
742 if (pdc
->dclevel
.hpal
!= NtGdiGetStockObject(DEFAULT_PALETTE
))
744 index
= NtGdiGetNearestPaletteIndex(pdc
->dclevel
.hpal
, *Color
);
745 IntGetPaletteEntries(pdc
->dclevel
.hpal
, index
, 1, &palEntry
);
746 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
750 /* Use the pure color */
751 *Color
= *Color
& 0x00FFFFFF;
755 case 0x01: /* PALETTEINDEX */
756 pdc
= DC_LockDc(hDC
);
757 if (IntGetPaletteEntries(pdc
->dclevel
.hpal
, LOWORD(*Color
), 1, &palEntry
) == 1)
759 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
763 /* Index does not exist, use zero index */
764 IntGetPaletteEntries(pdc
->dclevel
.hpal
, 0, 1, &palEntry
);
765 *Color
= RGB(palEntry
.peRed
, palEntry
.peGreen
, palEntry
.peBlue
);
770 DPRINT("Unsupported color type %d passed\n", *Color
>> 24);
785 if ((Color
& 0xFF000000) != 0)
787 IntHandleSpecialColorType(hDC
, &Color
);
790 hBrush
= NtGdiCreateSolidBrush(Color
, NULL
);
794 OldBrush
= NtGdiSelectBrush(hDC
, hBrush
);
795 if (OldBrush
== NULL
)
797 GreDeleteObject(hBrush
);
801 NtGdiPatBlt(hDC
, X
, Y
, 1, 1, PATCOPY
);
802 NtGdiSelectBrush(hDC
, OldBrush
);
803 GreDeleteObject(hBrush
);
815 DPRINT("0 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
817 if (GdiSetPixelV(hDC
,X
,Y
,Color
))
819 Color
= NtGdiGetPixel(hDC
,X
,Y
);
820 DPRINT("1 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
824 Color
= (COLORREF
)CLR_INVALID
;
825 DPRINT("2 NtGdiSetPixel X %ld Y %ld C %ld\n", X
, Y
, Color
);
830 /* Internal Functions */
833 BITMAP_CopyBitmap(HBITMAP hBitmap
)
837 SURFACE
*Bitmap
, *resBitmap
;
845 Bitmap
= SURFACE_ShareLockSurface(hBitmap
);
851 BITMAP_GetObject(Bitmap
, sizeof(BITMAP
), (PVOID
)&bm
);
853 if (Bitmap
->SurfObj
.lDelta
>= 0)
854 bm
.bmHeight
= -bm
.bmHeight
;
856 Size
.cx
= abs(bm
.bmWidth
);
857 Size
.cy
= abs(bm
.bmHeight
);
858 res
= GreCreateBitmapEx(Size
.cx
,
861 Bitmap
->SurfObj
.iBitmapFormat
,
862 Bitmap
->SurfObj
.fjBitmap
,
863 Bitmap
->SurfObj
.cjBits
,
870 resBitmap
= SURFACE_ShareLockSurface(res
);
873 IntSetBitmapBits(resBitmap
, Bitmap
->SurfObj
.cjBits
, Bitmap
->SurfObj
.pvBits
);
874 GDIOBJ_IncrementShareCount(&Bitmap
->ppal
->BaseObject
);
875 GDIOBJ_ShareUnlockObjByPtr(&resBitmap
->ppal
->BaseObject
);
876 resBitmap
->ppal
= Bitmap
->ppal
;
877 SURFACE_ShareUnlockSurface(resBitmap
);
881 GreDeleteObject(res
);
886 SURFACE_ShareUnlockSurface(Bitmap
);
892 BITMAP_GetObject(SURFACE
*psurf
, INT Count
, LPVOID buffer
)
896 if (!buffer
) return sizeof(BITMAP
);
897 if ((UINT
)Count
< sizeof(BITMAP
)) return 0;
899 /* always fill a basic BITMAP structure */
902 pBitmap
->bmWidth
= psurf
->SurfObj
.sizlBitmap
.cx
;
903 pBitmap
->bmHeight
= psurf
->SurfObj
.sizlBitmap
.cy
;
904 pBitmap
->bmPlanes
= 1;
905 pBitmap
->bmBitsPixel
= BitsPerFormat(psurf
->SurfObj
.iBitmapFormat
);
906 pBitmap
->bmWidthBytes
= WIDTH_BYTES_ALIGN16(pBitmap
->bmWidth
, pBitmap
->bmBitsPixel
);
908 /* Check for DIB section */
911 /* Set bmBits in this case */
912 pBitmap
->bmBits
= psurf
->SurfObj
.pvBits
;
913 /* DIBs data are 32 bits aligned */
914 pBitmap
->bmWidthBytes
= WIDTH_BYTES_ALIGN32(pBitmap
->bmWidth
, pBitmap
->bmBitsPixel
);
916 if (Count
>= sizeof(DIBSECTION
))
918 /* Fill rest of DIBSECTION */
919 PDIBSECTION pds
= buffer
;
921 pds
->dsBmih
.biSize
= sizeof(BITMAPINFOHEADER
);
922 pds
->dsBmih
.biWidth
= pds
->dsBm
.bmWidth
;
923 pds
->dsBmih
.biHeight
= pds
->dsBm
.bmHeight
;
924 pds
->dsBmih
.biPlanes
= pds
->dsBm
.bmPlanes
;
925 pds
->dsBmih
.biBitCount
= pds
->dsBm
.bmBitsPixel
;
927 switch (psurf
->SurfObj
.iBitmapFormat
)
933 pds
->dsBmih
.biCompression
= BI_RGB
;
937 if (psurf
->ppal
->flFlags
& PAL_RGB16_555
)
938 pds
->dsBmih
.biCompression
= BI_RGB
;
940 pds
->dsBmih
.biCompression
= BI_BITFIELDS
;
944 if (psurf
->ppal
->flFlags
& (PAL_RGB
|PAL_BGR
))
945 pds
->dsBmih
.biCompression
= BI_RGB
;
947 pds
->dsBmih
.biCompression
= BI_BITFIELDS
;
951 pds
->dsBmih
.biCompression
= BI_RLE4
;
954 pds
->dsBmih
.biCompression
= BI_RLE8
;
957 pds
->dsBmih
.biCompression
= BI_JPEG
;
960 pds
->dsBmih
.biCompression
= BI_PNG
;
963 ASSERT(FALSE
); /* this shouldn't happen */
966 pds
->dsBmih
.biSizeImage
= psurf
->SurfObj
.cjBits
;
967 pds
->dsBmih
.biXPelsPerMeter
= 0;
968 pds
->dsBmih
.biYPelsPerMeter
= 0;
969 pds
->dsBmih
.biClrUsed
= psurf
->ppal
->NumColors
;
970 pds
->dsBmih
.biClrImportant
= psurf
->biClrImportant
;
971 pds
->dsBitfields
[0] = psurf
->ppal
->RedMask
;
972 pds
->dsBitfields
[1] = psurf
->ppal
->GreenMask
;
973 pds
->dsBitfields
[2] = psurf
->ppal
->BlueMask
;
974 pds
->dshSection
= psurf
->hDIBSection
;
975 pds
->dsOffset
= psurf
->dwOffset
;
977 return sizeof(DIBSECTION
);
982 /* not set according to wine test, confirmed in win2k */
983 pBitmap
->bmBits
= NULL
;
986 return sizeof(BITMAP
);
998 PSURFACE psurf
= SURFACE_LockSurface(hsurf
);
1002 SURFACE_UnlockSurface(psurf
);