sw_engine: fix to update stroking transform

when shape doesn't have fill color, stroking is missed in update.

this fixs that issue.

Change-Id: I49292475e56caa834e79497a16db705b965bcf5f
This commit is contained in:
Hermet Park 2020-06-30 16:57:31 +09:00
parent 61cb144122
commit f377f33993
3 changed files with 17 additions and 9 deletions

View file

@ -175,12 +175,19 @@ void* SwRenderer::prepare(const Shape& sdata, void* data, const RenderTransform*
task->flags = flags;
auto asyncTask = [](SwTask* task) {
//Valid Stroking?
uint8_t strokeAlpha = 0;
if (task->sdata->strokeWidth() > FLT_EPSILON) {
task->sdata->strokeColor(nullptr, nullptr, nullptr, &strokeAlpha);
}
//Shape
if (task->flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform)) {
shapeReset(task->shape);
uint8_t alpha = 0;
task->sdata->fill(nullptr, nullptr, nullptr, &alpha);
if (alpha > 0 || task->sdata->fill()) {
if (alpha > 0 || task->sdata->fill() || strokeAlpha > 0) {
if (!shapeGenRle(task->shape, task->sdata, task->clip, task->transform)) return;
}
}
@ -197,13 +204,9 @@ void* SwRenderer::prepare(const Shape& sdata, void* data, const RenderTransform*
}
//Stroke
if (task->flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform)) {
if (task->sdata->strokeWidth() > FLT_EPSILON) {
if (strokeAlpha > 0) {
shapeResetStroke(task->shape, task->sdata);
uint8_t alpha = 0;
task->sdata->strokeColor(nullptr, nullptr, nullptr, &alpha);
if (alpha > 0) {
if (!shapeGenStrokeRle(task->shape, task->sdata, task->clip)) return;
}
} else {
shapeDelStroke(task->shape);
}

View file

@ -211,7 +211,7 @@ static bool _updateBBox(SwOutline* outline, SwBBox& bbox)
bbox.min.y = yMin >> 6;
bbox.max.y = (yMax + 63) >> 6;
if (xMax - xMin < 1 || yMax - yMin < 1) return false;
if (xMax - xMin < 1 && yMax - yMin < 1) return false;
return true;
}
@ -451,6 +451,9 @@ bool shapeGenRle(SwShape& shape, const Shape* sdata, const SwSize& clip, const M
if (!_checkValid(shape.outline, shape.bbox, clip)) goto end;
//Case: Stroke Line
if (shape.outline->opened) return true;
shape.rle = rleRender(shape.outline, shape.bbox, clip);
end:
if (shape.rle) return true;

View file

@ -26,6 +26,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
shape->lineTo(-53, -5.5);
shape->close();
shape->fill(0, 0, 255, 255);
shape->stroke(3);
shape->stroke(255, 255, 255, 255);
if (canvas->push(move(shape)) != tvg::Result::Success) return;
}