[WIN32K]
authorJérôme Gardou <jerome.gardou@reactos.org>
Mon, 2 Aug 2010 17:25:09 +0000 (17:25 +0000)
committerJérôme Gardou <jerome.gardou@reactos.org>
Mon, 2 Aug 2010 17:25:09 +0000 (17:25 +0000)
  - Do not cast RGBQUAD to PALETTEENTRY or the other way around, you idiot.
  - Report success even when we're asked fo 0 ScanLines in NtGdiGetDIBitsInternal.

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

subsystems/win32/win32k/objects/dibobj.c

index 36b4e9c..db8e5c9 100644 (file)
@@ -695,8 +695,7 @@ NtGdiGetDIBitsInternal(
         Info->bmiHeader.biYPelsPerMeter = 0;
         Info->bmiHeader.biClrUsed = 0;
         Info->bmiHeader.biClrImportant = 0;
-               ScanLines = 1;
-               /* Get Complete info now */
+               ScanLines = abs(Info->bmiHeader.biHeight);
                goto done;
 
        case 1:
@@ -723,7 +722,12 @@ NtGdiGetDIBitsInternal(
                                        }
                                }
                                if(colors != 1 << bpp) Info->bmiHeader.biClrUsed = colors;
-                               RtlCopyMemory(rgbQuads, psurf->ppal->IndexedColors, colors * sizeof(RGBQUAD));
+                               for(i=0; i < colors; i++)
+                               {
+                                       rgbQuads[i].rgbRed = psurf->ppal->IndexedColors[i].peRed;
+                                       rgbQuads[i].rgbGreen = psurf->ppal->IndexedColors[i].peGreen;
+                                       rgbQuads[i].rgbBlue = psurf->ppal->IndexedColors[i].peBlue;
+                               }
                        }
                        else
                        {
@@ -977,6 +981,7 @@ NtGdiGetDIBitsInternal(
                GreDeleteObject(hBmpDest);
                EXLATEOBJ_vCleanup(&exlo);
        }
+       else ScanLines = abs(height);
 
 done:
 
@@ -1037,6 +1042,7 @@ NtGdiStretchDIBitsInternal(
                return 0;
        }
 
+       /* Set bits */
        _SEH2_TRY
        {
                ProbeForRead(Bits, cjMaxBits, 1);