Author: tkreuzer
Date: Tue May 15 16:52:21 2012
New Revision: 56591
URL:
http://svn.reactos.org/svn/reactos?rev=56591&view=rev
Log:
[WIN32K]
Implement DC_bIsBitmapCompatible, which checks if a bitmap can be used with the DC in
SelectBitmap or GetDIBits
Modified:
branches/dib_rewrite/win32ss/gdi/ntgdi/dc.h
branches/dib_rewrite/win32ss/gdi/ntgdi/dcobjs.c
Modified: branches/dib_rewrite/win32ss/gdi/ntgdi/dc.h
URL:
http://svn.reactos.org/svn/reactos/branches/dib_rewrite/win32ss/gdi/ntgdi/d…
==============================================================================
--- branches/dib_rewrite/win32ss/gdi/ntgdi/dc.h [iso-8859-1] (original)
+++ branches/dib_rewrite/win32ss/gdi/ntgdi/dc.h [iso-8859-1] Tue May 15 16:52:21 2012
@@ -193,6 +193,10 @@
NTAPI
DC_vSetBrushOrigin(PDC pdc, LONG x, LONG y);
+BOOL
+NTAPI
+DC_bIsBitmapCompatible(PDC pdc, PSURFACE psurf);
+
FORCEINLINE
PDC
DC_LockDc(HDC hdc)
Modified: branches/dib_rewrite/win32ss/gdi/ntgdi/dcobjs.c
URL:
http://svn.reactos.org/svn/reactos/branches/dib_rewrite/win32ss/gdi/ntgdi/d…
==============================================================================
--- branches/dib_rewrite/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] (original)
+++ branches/dib_rewrite/win32ss/gdi/ntgdi/dcobjs.c [iso-8859-1] Tue May 15 16:52:21 2012
@@ -316,6 +316,28 @@
return hOrgPen;
}
+BOOL
+NTAPI
+DC_bIsBitmapCompatible(PDC pdc, PSURFACE psurf)
+{
+ ULONG cBitsPixel;
+
+ /* Must be an API bitmap */
+ if (!(psurf->flags & API_BITMAP)) return FALSE;
+
+ /* DIB sections are always compatible */
+ if (psurf->ppal->flFlags & PAL_DIBSECTION) return TRUE;
+
+ /* Get the bit depth of the bitmap */
+ cBitsPixel = gajBitsPerFormat[psurf->SurfObj.iBitmapFormat];
+
+ /* 1 BPP is compatible */
+ if ((cBitsPixel == 1) || (cBitsPixel == pdc->ppdev->gdiinfo.cBitsPixel))
+ return TRUE;
+
+ return FALSE;
+}
+
/*
* @implemented
*/
@@ -330,7 +352,6 @@
PSURFACE psurfNew, psurfOld;
HRGN hVisRgn;
HDC hdcOld;
- ULONG cBitsPixel;
ASSERT_NOGDILOCKS();
/* Verify parameters */
@@ -396,10 +417,7 @@
}
/* Check if the bitmap is compatile with the dc */
- cBitsPixel = gajBitsPerFormat[psurfNew->SurfObj.iBitmapFormat];
- if ((cBitsPixel != 1) &&
- (cBitsPixel != pdc->ppdev->gdiinfo.cBitsPixel) &&
- (psurfNew->hSecure == NULL))
+ if (!DC_bIsBitmapCompatible(pdc, psurfNew))
{
/* Dereference the bitmap, unlock the DC and fail. */
SURFACE_ShareUnlockSurface(psurfNew);