gdiplus: Don't copy bits into the buffer when a bitmap is locked write-only.
This commit is contained in:
parent
58eb96c9e7
commit
9497e9380b
|
@ -968,11 +968,14 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we can convert to the requested format. */
|
/* Make sure we can convert to the requested format. */
|
||||||
stat = convert_pixels(0, 0, 0, NULL, format, 0, NULL, bitmap->format, NULL);
|
if (flags & ImageLockModeRead)
|
||||||
if (stat == NotImplemented)
|
|
||||||
{
|
{
|
||||||
FIXME("cannot read bitmap from %x to %x\n", bitmap->format, format);
|
stat = convert_pixels(0, 0, 0, NULL, format, 0, NULL, bitmap->format, NULL);
|
||||||
return NotImplemented;
|
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
|
/* 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;
|
if (!buff) return OutOfMemory;
|
||||||
|
|
||||||
stat = convert_pixels(bitmap->width, bitmap->height,
|
if (flags & ImageLockModeRead)
|
||||||
stride, buff, format,
|
|
||||||
bitmap->stride, bitmap->bits, bitmap->format, bitmap->image.palette_entries);
|
|
||||||
|
|
||||||
if (stat != Ok)
|
|
||||||
{
|
{
|
||||||
GdipFree(buff);
|
stat = convert_pixels(bitmap->width, bitmap->height,
|
||||||
return stat;
|
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;
|
lockeddata->Width = act_rect.Width;
|
||||||
|
|
Loading…
Reference in New Issue