Vincent Povirk : gdiplus: Implement color remapping.
Alexandre Julliard
julliard at winehq.org
Fri Apr 16 10:56:02 CDT 2010
Module: wine
Branch: master
Commit: 424724778705069fd85d207518317cb2f778f275
URL: http://source.winehq.org/git/wine.git/?a=commit;h=424724778705069fd85d207518317cb2f778f275
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Thu Apr 15 15:24:25 2010 -0500
gdiplus: Implement color remapping.
---
dlls/gdiplus/graphics.c | 32 +++++++++++++++++++++++++++++++-
dlls/gdiplus/tests/image.c | 2 +-
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index b0cba47..8efa128 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1995,7 +1995,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
else
return NotImplemented;
- if (ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X)
+ if (imageAttributes ||
+ ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X)
use_software = 1;
else if (graphics->image && graphics->image->type == ImageTypeBitmap)
{
@@ -2084,6 +2085,35 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
GdipDeleteMatrix(dst_to_src);
+ if (imageAttributes)
+ {
+ if (imageAttributes->colorremaptables[ColorAdjustTypeBitmap].enabled ||
+ imageAttributes->colorremaptables[ColorAdjustTypeDefault].enabled)
+ {
+ const struct color_remap_table *table;
+
+ if (imageAttributes->colorremaptables[ColorAdjustTypeBitmap].enabled)
+ table = &imageAttributes->colorremaptables[ColorAdjustTypeBitmap];
+ else
+ table = &imageAttributes->colorremaptables[ColorAdjustTypeDefault];
+
+ for (x=dst_area.left; x<dst_area.right; x++)
+ for (y=dst_area.top; y<dst_area.bottom; y++)
+ {
+ ARGB *src_color;
+ src_color = (ARGB*)(data + stride * (y - dst_area.top) + sizeof(ARGB) * (x - dst_area.left));
+ for (i=0; i<table->mapsize; i++)
+ {
+ if (*src_color == table->colormap[i].oldColor.Argb)
+ {
+ *src_color = table->colormap[i].newColor.Argb;
+ break;
+ }
+ }
+ }
+ }
+ }
+
stat = alpha_blend_pixels(graphics, dst_area.left, dst_area.top,
data, dst_area.right - dst_area.left, dst_area.bottom - dst_area.top, stride);
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index fdfd2b2..74e6ee1 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -1879,7 +1879,7 @@ static void test_remaptable(void)
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
expect(Ok, stat);
- todo_wine ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
+ ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap1);
More information about the wine-cvs
mailing list