gdiplus: Copy palettes with bitmaps.

This commit is contained in:
Vincent Povirk 2014-03-24 16:36:35 -05:00 committed by Alexandre Julliard
parent 392d3b657a
commit 500a96d079
1 changed files with 22 additions and 0 deletions

View File

@ -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);
}