diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index 3ec882e2..91c00139 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -93,29 +93,34 @@ void* SwRenderer::prepare(const Shape& shape, void* data, const RenderTransform* if (flags == RenderUpdateFlag::None) return sdata; - //invisible? - size_t a, sa; - shape.fill(nullptr, nullptr, nullptr, &a); - shape.strokeColor(nullptr, nullptr, nullptr, &sa); - if (a == 0 && sa == 0) return sdata; - //TODO: Threading SwSize clip = {static_cast(surface.w), static_cast(surface.h)}; //Shape if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform)) { - shapeReset(*sdata); - if (!shapeGenOutline(shape, *sdata)) return sdata; - if (transform) shapeTransformOutline(shape, *sdata, *transform); - if (!shapeGenRle(shape, *sdata, clip)) return sdata; + + size_t alpha = 0; + shape.fill(nullptr, nullptr, nullptr, &alpha); + + if (alpha > 0) { + shapeReset(*sdata); + if (!shapeGenOutline(shape, *sdata)) return sdata; + if (transform) shapeTransformOutline(shape, *sdata, *transform); + if (!shapeGenRle(shape, *sdata, clip)) return sdata; + } } //Stroke - if (flags & RenderUpdateFlag::Stroke) { - shapeResetStroke(shape, *sdata); - if (shape.strokeWidth() > 0.01) { - if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata; + if (flags & (RenderUpdateFlag::Stroke | RenderUpdateFlag::Transform)) { + + if (shape.strokeWidth() > 0.5) { + shapeResetStroke(shape, *sdata); + size_t alpha = 0; + shape.strokeColor(nullptr, nullptr, nullptr, &alpha); + if (alpha > 0) { + if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata; + } } } diff --git a/test/testDirectUpdate.cpp b/test/testDirectUpdate.cpp index 799d1351..e1a4c608 100644 --- a/test/testDirectUpdate.cpp +++ b/test/testDirectUpdate.cpp @@ -27,6 +27,8 @@ void tvgtest() //fill property will be retained shape->fill(127, 255, 255, 255); + shape->stroke(0, 0, 255, 255); + shape->stroke(1); canvas->push(move(shape)); @@ -44,6 +46,7 @@ void transit_cb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progres pShape->reset(); //reset path pShape->appendRect(-100 + (800 * progress), -100 + (800 * progress), 200, 200, (100 * progress)); + pShape->stroke(30 * progress); //Update shape for drawing (this may work asynchronously) canvas->update(pShape); diff --git a/test/testSceneTransform.cpp b/test/testSceneTransform.cpp index a66996a5..975f4faf 100644 --- a/test/testSceneTransform.cpp +++ b/test/testSceneTransform.cpp @@ -25,19 +25,21 @@ void tvgtest() //Prepare Round Rectangle (Scene1) auto shape1 = tvg::Shape::gen(); shape1->appendRect(-235, -250, 400, 400, 50); //x, y, w, h, cornerRadius - shape1->fill(0, 255, 0, 255); //r, g, b, a + shape1->fill(0, 255, 0, 255); //r, g, b, a + shape1->stroke(5); //width + shape1->stroke(255, 255, 255, 255); //r, g, b, a scene->push(move(shape1)); //Prepare Circle (Scene1) auto shape2 = tvg::Shape::gen(); shape2->appendCircle(-165, -150, 200, 200); //cx, cy, radiusW, radiusH - shape2->fill(255, 255, 0, 255); //r, g, b, a + shape2->fill(255, 255, 0, 255); //r, g, b, a scene->push(move(shape2)); //Prepare Ellipse (Scene1) auto shape3 = tvg::Shape::gen(); - shape3->appendCircle(265, 250, 150, 100); //cx, cy, radiusW, radiusH - shape3->fill(0, 255, 255, 255); //r, g, b, a + shape3->appendCircle(265, 250, 150, 100); //cx, cy, radiusW, radiusH + shape3->fill(0, 255, 255, 255); //r, g, b, a scene->push(move(shape3)); scene->translate(350, 350); @@ -64,6 +66,8 @@ void tvgtest() shape4->lineTo(-53, -5.5); shape4->close(); shape4->fill(0, 0, 127, 127); + shape4->stroke(3); //width + shape4->stroke(0, 0, 255, 255); //r, g, b, a scene2->push(move(shape4)); //Circle (Scene2)