gdiplus: Implement GdipSetImageAttributesNoOp.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ef5a3ffe51
commit
ab31b59f45
|
@ -481,6 +481,12 @@ struct color_remap_table{
|
|||
ColorMap *colormap;
|
||||
};
|
||||
|
||||
enum imageattr_noop{
|
||||
IMAGEATTR_NOOP_UNDEFINED,
|
||||
IMAGEATTR_NOOP_SET,
|
||||
IMAGEATTR_NOOP_CLEAR,
|
||||
};
|
||||
|
||||
struct GpImageAttributes{
|
||||
WrapMode wrap;
|
||||
ARGB outside_color;
|
||||
|
@ -490,6 +496,7 @@ struct GpImageAttributes{
|
|||
struct color_remap_table colorremaptables[ColorAdjustTypeCount];
|
||||
BOOL gamma_enabled[ColorAdjustTypeCount];
|
||||
REAL gamma[ColorAdjustTypeCount];
|
||||
enum imageattr_noop noop[ColorAdjustTypeCount];
|
||||
};
|
||||
|
||||
struct GpFont{
|
||||
|
|
|
@ -676,6 +676,11 @@ PixelFormat apply_image_attributes(const GpImageAttributes *attributes, LPBYTE d
|
|||
UINT x, y;
|
||||
INT i;
|
||||
|
||||
if ((attributes->noop[type] == IMAGEATTR_NOOP_UNDEFINED &&
|
||||
attributes->noop[ColorAdjustTypeDefault] == IMAGEATTR_NOOP_SET) ||
|
||||
(attributes->noop[type] == IMAGEATTR_NOOP_SET))
|
||||
return fmt;
|
||||
|
||||
if (attributes->colorkeys[type].enabled ||
|
||||
attributes->colorkeys[ColorAdjustTypeDefault].enabled)
|
||||
{
|
||||
|
|
|
@ -218,14 +218,14 @@ GpStatus WINGDIPAPI GdipSetImageAttributesGamma(GpImageAttributes *imageAttr,
|
|||
GpStatus WINGDIPAPI GdipSetImageAttributesNoOp(GpImageAttributes *imageAttr,
|
||||
ColorAdjustType type, BOOL enableFlag)
|
||||
{
|
||||
static int calls;
|
||||
|
||||
TRACE("(%p,%u,%i)\n", imageAttr, type, enableFlag);
|
||||
|
||||
if(!(calls++))
|
||||
FIXME("not implemented\n");
|
||||
if (type >= ColorAdjustTypeCount)
|
||||
return InvalidParameter;
|
||||
|
||||
return NotImplemented;
|
||||
imageAttr->noop[type] = enableFlag ? IMAGEATTR_NOOP_SET : IMAGEATTR_NOOP_CLEAR;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetImageAttributesOutputChannel(GpImageAttributes *imageAttr,
|
||||
|
@ -332,6 +332,7 @@ GpStatus WINGDIPAPI GdipResetImageAttributes(GpImageAttributes *imageAttr,
|
|||
GdipSetImageAttributesColorKeys(imageAttr, type, FALSE, 0, 0);
|
||||
GdipSetImageAttributesRemapTable(imageAttr, type, FALSE, 0, NULL);
|
||||
GdipSetImageAttributesGamma(imageAttr, type, FALSE, 0.0);
|
||||
imageAttr->noop[type] = IMAGEATTR_NOOP_UNDEFINED;
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
|
|
@ -2374,10 +2374,44 @@ static void test_colormatrix(void)
|
|||
expect(Ok, stat);
|
||||
ok(color_match(0xeeff40cc, color, 3), "expected 0xeeff40cc, got 0x%08x\n", color);
|
||||
|
||||
/* Toggle NoOp */
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, FALSE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xfefe40cc, color, 3), "expected 0xfefe40cc, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, TRUE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, FALSE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
|
@ -2385,6 +2419,101 @@ static void test_colormatrix(void)
|
|||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 1), "Expected ff40ccee, got %.8x\n", color);
|
||||
|
||||
/* Disable adjustment, toggle NoOp */
|
||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||
FALSE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, FALSE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, TRUE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
|
||||
|
||||
/* Reset with NoOp on, enable adjustment. */
|
||||
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
||||
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xfff24ace, color, 3), "expected 0xfff24ace, got 0x%08x\n", color);
|
||||
|
||||
/* Now inhibit specific category. */
|
||||
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeDefault);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeBitmap,
|
||||
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xfffe41cc, color, 3), "expected 0xfffe41cc, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeBitmap, TRUE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeBitmap, FALSE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipSetImageAttributesNoOp(imageattr, ColorAdjustTypeDefault, TRUE);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xfff24ace, color, 3), "expected 0xfff24ace, got 0x%08x\n", color);
|
||||
|
||||
stat = GdipResetImageAttributes(imageattr, ColorAdjustTypeBitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImageRectRectI(graphics, (GpImage *)bitmap1, 0, 0, 1, 1, 0, 0, 1, 1,
|
||||
UnitPixel, imageattr, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
ok(color_match(0xff40ccee, color, 3), "expected 0xff40ccee, got 0x%08x\n", color);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
GdipDisposeImage((GpImage*)bitmap1);
|
||||
GdipDisposeImage((GpImage*)bitmap2);
|
||||
|
|
Loading…
Reference in New Issue