[WIN32K]
authorKamil Hornicek <kamil.hornicek@reactos.org>
Mon, 28 Feb 2011 12:47:01 +0000 (12:47 +0000)
committerKamil Hornicek <kamil.hornicek@reactos.org>
Mon, 28 Feb 2011 12:47:01 +0000 (12:47 +0000)
Fix calculating of ScanLines and source point in NtGdiGetDIBitsInternal for top-down bitmaps to more closely mimic win xp behavior. (Timo - high five for your test app)
See issue #5524 for more details.

svn path=/trunk/; revision=50935

reactos/subsystems/win32/win32k/objects/dibobj.c

index 963f152..1a26cd6 100644 (file)
@@ -939,9 +939,26 @@ NtGdiGetDIBitsInternal(
                rcDest.bottom = ScanLines;
                rcDest.right = psurf->SurfObj.sizlBitmap.cx;
 
                rcDest.bottom = ScanLines;
                rcDest.right = psurf->SurfObj.sizlBitmap.cx;
 
-               srcPoint.x = 0;
-               srcPoint.y = height < 0 ?
-                       psurf->SurfObj.sizlBitmap.cy - (StartScan + ScanLines) : StartScan;
+        srcPoint.x = 0;
+
+        if(height < 0)
+        {
+            srcPoint.y = 0;
+
+            if(ScanLines <= StartScan)
+            {
+                ScanLines = 1;
+                SURFACE_ShareUnlockSurface(psurfDest);
+                GreDeleteObject(hBmpDest);
+                goto done;
+            }
+
+            ScanLines -= StartScan;
+        }
+        else
+        {
+            srcPoint.y = StartScan;
+        }
 
                EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0xffffff, 0xffffff, 0);
 
 
                EXLATEOBJ_vInitialize(&exlo, psurf->ppal, psurfDest->ppal, 0xffffff, 0xffffff, 0);