Commit 500a96d0 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Copy palettes with bitmaps.

parent 392d3b65
......@@ -1252,6 +1252,28 @@ GpStatus WINGDIPAPI GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height,
srcBitmap->stride,
srcBitmap->bits + srcBitmap->stride * area.Y + PIXELFORMATBPP(srcBitmap->format) * area.X / 8,
srcBitmap->format, srcBitmap->image.palette);
if (stat == Ok && srcBitmap->image.palette)
{
ColorPalette *src_palette, *dst_palette;
src_palette = srcBitmap->image.palette;
dst_palette = GdipAlloc(sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count);
if (dst_palette)
{
dst_palette->Flags = src_palette->Flags;
dst_palette->Count = src_palette->Count;
memcpy(dst_palette->Entries, src_palette->Entries, sizeof(ARGB) * src_palette->Count);
GdipFree((*dstBitmap)->image.palette);
(*dstBitmap)->image.palette = dst_palette;
}
else
stat = OutOfMemory;
}
if (stat != Ok)
GdipDisposeImage((GpImage*)*dstBitmap);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment