gdiplus: Fix pointer math for the 64-bit tests.

Vincent Povirk vincent at codeweavers.com
Tue Oct 4 14:22:35 CDT 2011


Clearly I need to brush up on my integer conversion rules.
-------------- next part --------------
From f1a4c0c0af784c2699d082d4a9cae8a8e3f3fd02 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 4 Oct 2011 14:11:06 -0500
Subject: [PATCH] gdiplus: Fix pointer math for the 64-bit tests.

---
 dlls/gdiplus/gdiplus.c |    2 +-
 dlls/gdiplus/image.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c
index 8026f6e..9c3478b 100644
--- a/dlls/gdiplus/gdiplus.c
+++ b/dlls/gdiplus/gdiplus.c
@@ -407,7 +407,7 @@ BOOL lengthen_path(GpPath *path, INT len)
 void convert_32bppARGB_to_32bppPARGB(UINT width, UINT height,
     BYTE *dst_bits, INT dst_stride, const BYTE *src_bits, INT src_stride)
 {
-    UINT x, y;
+    INT x, y;
     for (y=0; y<height; y++)
     {
         const BYTE *src=src_bits+y*src_stride;
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 4ae1d64..ce14ef6 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -1404,7 +1404,7 @@ GpStatus WINGDIPAPI GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap,
     if (result)
     {
         lockeddata.Stride = -width * 4;
-        lockeddata.Scan0 = bits - (lockeddata.Stride * (height - 1));
+        lockeddata.Scan0 = bits + (width * 4 * (height - 1));
 
         stat = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead|ImageLockModeUserInputBuf,
             PixelFormat32bppPARGB, &lockeddata);
-- 
1.7.4.1


More information about the wine-patches mailing list