mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-08 07:35:29 +00:00
Revert "gl_engine: --unused code"
This reverts commit d8c06add22
.
drop shadow has been broken...
This commit is contained in:
parent
c216805a87
commit
53680eae2f
3 changed files with 9 additions and 2 deletions
|
@ -161,7 +161,9 @@ struct GlCompositor : RenderCompositor
|
||||||
GlCompositor(const RenderRegion& box) : bbox(box) {}
|
GlCompositor(const RenderRegion& box) : bbox(box) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define GL_GAUSSIAN_MAX_LEVEL 3
|
||||||
struct GlGaussianBlur {
|
struct GlGaussianBlur {
|
||||||
|
int level{};
|
||||||
float sigma{};
|
float sigma{};
|
||||||
float scale{};
|
float scale{};
|
||||||
float extend{};
|
float extend{};
|
||||||
|
|
|
@ -953,6 +953,7 @@ void GlRenderer::effectGaussianBlurUpdate(RenderEffectGaussianBlur* effect, cons
|
||||||
blur->sigma = effect->sigma;
|
blur->sigma = effect->sigma;
|
||||||
blur->scale = std::sqrt(transform.e11 * transform.e11 + transform.e12 * transform.e12);
|
blur->scale = std::sqrt(transform.e11 * transform.e11 + transform.e12 * transform.e12);
|
||||||
blur->extend = 2 * blur->sigma * blur->scale;
|
blur->extend = 2 * blur->sigma * blur->scale;
|
||||||
|
blur->level = int(GL_GAUSSIAN_MAX_LEVEL * ((effect->quality - 1) * 0.01f)) + 1;
|
||||||
effect->rd = blur;
|
effect->rd = blur;
|
||||||
effect->valid = (blur->extend > 0);
|
effect->valid = (blur->extend > 0);
|
||||||
}
|
}
|
||||||
|
@ -971,6 +972,7 @@ void GlRenderer::effectDropShadowUpdate(RenderEffectDropShadow* effect, const Ma
|
||||||
};
|
};
|
||||||
dropShadow->sigma = sigma;
|
dropShadow->sigma = sigma;
|
||||||
dropShadow->scale = scale;
|
dropShadow->scale = scale;
|
||||||
|
dropShadow->level = int(GL_GAUSSIAN_MAX_LEVEL * ((effect->quality - 1) * 0.01f)) + 1;
|
||||||
dropShadow->color[3] = effect->color[3] / 255.0f;
|
dropShadow->color[3] = effect->color[3] / 255.0f;
|
||||||
//Drop shadow effect applies blending in the shader (GL_BLEND disabled), so the color should be premultiplied:
|
//Drop shadow effect applies blending in the shader (GL_BLEND disabled), so the color should be premultiplied:
|
||||||
dropShadow->color[0] = effect->color[0] / 255.0f * dropShadow->color[3];
|
dropShadow->color[0] = effect->color[0] / 255.0f * dropShadow->color[3];
|
||||||
|
@ -1186,8 +1188,8 @@ bool GlRenderer::render(TVG_UNUSED RenderCompositor* cmp, const RenderEffect* ef
|
||||||
task->setDrawRange(ioffset, 6);
|
task->setDrawRange(ioffset, 6);
|
||||||
// add task to render pipeline
|
// add task to render pipeline
|
||||||
pass->addRenderTask(task);
|
pass->addRenderTask(task);
|
||||||
} else return false;
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -740,6 +740,7 @@ void main()
|
||||||
const char* GAUSSIAN_VERTICAL = R"(
|
const char* GAUSSIAN_VERTICAL = R"(
|
||||||
uniform sampler2D uSrcTexture;
|
uniform sampler2D uSrcTexture;
|
||||||
layout(std140) uniform Gaussian {
|
layout(std140) uniform Gaussian {
|
||||||
|
int level;
|
||||||
float sigma;
|
float sigma;
|
||||||
float scale;
|
float scale;
|
||||||
float extend;
|
float extend;
|
||||||
|
@ -775,6 +776,7 @@ void main()
|
||||||
const char* GAUSSIAN_HORIZONTAL = R"(
|
const char* GAUSSIAN_HORIZONTAL = R"(
|
||||||
uniform sampler2D uSrcTexture;
|
uniform sampler2D uSrcTexture;
|
||||||
layout(std140) uniform Gaussian {
|
layout(std140) uniform Gaussian {
|
||||||
|
int level;
|
||||||
float sigma;
|
float sigma;
|
||||||
float scale;
|
float scale;
|
||||||
float extend;
|
float extend;
|
||||||
|
@ -811,6 +813,7 @@ const char* EFFECT_DROPSHADOW = R"(
|
||||||
uniform sampler2D uSrcTexture;
|
uniform sampler2D uSrcTexture;
|
||||||
uniform sampler2D uBlrTexture;
|
uniform sampler2D uBlrTexture;
|
||||||
layout(std140) uniform DropShadow {
|
layout(std140) uniform DropShadow {
|
||||||
|
int level;
|
||||||
float sigma;
|
float sigma;
|
||||||
float scale;
|
float scale;
|
||||||
float extend;
|
float extend;
|
||||||
|
|
Loading…
Add table
Reference in a new issue