Vincent Povirk : gdiplus: Don' t copy bits into the buffer when a bitmap is locked write-only.
Alexandre Julliard
julliard at winehq.org
Fri Feb 25 11:19:44 CST 2011
Module: wine
Branch: master
Commit: 9497e9380b8f87fe456c844ac49db4210c0dd7bb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9497e9380b8f87fe456c844ac49db4210c0dd7bb
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Thu Feb 24 16:12:43 2011 -0600
gdiplus: Don't copy bits into the buffer when a bitmap is locked write-only.
---
dlls/gdiplus/image.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index 3c4e9bf..2139e97 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -968,11 +968,14 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
}
/* Make sure we can convert to the requested format. */
- stat = convert_pixels(0, 0, 0, NULL, format, 0, NULL, bitmap->format, NULL);
- if (stat == NotImplemented)
+ if (flags & ImageLockModeRead)
{
- FIXME("cannot read bitmap from %x to %x\n", bitmap->format, format);
- return NotImplemented;
+ stat = convert_pixels(0, 0, 0, NULL, format, 0, NULL, bitmap->format, NULL);
+ if (stat == NotImplemented)
+ {
+ FIXME("cannot read bitmap from %x to %x\n", bitmap->format, format);
+ return NotImplemented;
+ }
}
/* If we're opening for writing, make sure we'll be able to write back in
@@ -995,14 +998,17 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
if (!buff) return OutOfMemory;
- stat = convert_pixels(bitmap->width, bitmap->height,
- stride, buff, format,
- bitmap->stride, bitmap->bits, bitmap->format, bitmap->image.palette_entries);
-
- if (stat != Ok)
+ if (flags & ImageLockModeRead)
{
- GdipFree(buff);
- return stat;
+ stat = convert_pixels(bitmap->width, bitmap->height,
+ stride, buff, format,
+ bitmap->stride, bitmap->bits, bitmap->format, bitmap->image.palette_entries);
+
+ if (stat != Ok)
+ {
+ GdipFree(buff);
+ return stat;
+ }
}
lockeddata->Width = act_rect.Width;
More information about the wine-cvs
mailing list