Skip to content

Commit

Permalink
Fix the compilation errors in the demo and resolve the issue of the p…
Browse files Browse the repository at this point in the history
…lusdarker program failing to compile in WebGL.
  • Loading branch information
Hparty committed Oct 29, 2024
1 parent 624fb1f commit b8d02a8
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion include/tgfx/layers/ImageLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#pragma once

#include "layers/contents/ImageContent.h"
#include "tgfx/core/Image.h"
#include "tgfx/layers/Layer.h"

Expand Down
1 change: 0 additions & 1 deletion include/tgfx/layers/Layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#pragma once

#include <memory>
#include "core/utils/UniqueID.h"
#include "tgfx/core/BlendMode.h"
#include "tgfx/core/Canvas.h"
#include "tgfx/core/ImageFilter.h"
Expand Down
4 changes: 2 additions & 2 deletions src/gpu/opengl/GLBlend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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);
fsBuilder->codeAppendf("%s.rgb *= (%s.a > 0.0) ? 1.0 : 0.0;", outputColor, outputColor);
}

using BlendHandler = void (*)(FragmentShaderBuilder* fsBuilder, const char* srcColor,
Expand Down
1 change: 1 addition & 0 deletions src/layers/ImageLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
//
/////////////////////////////////////////////////////////////////////////////////////////////////

#include "layers/contents/ImageContent.h"
#include "tgfx/layers/ImageLayer.h"

namespace tgfx {
Expand Down

0 comments on commit b8d02a8

Please sign in to comment.