Module: wine Branch: master Commit: 78f9177d9d3cce66b3bfe65dfa6652e1c5d6d457 URL: http://source.winehq.org/git/wine.git/?a=commit;h=78f9177d9d3cce66b3bfe65dfa...
Author: Justin Chevrier jchevrier@gmail.com Date: Wed Mar 3 20:06:33 2010 -0500
gdiplus: Implement GdipSetImageAttributesRemapTable with updated test.
---
dlls/gdiplus/gdiplus_private.h | 7 +++++++ dlls/gdiplus/imageattributes.c | 19 ++++++++++++++----- dlls/gdiplus/tests/image.c | 14 +++++++------- 3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 8e26eb1..ca1cba6 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -264,10 +264,17 @@ struct color_matrix{ ColorMatrix graymatrix; };
+struct color_remap_table{ + BOOL enabled; + INT mapsize; + GDIPCONST ColorMap *colormap; +}; + struct GpImageAttributes{ WrapMode wrap; struct color_key colorkeys[ColorAdjustTypeCount]; struct color_matrix colormatrices[ColorAdjustTypeCount]; + struct color_remap_table colorremaptables[ColorAdjustTypeCount]; BOOL gamma_enabled[ColorAdjustTypeCount]; REAL gamma[ColorAdjustTypeCount]; }; diff --git a/dlls/gdiplus/imageattributes.c b/dlls/gdiplus/imageattributes.c index c9c3bcc..1a7118d 100644 --- a/dlls/gdiplus/imageattributes.c +++ b/dlls/gdiplus/imageattributes.c @@ -204,14 +204,23 @@ GpStatus WINGDIPAPI GdipSetImageAttributesRemapTable(GpImageAttributes *imageAtt ColorAdjustType type, BOOL enableFlag, UINT mapSize, GDIPCONST ColorMap *map) { - static int calls; - TRACE("(%p,%u,%i,%u,%p)\n", imageAttr, type, enableFlag, mapSize, map);
- if(!(calls++)) - FIXME("not implemented\n"); + if(!imageAttr || type >= ColorAdjustTypeCount) + return InvalidParameter;
- return NotImplemented; + if (enableFlag) + { + if(!map || !mapSize) + return InvalidParameter; + + imageAttr->colorremaptables[type].mapsize = mapSize; + imageAttr->colorremaptables[type].colormap = map; + } + + imageAttr->colorremaptables[type].enabled = enableFlag; + + return Ok; }
GpStatus WINGDIPAPI GdipSetImageAttributesThreshold(GpImageAttributes *imageAttr, diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 2e3bd74..9085ef2 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -1760,28 +1760,28 @@ static void test_remaptable(void) map->newColor.Argb = 0xffff00ff;
stat = GdipSetImageAttributesRemapTable(NULL, ColorAdjustTypeDefault, TRUE, 1, map); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipCreateImageAttributes(&imageattr); expect(Ok, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, NULL); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeCount, TRUE, 1, map); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeAny, TRUE, 1, map); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 0, map); - todo_wine expect(InvalidParameter, stat); + expect(InvalidParameter, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, FALSE, 0, NULL); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, map); - todo_wine expect(Ok, stat); + expect(Ok, stat);
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1); expect(Ok, stat);