mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 14:13:43 +00:00
sw_engine renderer: rendering optimization of shapes without strokes
The value of 'a' for shapes without a stroke could hold the fill 'a' value. Added checking if stroke exists before calling rastering functions.
This commit is contained in:
parent
905fd46ccf
commit
3dfc3c4943
1 changed files with 5 additions and 4 deletions
|
@ -318,15 +318,16 @@ bool SwRenderer::renderShape(RenderData data)
|
||||||
|
|
||||||
if (auto fill = task->sdata->fill()) {
|
if (auto fill = task->sdata->fill()) {
|
||||||
rasterGradientShape(surface, &task->shape, fill->id());
|
rasterGradientShape(surface, &task->shape, fill->id());
|
||||||
} else{
|
} else {
|
||||||
task->sdata->fillColor(&r, &g, &b, &a);
|
task->sdata->fillColor(&r, &g, &b, &a);
|
||||||
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
||||||
if (a > 0) rasterSolidShape(surface, &task->shape, r, g, b, a);
|
if (a > 0) rasterSolidShape(surface, &task->shape, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
task->sdata->strokeColor(&r, &g, &b, &a);
|
if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) {
|
||||||
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
||||||
if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
|
if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
|
||||||
|
}
|
||||||
|
|
||||||
if (task->cmpStroking) endComposite(cmp);
|
if (task->cmpStroking) endComposite(cmp);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue