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:
Mira Grudzinska 2021-01-26 01:28:24 +01:00 committed by Hermet Park
parent 905fd46ccf
commit 3dfc3c4943

View file

@ -318,15 +318,16 @@ bool SwRenderer::renderShape(RenderData data)
if (auto fill = task->sdata->fill()) {
rasterGradientShape(surface, &task->shape, fill->id());
} else{
} else {
task->sdata->fillColor(&r, &g, &b, &a);
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
if (a > 0) rasterSolidShape(surface, &task->shape, r, g, b, a);
}
task->sdata->strokeColor(&r, &g, &b, &a);
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) {
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
if (a > 0) rasterStroke(surface, &task->shape, r, g, b, a);
}
if (task->cmpStroking) endComposite(cmp);