Implement few effect related functions in Gdiplus.
-- v14: https://gitlab.winehq.org/wine/wine/-/merge_requests/4661
From: Vijay Kiran Kamuju infyquest@gmail.com
--- include/gdipluscolormatrix.h | 1 + include/gdipluseffects.h | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+)
diff --git a/include/gdipluscolormatrix.h b/include/gdipluscolormatrix.h index 44016ff3451..391095ed8fb 100644 --- a/include/gdipluscolormatrix.h +++ b/include/gdipluscolormatrix.h @@ -62,6 +62,7 @@ enum HistogramFormat
#ifndef __cplusplus
+typedef BYTE ColorChannelLUT[256]; typedef enum ColorAdjustType ColorAdjustType; typedef enum ColorMatrixFlags ColorMatrixFlags; typedef enum HistogramFormat HistogramFormat; diff --git a/include/gdipluseffects.h b/include/gdipluseffects.h index d2d6a0500da..4100647f7a1 100644 --- a/include/gdipluseffects.h +++ b/include/gdipluseffects.h @@ -31,6 +31,80 @@ DEFINE_GUID(ColorBalanceEffectGuid, 0x537e597d, 0x251e, 0x48da, 0x96, DEFINE_GUID(RedEyeCorrectionEffectGuid, 0x74d29d05, 0x69a4, 0x4266, 0x95, 0x49, 0x3c, 0xc5, 0x28, 0x36, 0xb6, 0x32); DEFINE_GUID(ColorCurveEffectGuid, 0xdd6a0022, 0x58e4, 0x4a67, 0x9d, 0x9b, 0xd4, 0x8e, 0xb8, 0x81, 0xa5, 0x3d);
+struct BlurParams { + float radius; + BOOL expandEdge; +}; + +struct SharpenParams { + float radius; + float amount; +}; + +struct TintParams { + INT hue; + INT amount; +}; + +struct RedEyeCorrectionParams { + UINT numberOfAreas; + RECT *areas; +}; + +struct ColorLUTParams { + ColorChannelLUT lutB; + ColorChannelLUT lutG; + ColorChannelLUT lutR; + ColorChannelLUT lutA; +}; + +struct BrightnessContrastParams { + INT brightnessLevel; + INT contrastLevel; +}; + +struct HueSaturationLightnessParams { + INT hueLevel; + INT saturationLevel; + INT lightnessLevel; +}; + +struct ColorBalanceParams { + INT cyanRed; + INT magentaGreen; + INT yellowBlue; +}; + +struct LevelsParams { + INT highlight; + INT midtone; + INT shadow; +}; + +typedef enum CurveAdjustments { + AdjustExposure, + AdjustDensity, + AdjustContrast, + AdjustHighlight, + AdjustShadow, + AdjustMidtone, + AdjustWhiteSaturation, + AdjustBlackSaturation +} CurveAdjustments; + +typedef enum CurveChannel { + CurveChannelAll, + CurveChannelRed, + CurveChannelGreen, + CurveChannelBlue +} CurveChannel; + +struct ColorCurveParams { + CurveAdjustments adjustment; + CurveChannel channel; + INT adjustValue; +}; + #ifdef __cplusplus extern "C" { #endif
From: Vijay Kiran Kamuju infyquest@gmail.com
--- dlls/gdiplus/gdiplus_private.h | 21 +++++++++ dlls/gdiplus/image.c | 81 ++++++++++++++++++++++++++++++---- dlls/gdiplus/tests/image.c | 5 ++- 3 files changed, 97 insertions(+), 10 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 6f7e72124c2..44d3e6d1000 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -368,6 +368,27 @@ struct GpAdjustableArrowCap{ REAL width; };
+typedef enum EffectType { + NoneEffect, + BlurEffect, + SharpenEffect, + TintEffect, + RedEyeCorrectionEffect, + ColorMatrixEffect, + ColorLUTEffect, + BrightnessContrastEffect, + HueSaturationLightnessEffect, + ColorBalanceEffect, + LevelsEffect, + ColorCurveEffect, +} EffectType; + +typedef struct CGpEffect{ + INT datasize; + void *data; + EffectType type; +} CGpEffect; + struct GpImage{ IWICBitmapDecoder *decoder; IWICBitmapEncoder *encoder; diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 806da0cb696..75f9856c6dd 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -5576,14 +5576,79 @@ GpStatus WINGDIPAPI GdipCreateBitmapFromHBITMAP(HBITMAP hbm, HPALETTE hpal, GpBi */ GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect) { - FIXME("(%s, %p): stub\n", debugstr_guid(&guid), effect); + CGpEffect *ef = NULL;
- if(!effect) + TRACE("(%s, %p)\n", debugstr_guid(&guid), effect); + + if (!effect) return InvalidParameter;
- *effect = NULL; + if (IsEqualGUID(&guid, &BlurEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = BlurEffect; + } + else if (IsEqualGUID(&guid, &SharpenEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = SharpenEffect; + } + else if (IsEqualGUID(&guid, &TintEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = TintEffect; + } + else if (IsEqualGUID(&guid, &RedEyeCorrectionEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = RedEyeCorrectionEffect; + } + else if (IsEqualGUID(&guid, &ColorMatrixEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = ColorMatrixEffect; + } + else if (IsEqualGUID(&guid, &ColorLUTEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = ColorLUTEffect; + } + else if (IsEqualGUID(&guid, &BrightnessContrastEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = BrightnessContrastEffect; + } + else if (IsEqualGUID(&guid, &HueSaturationLightnessEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = HueSaturationLightnessEffect; + } + else if (IsEqualGUID(&guid, &ColorBalanceEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = ColorBalanceEffect; + } + else if (IsEqualGUID(&guid, &LevelsEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = LevelsEffect; + } + else if (IsEqualGUID(&guid, &ColorCurveEffectGuid)) + { + ef = malloc(sizeof(CGpEffect)); + ef->type = ColorCurveEffect; + } + else + { + *effect = NULL; + return Win32Error; + }
- return NotImplemented; + ef->datasize = 0; + ef->data = NULL; + *effect = ef; + + return Ok; }
/***************************************************************************** @@ -5591,10 +5656,10 @@ GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect) */ GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect) { - FIXME("(%p): stub\n", effect); - /* note: According to Jose Roca's GDI+ Docs, this is not implemented - * in Windows's gdiplus */ - return NotImplemented; + TRACE("(%p)\n", effect); + + free(effect); + return Ok; }
/***************************************************************************** diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 8fc9aa78225..2b356635ce6 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5429,12 +5429,13 @@ static void test_createeffect(void) expect(InvalidParameter, stat);
stat = pGdipCreateEffect(noneffect, &effect); - todo_wine expect(Win32Error, stat); + expect(Win32Error, stat); + ok(effect == NULL, "Expected effect to be NULL\n");
for(i=0; i < ARRAY_SIZE(effectlist); i++) { stat = pGdipCreateEffect(*effectlist[i], &effect); - todo_wine expect(Ok, stat); + expect(Ok, stat); if(stat == Ok) { stat = pGdipDeleteEffect(effect);
From: Vijay Kiran Kamuju infyquest@gmail.com
--- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/image.c | 57 ++++++++++++++++++++++++++++++++++++++ dlls/gdiplus/tests/image.c | 50 +++++++++++++++++++++++++++++---- include/gdipluseffects.h | 1 + 4 files changed, 103 insertions(+), 7 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 178592e35d9..0f17bb02d4d 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -612,7 +612,7 @@ 612 stdcall GdipGetImageItemData(ptr ptr) 613 stdcall GdipCreateEffect(int128 ptr) 614 stdcall GdipDeleteEffect(ptr) -615 stub GdipGetEffectParameterSize +615 stdcall GdipGetEffectParameterSize(ptr ptr) 616 stub GdipGetEffectParameters 617 stdcall GdipSetEffectParameters(ptr ptr long) 618 stdcall GdipInitializePalette(ptr long long long ptr) diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 75f9856c6dd..44bc04d3005 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -5662,6 +5662,63 @@ GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect) return Ok; }
+/***************************************************************************** + * GdipGetEffectParameterSize [GDIPLUS.@] + */ +GpStatus WINGDIPAPI GdipGetEffectParameterSize(CGpEffect *effect, UINT *size) +{ + UINT sz = 0; + GpStatus status = Ok; + + TRACE("(%p %p)\n", effect, size); + + if (!effect || !size) + return InvalidParameter; + + switch (effect->type) + { + case BlurEffect: + sz = sizeof(struct BlurParams); + break; + case SharpenEffect: + sz = sizeof(struct SharpenParams); + break; + case TintEffect: + sz = sizeof(struct TintParams); + break; + case RedEyeCorrectionEffect: + sz = sizeof(struct RedEyeCorrectionParams); + break; + case ColorMatrixEffect: + sz = sizeof(ColorMatrix); + break; + case ColorLUTEffect: + sz = sizeof(struct ColorLUTParams); + break; + case BrightnessContrastEffect: + sz = sizeof(struct BrightnessContrastParams); + break; + case HueSaturationLightnessEffect: + sz = sizeof(struct HueSaturationLightnessParams); + break; + case ColorBalanceEffect: + sz = sizeof(struct ColorBalanceParams); + break; + case LevelsEffect: + sz = sizeof(struct LevelsParams); + break; + case ColorCurveEffect: + sz = sizeof(struct ColorCurveParams); + break; + default: + status = InvalidParameter; + break; + } + + *size = sz; + return status; +} + /***************************************************************************** * GdipSetEffectParameters [GDIPLUS.@] */ diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 2b356635ce6..12b7f0dbe3c 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5407,17 +5407,38 @@ static void test_createeffect(void) static const GUID noneffect = { 0xcd0c3d4b, 0xe15e, 0x4cf2, { 0x9e, 0xa8, 0x6e, 0x1d, 0x65, 0x48, 0xc5, 0xa5 } }; GpStatus (WINAPI *pGdipCreateEffect)( const GUID guid, CGpEffect **effect); GpStatus (WINAPI *pGdipDeleteEffect)( CGpEffect *effect); + GpStatus (WINAPI *pGdipGetEffectParameterSize)( CGpEffect *effect, UINT *size); GpStatus stat; CGpEffect *effect; + UINT size; HMODULE mod = GetModuleHandleA("gdiplus.dll"); int i; - const GUID * const effectlist[] = - {&BlurEffectGuid, &SharpenEffectGuid, &ColorMatrixEffectGuid, &ColorLUTEffectGuid, - &BrightnessContrastEffectGuid, &HueSaturationLightnessEffectGuid, &LevelsEffectGuid, - &TintEffectGuid, &ColorBalanceEffectGuid, &RedEyeCorrectionEffectGuid, &ColorCurveEffectGuid}; + + static const struct test_data { + const GUID *guid; + UINT size; + } td[] = + { + { &BlurEffectGuid, 8 }, + { &SharpenEffectGuid, 8 }, + { &ColorMatrixEffectGuid, 100 }, + { &ColorLUTEffectGuid, 1024 }, + { &BrightnessContrastEffectGuid, 8 }, + { &HueSaturationLightnessEffectGuid, 12 }, + { &LevelsEffectGuid, 12 }, + { &TintEffectGuid, 8 }, + { &ColorBalanceEffectGuid, 12 }, +#ifdef _WIN64 + { &RedEyeCorrectionEffectGuid, 16 }, +#else + { &RedEyeCorrectionEffectGuid, 8 }, +#endif + { &ColorCurveEffectGuid, 12 } + };
pGdipCreateEffect = (void*)GetProcAddress( mod, "GdipCreateEffect"); pGdipDeleteEffect = (void*)GetProcAddress( mod, "GdipDeleteEffect"); + pGdipGetEffectParameterSize = (void*)GetProcAddress( mod, "GdipGetEffectParameterSize"); if(!pGdipCreateEffect || !pGdipDeleteEffect) { /* GdipCreateEffect/GdipDeleteEffect was introduced in Windows Vista. */ @@ -5428,16 +5449,33 @@ static void test_createeffect(void) stat = pGdipCreateEffect(BlurEffectGuid, NULL); expect(InvalidParameter, stat);
+ stat = pGdipGetEffectParameterSize(NULL, NULL); + expect(InvalidParameter, stat); + + stat = pGdipGetEffectParameterSize(effect, NULL); + expect(InvalidParameter, stat); + stat = pGdipCreateEffect(noneffect, &effect); expect(Win32Error, stat); ok(effect == NULL, "Expected effect to be NULL\n");
- for(i=0; i < ARRAY_SIZE(effectlist); i++) + size = 0; + stat = pGdipGetEffectParameterSize(effect, &size); + expect(InvalidParameter, stat); + expect(0, size); + + for(i=0; i < ARRAY_SIZE(td); i++) { - stat = pGdipCreateEffect(*effectlist[i], &effect); + stat = pGdipCreateEffect(*td[i].guid, &effect); expect(Ok, stat); + if(stat == Ok) { + size = 0; + stat = pGdipGetEffectParameterSize(effect, &size); + expect(Ok, stat); + expect(td[i].size, size); + stat = pGdipDeleteEffect(effect); expect(Ok, stat); } diff --git a/include/gdipluseffects.h b/include/gdipluseffects.h index 4100647f7a1..a58d25cb0e3 100644 --- a/include/gdipluseffects.h +++ b/include/gdipluseffects.h @@ -111,6 +111,7 @@ extern "C" {
GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect); GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect); +GpStatus WINGDIPAPI GdipGetEffectParameterSize(CGpEffect *effect, UINT *size);
#ifdef __cplusplus }
From: Vijay Kiran Kamuju infyquest@gmail.com
--- dlls/gdiplus/gdiplus_private.h | 13 +++++ dlls/gdiplus/image.c | 101 ++++++++++++++++++++++++++++++-- dlls/gdiplus/tests/image.c | 104 ++++++++++++++++++++++++++++----- include/gdipluseffects.h | 1 + 4 files changed, 201 insertions(+), 18 deletions(-)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 44d3e6d1000..6325ab40aa0 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -386,6 +386,19 @@ typedef enum EffectType { typedef struct CGpEffect{ INT datasize; void *data; + union params { + struct BlurParams *blurparams; + struct SharpenParams *sharpenparams; + struct TintParams *tintparams; + struct RedEyeCorrectionParams *redeyeparams; + ColorMatrix *clrmatrixparams; + struct ColorLUTParams *clrlutparams; + struct BrightnessContrastParams *brtcntrstparams; + struct HueSaturationLightnessParams *huesatliteparams; + struct ColorBalanceParams *clrbalanceparams; + struct LevelsParams *levelsparams; + struct ColorCurveParams *clrcurveparams; + } p; EffectType type; } CGpEffect;
diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 44bc04d3005..3c0e9aafb72 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -5587,56 +5587,67 @@ GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect) { ef = malloc(sizeof(CGpEffect)); ef->type = BlurEffect; + ef->p.blurparams = NULL; } else if (IsEqualGUID(&guid, &SharpenEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = SharpenEffect; + ef->p.sharpenparams = NULL; } else if (IsEqualGUID(&guid, &TintEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = TintEffect; + ef->p.tintparams = NULL; } else if (IsEqualGUID(&guid, &RedEyeCorrectionEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = RedEyeCorrectionEffect; + ef->p.redeyeparams = NULL; } else if (IsEqualGUID(&guid, &ColorMatrixEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = ColorMatrixEffect; + ef->p.clrmatrixparams = NULL; } else if (IsEqualGUID(&guid, &ColorLUTEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = ColorLUTEffect; + ef->p.clrlutparams = NULL; } else if (IsEqualGUID(&guid, &BrightnessContrastEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = BrightnessContrastEffect; + ef->p.brtcntrstparams = NULL; } else if (IsEqualGUID(&guid, &HueSaturationLightnessEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = HueSaturationLightnessEffect; + ef->p.huesatliteparams = NULL; } else if (IsEqualGUID(&guid, &ColorBalanceEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = ColorBalanceEffect; + ef->p.clrbalanceparams = NULL; } else if (IsEqualGUID(&guid, &LevelsEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = LevelsEffect; + ef->p.levelsparams = NULL; } else if (IsEqualGUID(&guid, &ColorCurveEffectGuid)) { ef = malloc(sizeof(CGpEffect)); ef->type = ColorCurveEffect; + ef->p.clrcurveparams = NULL; } else { @@ -5688,6 +5699,8 @@ GpStatus WINGDIPAPI GdipGetEffectParameterSize(CGpEffect *effect, UINT *size) break; case RedEyeCorrectionEffect: sz = sizeof(struct RedEyeCorrectionParams); + if (effect->p.redeyeparams) + sz += effect->p.redeyeparams->numberOfAreas*sizeof(RECT); break; case ColorMatrixEffect: sz = sizeof(ColorMatrix); @@ -5714,8 +5727,8 @@ GpStatus WINGDIPAPI GdipGetEffectParameterSize(CGpEffect *effect, UINT *size) status = InvalidParameter; break; } - *size = sz; + return status; }
@@ -5725,14 +5738,92 @@ GpStatus WINGDIPAPI GdipGetEffectParameterSize(CGpEffect *effect, UINT *size) GpStatus WINGDIPAPI GdipSetEffectParameters(CGpEffect *effect, const VOID *params, const UINT size) { - static int calls; + UINT paramsize = 0, num = 0;
TRACE("(%p,%p,%u)\n", effect, params, size);
- if(!(calls++)) - FIXME("not implemented\n"); + if (!effect || !params || !size) + return InvalidParameter;
- return NotImplemented; + if (GdipGetEffectParameterSize(effect, ¶msize) != Ok) + return InvalidParameter; + + switch (effect->type) + { + case BlurEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.blurparams = malloc(size); + memcpy(effect->p.blurparams, params, size); + break; + case SharpenEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.sharpenparams = malloc(size); + memcpy(effect->p.sharpenparams, params, size); + break; + case TintEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.tintparams = malloc(size); + memcpy(effect->p.tintparams, params, size); + break; + case RedEyeCorrectionEffect: + if ((paramsize-size > 0) || (((size-paramsize)%sizeof(RECT)) != 0)) + return InvalidParameter; + effect->p.redeyeparams = malloc(paramsize); + num = (size-paramsize)/sizeof(RECT); + effect->p.redeyeparams->numberOfAreas = num; + effect->p.redeyeparams->areas = malloc(num*sizeof(RECT)); + memcpy(effect->p.redeyeparams->areas, ((struct RedEyeCorrectionParams *)params)->areas, num*sizeof(RECT)); + break; + case ColorMatrixEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.clrmatrixparams = malloc(size); + memcpy(effect->p.clrmatrixparams, params, size); + break; + case ColorLUTEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.clrlutparams = malloc(size); + memcpy(effect->p.clrlutparams, params, size); + break; + case BrightnessContrastEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.brtcntrstparams = malloc(size); + memcpy(effect->p.brtcntrstparams, params, size); + break; + case HueSaturationLightnessEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.huesatliteparams = malloc(size); + memcpy(effect->p.huesatliteparams, params, size); + break; + case ColorBalanceEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.clrbalanceparams = malloc(size); + memcpy(effect->p.clrbalanceparams, params, size); + break; + case LevelsEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.levelsparams = malloc(size); + memcpy(effect->p.levelsparams, params, size); + break; + case ColorCurveEffect: + if (paramsize != size) + return InvalidParameter; + effect->p.clrcurveparams = malloc(size); + memcpy(effect->p.clrcurveparams, params, size); + break; + default: + return InvalidParameter; + } + + return Ok; }
/***************************************************************************** diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index 12b7f0dbe3c..1f7a8226d10 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5408,37 +5408,96 @@ static void test_createeffect(void) GpStatus (WINAPI *pGdipCreateEffect)( const GUID guid, CGpEffect **effect); GpStatus (WINAPI *pGdipDeleteEffect)( CGpEffect *effect); GpStatus (WINAPI *pGdipGetEffectParameterSize)( CGpEffect *effect, UINT *size); + GpStatus (WINAPI *pGdipSetEffectParameters)( CGpEffect *effect, const VOID *params, const UINT size); GpStatus stat; CGpEffect *effect; UINT size; + void *params = NULL; HMODULE mod = GetModuleHandleA("gdiplus.dll"); int i;
- static const struct test_data { + RECT rects[2] = { { 0, 0, 75, 75 }, { -32, -32, 32, 32 } }; + struct BlurParams blur = { 2.0, TRUE }; + struct SharpenParams sharpen = { 5.0, 2 }; + ColorMatrix matrix = + { + { + { 1.0, 1.0, 1.0, 1.0, 1.0 }, + { 2.0, 2.0, 2.0, 2.0, 2.0 }, + { 3.0, 3.0, 3.0, 3.0, 3.0 }, + { 4.0, 4.0, 4.0, 4.0, 4.0 }, + { 5.0, 5.0, 5.0, 5.0, 5.0 } + } + }; + struct ColorLUTParams lut = + { + { 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7 }, + { 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, + 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11,11, + 12,12,12,12,12,12,12,12,13,13,13,13,13,13,13,13,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15 }, + { 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3, + 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3 }, + { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } + }; + struct BrightnessContrastParams bc = { 75, 50 }; + struct HueSaturationLightnessParams hsl = { 50, 50, 50 }; + struct LevelsParams lvl = { 50, 50, 5 }; + struct TintParams tint = { 20, 5 }; + struct ColorBalanceParams cbal = { 50, 50, 50 }; + struct ColorCurveParams ccurve = { AdjustExposure, CurveChannelAll, 5 }; + struct RedEyeCorrectionParams redi = { 2, rects }; + const struct test_data { const GUID *guid; UINT size; + void *params; } td[] = { - { &BlurEffectGuid, 8 }, - { &SharpenEffectGuid, 8 }, - { &ColorMatrixEffectGuid, 100 }, - { &ColorLUTEffectGuid, 1024 }, - { &BrightnessContrastEffectGuid, 8 }, - { &HueSaturationLightnessEffectGuid, 12 }, - { &LevelsEffectGuid, 12 }, - { &TintEffectGuid, 8 }, - { &ColorBalanceEffectGuid, 12 }, + { &BlurEffectGuid, 8, &blur }, + { &SharpenEffectGuid, 8, &sharpen }, + { &ColorMatrixEffectGuid, 100, &matrix }, + { &ColorLUTEffectGuid, 1024, &lut }, + { &BrightnessContrastEffectGuid, 8, &bc }, + { &HueSaturationLightnessEffectGuid, 12, &hsl }, + { &LevelsEffectGuid, 12, &lvl }, + { &TintEffectGuid, 8, &tint }, + { &ColorBalanceEffectGuid, 12, &cbal }, #ifdef _WIN64 - { &RedEyeCorrectionEffectGuid, 16 }, + { &RedEyeCorrectionEffectGuid, 16, &redi }, #else - { &RedEyeCorrectionEffectGuid, 8 }, + { &RedEyeCorrectionEffectGuid, 8, &redi }, #endif - { &ColorCurveEffectGuid, 12 } + { &ColorCurveEffectGuid, 12, &ccurve } };
pGdipCreateEffect = (void*)GetProcAddress( mod, "GdipCreateEffect"); pGdipDeleteEffect = (void*)GetProcAddress( mod, "GdipDeleteEffect"); pGdipGetEffectParameterSize = (void*)GetProcAddress( mod, "GdipGetEffectParameterSize"); + pGdipSetEffectParameters = (void*)GetProcAddress( mod, "GdipSetEffectParameters"); if(!pGdipCreateEffect || !pGdipDeleteEffect) { /* GdipCreateEffect/GdipDeleteEffect was introduced in Windows Vista. */ @@ -5452,9 +5511,15 @@ static void test_createeffect(void) stat = pGdipGetEffectParameterSize(NULL, NULL); expect(InvalidParameter, stat);
+ stat = pGdipSetEffectParameters(NULL, NULL, 0); + expect(InvalidParameter, stat); + stat = pGdipGetEffectParameterSize(effect, NULL); expect(InvalidParameter, stat);
+ stat = pGdipSetEffectParameters(effect, params, 0); + expect(InvalidParameter, stat); + stat = pGdipCreateEffect(noneffect, &effect); expect(Win32Error, stat); ok(effect == NULL, "Expected effect to be NULL\n"); @@ -5464,6 +5529,13 @@ static void test_createeffect(void) expect(InvalidParameter, stat); expect(0, size);
+ stat = pGdipSetEffectParameters(effect, (void *)0xdeadbeef, 0); + expect(InvalidParameter, stat); + stat = pGdipSetEffectParameters(effect, (void *)0xdeadbeef, 8); + expect(InvalidParameter, stat); + stat = pGdipSetEffectParameters(effect, (void *)0xdeadbeef, 5); + expect(InvalidParameter, stat); + for(i=0; i < ARRAY_SIZE(td); i++) { stat = pGdipCreateEffect(*td[i].guid, &effect); @@ -5476,6 +5548,12 @@ static void test_createeffect(void) expect(Ok, stat); expect(td[i].size, size);
+ stat = pGdipSetEffectParameters(effect, td[i].params, td[i].size); + expect(Ok, stat); + size = 0; + stat = pGdipGetEffectParameterSize(effect, &size); + expect(td[i].size, size); + stat = pGdipDeleteEffect(effect); expect(Ok, stat); } diff --git a/include/gdipluseffects.h b/include/gdipluseffects.h index a58d25cb0e3..2b94479f7f5 100644 --- a/include/gdipluseffects.h +++ b/include/gdipluseffects.h @@ -112,6 +112,7 @@ extern "C" { GpStatus WINGDIPAPI GdipCreateEffect(const GUID guid, CGpEffect **effect); GpStatus WINGDIPAPI GdipDeleteEffect(CGpEffect *effect); GpStatus WINGDIPAPI GdipGetEffectParameterSize(CGpEffect *effect, UINT *size); +GpStatus WINGDIPAPI GdipSetEffectParameters(CGpEffect *effect, const VOID *params, const UINT size);
#ifdef __cplusplus }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=142000
Your paranoid android.
=== w7u_2qxl (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w7u_adm (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w7u_el (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w8 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w8adm (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w864 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064v1507 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064v1809 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064_tsign (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w10pro64 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w10pro64_en_AE_u8 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w11pro64 (32 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w7pro64 (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w864 (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064v1507 (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064v1809 (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064_2qxl (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064_adm (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w1064_tsign (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w10pro64 (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w10pro64_ar (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w10pro64_ja (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w10pro64_zh_CN (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2
=== w11pro64_amd (64 bit report) ===
gdiplus: image.c:5552: Test failed: Expected 0, got 2