From d26c0ca214cdb20b103f7c1875c6ea4f2bb1f2a6 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Fri, 26 Aug 2016 15:14:10 -0500 Subject: [PATCH] gdiplus: Copy remap tables when cloning an ImageAttributes. Signed-off-by: Vincent Povirk Signed-off-by: Alexandre Julliard --- dlls/gdiplus/imageattributes.c | 38 ++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/imageattributes.c b/dlls/gdiplus/imageattributes.c index a76fe3b1c1f..205070668ed 100644 --- a/dlls/gdiplus/imageattributes.c +++ b/dlls/gdiplus/imageattributes.c @@ -30,18 +30,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); GpStatus WINGDIPAPI GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, GpImageAttributes **cloneImageattr) { - GpStatus stat; + GpStatus stat = Ok; + struct color_remap_table remap_tables[ColorAdjustTypeCount] = {{0}}; + int i; TRACE("(%p, %p)\n", imageattr, cloneImageattr); if(!imageattr || !cloneImageattr) return InvalidParameter; - stat = GdipCreateImageAttributes(cloneImageattr); + for (i=0; icolorremaptables[i].enabled) + { + remap_tables[i].enabled = TRUE; + remap_tables[i].mapsize = imageattr->colorremaptables[i].mapsize; + remap_tables[i].colormap = heap_alloc(sizeof(ColorMap) * remap_tables[i].mapsize); + + if (remap_tables[i].colormap) + { + memcpy(remap_tables[i].colormap, imageattr->colorremaptables[i].colormap, + sizeof(ColorMap) * remap_tables[i].mapsize); + } + else + { + stat = OutOfMemory; + break; + } + } + } if (stat == Ok) + stat = GdipCreateImageAttributes(cloneImageattr); + + if (stat == Ok) + { **cloneImageattr = *imageattr; + memcpy((*cloneImageattr)->colorremaptables, remap_tables, sizeof(remap_tables)); + } + + if (stat != Ok) + { + for (i=0; i