[ros-diffs] [jgardou] 48420: [WIN32K] - Use lower level function to set bitmap bits in IntSetDIBits. Fixes rapps icons.

jgardou at svn.reactos.org jgardou at svn.reactos.org
Mon Aug 2 19:40:43 UTC 2010


Author: jgardou
Date: Mon Aug  2 19:40:42 2010
New Revision: 48420

URL: http://svn.reactos.org/svn/reactos?rev=48420&view=rev
Log:
[WIN32K]
  - Use lower level function to set bitmap bits in IntSetDIBits.
Fixes rapps icons.

Modified:
    branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c

Modified: branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c
URL: http://svn.reactos.org/svn/reactos/branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c?rev=48420&r1=48419&r2=48420&view=diff
==============================================================================
--- branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] (original)
+++ branches/reactos-yarotows/subsystems/win32/win32k/objects/dibobj.c [iso-8859-1] Mon Aug  2 19:40:42 2010
@@ -265,10 +265,13 @@
     CONST BITMAPINFO  *bmi,
     UINT  ColorUse)
 {
-    HBITMAP     SourceBitmap, hOldSrcBmp = NULL, hOldDstBmp = NULL;
-	HDC			hdcSrc, hdcDst;
+    HBITMAP     SourceBitmap;
+	PSURFACE    psurfDst, psurfSrc;
     INT         result = 0;
+	RECT		rcDst;
+	POINTL		ptSrc;
 	PVOID		pvBits;
+	EXLATEOBJ	exlo;
 
     SourceBitmap = DIB_CreateDIBSection(DC, bmi, ColorUse, &pvBits, NULL, 0, 0);
 	if (0 == SourceBitmap)
@@ -282,40 +285,45 @@
 													 bmi->bmiHeader.biHeight,
 													 bmi->bmiHeader.biBitCount));
 
-	hdcSrc = NtGdiCreateCompatibleDC(0);
-	hdcDst = NtGdiCreateCompatibleDC(0);
-
-	if(!(hdcSrc && hdcDst))
-	{
-		DPRINT1("Error, could not create memory DCs.\n");
+	psurfDst = SURFACE_LockSurface(hBitmap);
+	psurfSrc = SURFACE_LockSurface(SourceBitmap);
+
+	if(!(psurfSrc && psurfDst))
+	{
+		DPRINT1("Error, could not lock surfaces.\n");
 		goto cleanup;
 	}
 
-	hOldSrcBmp = NtGdiSelectBitmap(hdcSrc, SourceBitmap);
-	hOldDstBmp = NtGdiSelectBitmap(hdcDst, hBitmap);
-
-	if(!(hOldSrcBmp && hOldDstBmp))
-	{
-		DPRINT1("Error : Could not select bitmaps into DCs\n");
-		goto cleanup;
-	}
-
-	result = NtGdiBitBlt(hdcDst, 0, 0, bmi->bmiHeader.biWidth, ScanLines, hdcSrc, 0, StartScan,
-							SRCCOPY, 0, 0);
-
+	rcDst.top = bmi->bmiHeader.biHeight < 0 ?
+		abs(bmi->bmiHeader.biHeight) - (ScanLines + StartScan) : StartScan;
+	rcDst.left = 0;
+	rcDst.bottom = rcDst.top + ScanLines;
+	rcDst.right = psurfDst->SurfObj.sizlBitmap.cx;
+
+	ptSrc.x = 0;
+	ptSrc.y = 0;
+
+	EXLATEOBJ_vInitialize(&exlo, psurfSrc->ppal, psurfDst->ppal, 0, 0, 0);
+
+	result = IntEngCopyBits(&psurfDst->SurfObj,
+		                    &psurfSrc->SurfObj,
+							NULL,
+							&exlo.xlo,
+							&rcDst,
+							&ptSrc);
 	if(result)
 		result = ScanLines;
 
+	EXLATEOBJ_vCleanup(&exlo);
+
 cleanup:
-	if(hdcSrc)
-	{
-		if(hOldSrcBmp) NtGdiSelectBitmap(hdcSrc, hOldSrcBmp);
-		NtGdiDeleteObjectApp(hdcSrc);
-	}
-	if(hdcDst)
-	{
-		if(hOldDstBmp) NtGdiSelectBitmap(hdcDst, hOldDstBmp);
-		NtGdiDeleteObjectApp(hdcDst);
+	if(psurfSrc)
+	{
+		SURFACE_UnlockSurface(psurfSrc);
+	}
+	if(psurfDst)
+	{
+		SURFACE_UnlockSurface(psurfDst);
 	}
 	GreDeleteObject(SourceBitmap);
 




More information about the Ros-diffs mailing list