mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 20:14:37 +00:00
gl_engine: Fix gradient color not correct when shape has opacity
When rendering gradient color, needs to take opacity value into consider.
This commit is contained in:
parent
9e4037b4db
commit
7031d7fc50
1 changed files with 3 additions and 3 deletions
|
@ -342,7 +342,7 @@ void GlRenderer::drawPrimitive(GlShape& sdata, const Fill* fill, RenderUpdateFla
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
float alpha = 1.0f;
|
auto alpha = sdata.opacity / 255.f;
|
||||||
|
|
||||||
if (flag & RenderUpdateFlag::GradientStroke) {
|
if (flag & RenderUpdateFlag::GradientStroke) {
|
||||||
float strokeWidth = sdata.rshape->strokeWidth();
|
float strokeWidth = sdata.rshape->strokeWidth();
|
||||||
|
@ -401,7 +401,7 @@ void GlRenderer::drawPrimitive(GlShape& sdata, const Fill* fill, RenderUpdateFla
|
||||||
|
|
||||||
uint32_t nStops = 0;
|
uint32_t nStops = 0;
|
||||||
for (uint32_t i = 0; i < stopCnt; ++i) {
|
for (uint32_t i = 0; i < stopCnt; ++i) {
|
||||||
if (i > 0 && gradientBlock.stopPoints[nStops - 1] > stops[i].offset) continue;
|
if (i > 0 && gradientBlock.stopPoints[nStops - 1] > stops[i].offset) continue;
|
||||||
|
|
||||||
gradientBlock.stopPoints[i] = stops[i].offset;
|
gradientBlock.stopPoints[i] = stops[i].offset;
|
||||||
gradientBlock.stopColors[i * 4 + 0] = stops[i].r / 255.f;
|
gradientBlock.stopColors[i * 4 + 0] = stops[i].r / 255.f;
|
||||||
|
@ -419,7 +419,7 @@ void GlRenderer::drawPrimitive(GlShape& sdata, const Fill* fill, RenderUpdateFla
|
||||||
fx = P(radialFill)->fx;
|
fx = P(radialFill)->fx;
|
||||||
fy = P(radialFill)->fy;
|
fy = P(radialFill)->fy;
|
||||||
fr = P(radialFill)->fr;
|
fr = P(radialFill)->fr;
|
||||||
|
|
||||||
gradientBlock.centerPos[0] = fx;
|
gradientBlock.centerPos[0] = fx;
|
||||||
gradientBlock.centerPos[1] = fy;
|
gradientBlock.centerPos[1] = fy;
|
||||||
gradientBlock.centerPos[2] = x;
|
gradientBlock.centerPos[2] = x;
|
||||||
|
|
Loading…
Add table
Reference in a new issue