Commit 673377a7 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

gdiplus: Store copies of remap tables in ImageAttributes objects.

parent 8a0b57a9
...@@ -326,7 +326,7 @@ struct color_matrix{ ...@@ -326,7 +326,7 @@ struct color_matrix{
struct color_remap_table{ struct color_remap_table{
BOOL enabled; BOOL enabled;
INT mapsize; INT mapsize;
GDIPCONST ColorMap *colormap; ColorMap *colormap;
}; };
struct GpImageAttributes{ struct GpImageAttributes{
......
...@@ -62,11 +62,16 @@ GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr) ...@@ -62,11 +62,16 @@ GpStatus WINGDIPAPI GdipCreateImageAttributes(GpImageAttributes **imageattr)
GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr) GpStatus WINGDIPAPI GdipDisposeImageAttributes(GpImageAttributes *imageattr)
{ {
int i;
TRACE("(%p)\n", imageattr); TRACE("(%p)\n", imageattr);
if(!imageattr) if(!imageattr)
return InvalidParameter; return InvalidParameter;
for (i=0; i<ColorAdjustTypeCount; i++)
GdipFree(imageattr->colorremaptables[i].colormap);
GdipFree(imageattr); GdipFree(imageattr);
return Ok; return Ok;
...@@ -205,6 +210,8 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt ...@@ -205,6 +210,8 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt
ColorAdjustType type, BOOL enableFlag, UINT mapSize, ColorAdjustType type, BOOL enableFlag, UINT mapSize,
GDIPCONST ColorMap *map) GDIPCONST ColorMap *map)
{ {
ColorMap *new_map;
TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map); TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map);
if(!imageAttr || type >= ColorAdjustTypeCount) if(!imageAttr || type >= ColorAdjustTypeCount)
...@@ -215,8 +222,22 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt ...@@ -215,8 +222,22 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt
if(!map || !mapSize) if(!map || !mapSize)
return InvalidParameter; return InvalidParameter;
new_map = GdipAlloc(sizeof(*map) * mapSize);
if (!new_map)
return OutOfMemory;
memcpy(new_map, map, sizeof(*map) * mapSize);
GdipFree(imageAttr->colorremaptables[type].colormap);
imageAttr->colorremaptables[type].mapsize = mapSize; imageAttr->colorremaptables[type].mapsize = mapSize;
imageAttr->colorremaptables[type].colormap = map; imageAttr->colorremaptables[type].colormap = new_map;
}
else
{
GdipFree(imageAttr->colorremaptables[type].colormap);
imageAttr->colorremaptables[type].colormap = NULL;
} }
imageAttr->colorremaptables[type].enabled = enableFlag; imageAttr->colorremaptables[type].enabled = enableFlag;
......
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