[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Mon, 2 Aug 2010 19:40:42 +0000 (19:40 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Mon, 2 Aug 2010 19:40:42 +0000 (19:40 +0000)
  - Use lower level function to set bitmap bits in IntSetDIBits.
Fixes rapps icons.

svn path=/branches/reactos-yarotows/; revision=48420

subsystems/win32/win32k/objects/dibobj.c

index db8e5c9..8accc41 100644 (file)
@@ -265,10 +265,13 @@ IntSetDIBits(
     CONST BITMAPINFO  *bmi,
     UINT  ColorUse)
 {
     CONST BITMAPINFO  *bmi,
     UINT  ColorUse)
 {
-    HBITMAP     SourceBitmap, hOldSrcBmp = NULL, hOldDstBmp = NULL;
-       HDC                     hdcSrc, hdcDst;
+    HBITMAP     SourceBitmap;
+       PSURFACE    psurfDst, psurfSrc;
     INT         result = 0;
     INT         result = 0;
+       RECT            rcDst;
+       POINTL          ptSrc;
        PVOID           pvBits;
        PVOID           pvBits;
+       EXLATEOBJ       exlo;
 
     SourceBitmap = DIB_CreateDIBSection(DC, bmi, ColorUse, &pvBits, NULL, 0, 0);
        if (0 == SourceBitmap)
 
     SourceBitmap = DIB_CreateDIBSection(DC, bmi, ColorUse, &pvBits, NULL, 0, 0);
        if (0 == SourceBitmap)
@@ -282,40 +285,45 @@ IntSetDIBits(
                                                                                                         bmi->bmiHeader.biHeight,
                                                                                                         bmi->bmiHeader.biBitCount));
 
                                                                                                         bmi->bmiHeader.biHeight,
                                                                                                         bmi->bmiHeader.biBitCount));
 
-       hdcSrc = NtGdiCreateCompatibleDC(0);
-       hdcDst = NtGdiCreateCompatibleDC(0);
+       psurfDst = SURFACE_LockSurface(hBitmap);
+       psurfSrc = SURFACE_LockSurface(SourceBitmap);
 
 
-       if(!(hdcSrc && hdcDst))
+       if(!(psurfSrc && psurfDst))
        {
        {
-               DPRINT1("Error, could not create memory DCs.\n");
+               DPRINT1("Error, could not lock surfaces.\n");
                goto cleanup;
        }
 
                goto cleanup;
        }
 
-       hOldSrcBmp = NtGdiSelectBitmap(hdcSrc, SourceBitmap);
-       hOldDstBmp = NtGdiSelectBitmap(hdcDst, hBitmap);
+       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;
 
 
-       if(!(hOldSrcBmp && hOldDstBmp))
-       {
-               DPRINT1("Error : Could not select bitmaps into DCs\n");
-               goto cleanup;
-       }
+       ptSrc.x = 0;
+       ptSrc.y = 0;
 
 
-       result = NtGdiBitBlt(hdcDst, 0, 0, bmi->bmiHeader.biWidth, ScanLines, hdcSrc, 0, StartScan,
-                                                       SRCCOPY, 0, 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;
 
        if(result)
                result = ScanLines;
 
+       EXLATEOBJ_vCleanup(&exlo);
+
 cleanup:
 cleanup:
-       if(hdcSrc)
+       if(psurfSrc)
        {
        {
-               if(hOldSrcBmp) NtGdiSelectBitmap(hdcSrc, hOldSrcBmp);
-               NtGdiDeleteObjectApp(hdcSrc);
+               SURFACE_UnlockSurface(psurfSrc);
        }
        }
-       if(hdcDst)
+       if(psurfDst)
        {
        {
-               if(hOldDstBmp) NtGdiSelectBitmap(hdcDst, hOldDstBmp);
-               NtGdiDeleteObjectApp(hdcDst);
+               SURFACE_UnlockSurface(psurfDst);
        }
        GreDeleteObject(SourceBitmap);
 
        }
        GreDeleteObject(SourceBitmap);