From 8cadf7d069b2ca7f31c7382812c83028c4d1acd9 Mon Sep 17 00:00:00 2001 From: Hparty <420024556@qq.com> Date: Wed, 30 Oct 2024 09:29:04 +0800 Subject: [PATCH] Fix the compilation errors in the demo and resolve the issue of the plusdarker program failing to compile in WebGL. (#286) --- include/tgfx/layers/ImageLayer.h | 1 - include/tgfx/layers/Layer.h | 1 - src/gpu/opengl/GLBlend.cpp | 6 +++--- src/layers/ImageLayer.cpp | 1 + test/baseline/version.json | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/tgfx/layers/ImageLayer.h b/include/tgfx/layers/ImageLayer.h index ac60e105..369692dc 100644 --- a/include/tgfx/layers/ImageLayer.h +++ b/include/tgfx/layers/ImageLayer.h @@ -18,7 +18,6 @@ #pragma once -#include "layers/contents/ImageContent.h" #include "tgfx/core/Image.h" #include "tgfx/layers/Layer.h" diff --git a/include/tgfx/layers/Layer.h b/include/tgfx/layers/Layer.h index 788e9251..9ee88f55 100644 --- a/include/tgfx/layers/Layer.h +++ b/include/tgfx/layers/Layer.h @@ -19,7 +19,6 @@ #pragma once #include -#include "core/utils/UniqueID.h" #include "tgfx/core/BlendMode.h" #include "tgfx/core/Canvas.h" #include "tgfx/core/ImageFilter.h" diff --git a/src/gpu/opengl/GLBlend.cpp b/src/gpu/opengl/GLBlend.cpp index 2e80fe31..f4e62c0b 100644 --- a/src/gpu/opengl/GLBlend.cpp +++ b/src/gpu/opengl/GLBlend.cpp @@ -315,9 +315,9 @@ static void BlendHandler_PlusDarker(FragmentShaderBuilder* fsBuilder, const char const char* dstColor, const char* outputColor) { // MAX(0, (1 - ((Da * (1 - Dc) + Sa * (1 - Sc))) // https://developer.apple.com/documentation/coregraphics/cgblendmode/kcgblendmodeplusdarker - fsBuilder->codeAppendf("%s.rgb = clamp(1.0 + %s.rgb + %s.rgb - %s.a - %s.a, 0, 1);", outputColor, - srcColor, dstColor, dstColor, srcColor); - fsBuilder->codeAppendf("%s.rgb *= (%s.a != 0.0) ? 1.0 : 0.0;", outputColor, outputColor); + fsBuilder->codeAppendf("%s.rgb = clamp(1.0 + %s.rgb + %s.rgb - %s.a - %s.a, 0.0, 1.0);", + outputColor, srcColor, dstColor, dstColor, srcColor); + fsBuilder->codeAppendf("%s.rgb *= (%s.a > 0.0) ? 1.0 : 0.0;", outputColor, outputColor); } using BlendHandler = void (*)(FragmentShaderBuilder* fsBuilder, const char* srcColor, diff --git a/src/layers/ImageLayer.cpp b/src/layers/ImageLayer.cpp index 0ce3f3af..460438bc 100644 --- a/src/layers/ImageLayer.cpp +++ b/src/layers/ImageLayer.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////////////////////// #include "tgfx/layers/ImageLayer.h" +#include "layers/contents/ImageContent.h" namespace tgfx { std::shared_ptr ImageLayer::Make() { diff --git a/test/baseline/version.json b/test/baseline/version.json index 5ed9a5dd..165e3c1a 100644 --- a/test/baseline/version.json +++ b/test/baseline/version.json @@ -6,7 +6,7 @@ "PictureImage": "8a2ac4d", "PictureImage_Path": "2212c4e", "PictureImage_Text": "2212c4e", - "blendMode": "43cd416", + "blendMode": "b3076a3", "drawImage": "8cb853c", "filter_mode_linear": "d010fb8", "filter_mode_nearest": "d010fb8",