gdiplus: Copy palettes with bitmaps.
This commit is contained in:
parent
392d3b657a
commit
500a96d079
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue