[PATCH v28 0/1] MR4661: Draft: gdiplus: Implement Gdiplus effects
Implement few effect related functions in Gdiplus. -- v28: https://gitlab.winehq.org/wine/wine/-/merge_requests/4661
From: Vijay Kiran Kamuju <infyquest(a)gmail.com> --- dlls/gdiplus/gdiplus_private.h | 19 +++++++++ dlls/gdiplus/image.c | 71 ++++++++++++++++++++++++++++++---- dlls/gdiplus/tests/image.c | 7 ++-- 3 files changed, 86 insertions(+), 11 deletions(-) diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index 2b5dbee43e9..778a2ef5298 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -368,6 +368,25 @@ struct GpAdjustableArrowCap{ REAL width; }; +typedef enum EffectType { + NoneEffect, + BlurEffect, + SharpenEffect, + TintEffect, + RedEyeCorrectionEffect, + ColorMatrixEffect, + ColorLUTEffect, + BrightnessContrastEffect, + HueSaturationLightnessEffect, + ColorBalanceEffect, + LevelsEffect, + ColorCurveEffect, +} EffectType; + +typedef struct CGpEffect{ + EffectType type; +} CGpEffect; + struct GpImage{ IWICBitmapDecoder *decoder; IWICBitmapEncoder *encoder; diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c index 806da0cb696..47f7e92195f 100644 --- a/dlls/gdiplus/image.c +++ b/dlls/gdiplus/image.c @@ -5576,14 +5576,69 @@ 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; + EffectType type; - if(!effect) + TRACE("(%s, %p)\n", debugstr_guid(&guid), effect); + + if (!effect) return InvalidParameter; - *effect = NULL; + if (IsEqualGUID(&guid, &BlurEffectGuid)) + { + type = BlurEffect; + } + else if (IsEqualGUID(&guid, &SharpenEffectGuid)) + { + type = SharpenEffect; + } + else if (IsEqualGUID(&guid, &TintEffectGuid)) + { + type = TintEffect; + } + else if (IsEqualGUID(&guid, &RedEyeCorrectionEffectGuid)) + { + type = RedEyeCorrectionEffect; + } + else if (IsEqualGUID(&guid, &ColorMatrixEffectGuid)) + { + type = ColorMatrixEffect; + } + else if (IsEqualGUID(&guid, &ColorLUTEffectGuid)) + { + type = ColorLUTEffect; + } + else if (IsEqualGUID(&guid, &BrightnessContrastEffectGuid)) + { + type = BrightnessContrastEffect; + } + else if (IsEqualGUID(&guid, &HueSaturationLightnessEffectGuid)) + { + type = HueSaturationLightnessEffect; + } + else if (IsEqualGUID(&guid, &ColorBalanceEffectGuid)) + { + type = ColorBalanceEffect; + } + else if (IsEqualGUID(&guid, &LevelsEffectGuid)) + { + type = LevelsEffect; + } + else if (IsEqualGUID(&guid, &ColorCurveEffectGuid)) + { + type = ColorCurveEffect; + } + else + { + *effect = NULL; + return Win32Error; + } - return NotImplemented; + ef = malloc(sizeof(CGpEffect)); + ef->type = type; + *effect = ef; + + return Ok; } /***************************************************************************** @@ -5591,10 +5646,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..d0ca8f2e409 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -5408,7 +5408,7 @@ static void test_createeffect(void) GpStatus (WINAPI *pGdipCreateEffect)( const GUID guid, CGpEffect **effect); GpStatus (WINAPI *pGdipDeleteEffect)( CGpEffect *effect); GpStatus stat; - CGpEffect *effect; + CGpEffect *effect = NULL; HMODULE mod = GetModuleHandleA("gdiplus.dll"); int i; const GUID * const effectlist[] = @@ -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); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4661
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 full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=149295 Your paranoid android. === build (build log) === error: patch failed: dlls/gdiplus/image.c:5591 error: patch failed: dlls/gdiplus/tests/image.c:5408 Task: Patch failed to apply === debian11 (build log) === error: patch failed: dlls/gdiplus/image.c:5591 error: patch failed: dlls/gdiplus/tests/image.c:5408 Task: Patch failed to apply === debian11b (build log) === error: patch failed: dlls/gdiplus/image.c:5591 error: patch failed: dlls/gdiplus/tests/image.c:5408 Task: Patch failed to apply
participants (3)
-
Marvin -
Vijay Kiran Kamuju -
Vijay Kiran Kamuju (@infyquest)