mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 14:41:50 +00:00
sw_engine: fixing wrong 'if else' statement handling when gradient shapes rastered
The cases when composition was applied were handled only for AlphaMask and InvAlphaMask. When opacity value was to be < 255, there was no code to handle this.
This commit is contained in:
parent
d999a05750
commit
edaafd99b3
1 changed files with 40 additions and 33 deletions
|
@ -645,6 +645,7 @@ static bool _rasterOpaqueLinearGradientRect(SwSurface* surface, const SwBBox& re
|
||||||
buffer += surface->stride;
|
buffer += surface->stride;
|
||||||
cbuffer += surface->stride;
|
cbuffer += surface->stride;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} else if (method == CompositeMethod::InvAlphaMask) {
|
} else if (method == CompositeMethod::InvAlphaMask) {
|
||||||
for (uint32_t y = 0; y < h; ++y) {
|
for (uint32_t y = 0; y < h; ++y) {
|
||||||
fillFetchLinear(fill, sbuffer, region.min.y + y, region.min.x, w);
|
fillFetchLinear(fill, sbuffer, region.min.y + y, region.min.x, w);
|
||||||
|
@ -658,12 +659,13 @@ static bool _rasterOpaqueLinearGradientRect(SwSurface* surface, const SwBBox& re
|
||||||
buffer += surface->stride;
|
buffer += surface->stride;
|
||||||
cbuffer += surface->stride;
|
cbuffer += surface->stride;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
for (uint32_t y = 0; y < h; ++y) {
|
for (uint32_t y = 0; y < h; ++y) {
|
||||||
fillFetchLinear(fill, buffer + y * surface->stride, region.min.y + y, region.min.x, w);
|
fillFetchLinear(fill, buffer + y * surface->stride, region.min.y + y, region.min.x, w);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,6 +719,7 @@ static bool _rasterOpaqueRadialGradientRect(SwSurface* surface, const SwBBox& re
|
||||||
buffer += surface->stride;
|
buffer += surface->stride;
|
||||||
cbuffer += surface->stride;
|
cbuffer += surface->stride;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} else if (method == CompositeMethod::InvAlphaMask) {
|
} else if (method == CompositeMethod::InvAlphaMask) {
|
||||||
for (uint32_t y = 0; y < h; ++y) {
|
for (uint32_t y = 0; y < h; ++y) {
|
||||||
fillFetchRadial(fill, sbuffer, region.min.y + y, region.min.x, w);
|
fillFetchRadial(fill, sbuffer, region.min.y + y, region.min.x, w);
|
||||||
|
@ -730,14 +733,14 @@ static bool _rasterOpaqueRadialGradientRect(SwSurface* surface, const SwBBox& re
|
||||||
buffer += surface->stride;
|
buffer += surface->stride;
|
||||||
cbuffer += surface->stride;
|
cbuffer += surface->stride;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
for (uint32_t y = 0; y < h; ++y) {
|
for (uint32_t y = 0; y < h; ++y) {
|
||||||
auto dst = &buffer[y * surface->stride];
|
auto dst = &buffer[y * surface->stride];
|
||||||
fillFetchRadial(fill, dst, region.min.y + y, region.min.x, w);
|
fillFetchRadial(fill, dst, region.min.y + y, region.min.x, w);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,6 +806,7 @@ static bool _rasterOpaqueLinearGradientRle(SwSurface* surface, const SwRleData*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} else if (method == CompositeMethod::InvAlphaMask) {
|
} else if (method == CompositeMethod::InvAlphaMask) {
|
||||||
for (uint32_t i = 0; i < rle->size; ++i, ++span) {
|
for (uint32_t i = 0; i < rle->size; ++i, ++span) {
|
||||||
fillFetchLinear(fill, buf, span->y, span->x, span->len);
|
fillFetchLinear(fill, buf, span->y, span->x, span->len);
|
||||||
|
@ -823,8 +827,10 @@ static bool _rasterOpaqueLinearGradientRle(SwSurface* surface, const SwRleData*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < rle->size; ++i) {
|
for (uint32_t i = 0; i < rle->size; ++i) {
|
||||||
if (span->coverage == 255) {
|
if (span->coverage == 255) {
|
||||||
fillFetchLinear(fill, surface->buffer + span->y * surface->stride + span->x, span->y, span->x, span->len);
|
fillFetchLinear(fill, surface->buffer + span->y * surface->stride + span->x, span->y, span->x, span->len);
|
||||||
|
@ -838,7 +844,6 @@ static bool _rasterOpaqueLinearGradientRle(SwSurface* surface, const SwRleData*
|
||||||
}
|
}
|
||||||
++span;
|
++span;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,6 +909,7 @@ static bool _rasterOpaqueRadialGradientRle(SwSurface* surface, const SwRleData*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
} else if (method == CompositeMethod::InvAlphaMask) {
|
} else if (method == CompositeMethod::InvAlphaMask) {
|
||||||
for (uint32_t i = 0; i < rle->size; ++i, ++span) {
|
for (uint32_t i = 0; i < rle->size; ++i, ++span) {
|
||||||
fillFetchRadial(fill, buf, span->y, span->x, span->len);
|
fillFetchRadial(fill, buf, span->y, span->x, span->len);
|
||||||
|
@ -924,8 +930,10 @@ static bool _rasterOpaqueRadialGradientRle(SwSurface* surface, const SwRleData*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
for (uint32_t i = 0; i < rle->size; ++i) {
|
for (uint32_t i = 0; i < rle->size; ++i) {
|
||||||
auto dst = &surface->buffer[span->y * surface->stride + span->x];
|
auto dst = &surface->buffer[span->y * surface->stride + span->x];
|
||||||
if (span->coverage == 255) {
|
if (span->coverage == 255) {
|
||||||
|
@ -939,7 +947,6 @@ static bool _rasterOpaqueRadialGradientRle(SwSurface* surface, const SwRleData*
|
||||||
}
|
}
|
||||||
++span;
|
++span;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue