From: Hermet Park Date: Wed, 1 Jul 2020 07:49:03 +0000 (+0900) Subject: sw_engine: Draw shapes even though there is no explict closed command. X-Git-Tag: accepted/tizen/unified/20200806.062539~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F237554%2F1;p=platform%2Fcore%2Fgraphics%2Ftizenvg.git sw_engine: Draw shapes even though there is no explict closed command. This behavior is not confiremd but it's beneficial for svg spec. Change-Id: Ia711c057811ae51e472b4e164b36f3dd6af9893f --- diff --git a/src/lib/sw_engine/tvgSwCommon.h b/src/lib/sw_engine/tvgSwCommon.h index 88686b5..5db4cd7 100644 --- a/src/lib/sw_engine/tvgSwCommon.h +++ b/src/lib/sw_engine/tvgSwCommon.h @@ -264,7 +264,8 @@ SwFixed mathMean(SwFixed angle1, SwFixed angle2); void shapeReset(SwShape& shape); bool shapeGenOutline(SwShape& shape, const Shape* sdata); -bool shapeGenRle(SwShape& shape, const Shape* sdata, const SwSize& clip, const Matrix* transform); +bool shapePrepare(SwShape& shape, const Shape* sdata, const SwSize& clip, const Matrix* transform); +bool shapeGenRle(SwShape& shape, const Shape* sdata, const SwSize& clip); void shapeDelOutline(SwShape& shape); void shapeResetStroke(SwShape& shape, const Shape* sdata); bool shapeGenStrokeRle(SwShape& shape, const Shape* sdata, const SwSize& clip); diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index f6fc88b..b9ce7c0 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -187,8 +187,12 @@ void* SwRenderer::prepare(const Shape& sdata, void* data, const RenderTransform* shapeReset(task->shape); uint8_t alpha = 0; task->sdata->fill(nullptr, nullptr, nullptr, &alpha); - if (alpha > 0 || task->sdata->fill() || strokeAlpha > 0) { - if (!shapeGenRle(task->shape, task->sdata, task->clip, task->transform)) return; + bool renderShape = (alpha > 0 || task->sdata->fill()); + if (renderShape || strokeAlpha > 0) { + if (!shapePrepare(task->shape, task->sdata, task->clip, task->transform)) return; + if (renderShape) { + if (!shapeGenRle(task->shape, task->sdata, task->clip)) return; + } } } //Fill diff --git a/src/lib/sw_engine/tvgSwShape.cpp b/src/lib/sw_engine/tvgSwShape.cpp index 1c0a09e..dbdfb6a 100644 --- a/src/lib/sw_engine/tvgSwShape.cpp +++ b/src/lib/sw_engine/tvgSwShape.cpp @@ -463,25 +463,31 @@ bool _fastTrack(const SwOutline* outline) /* External Class Implementation */ /************************************************************************/ -bool shapeGenRle(SwShape& shape, const Shape* sdata, const SwSize& clip, const Matrix* transform) +bool shapePrepare(SwShape& shape, const Shape* sdata, const SwSize& clip, const Matrix* transform) { if (!shapeGenOutline(shape, sdata)) return false; _transformOutline(shape.outline, transform); - if (!_updateBBox(shape.outline, shape.bbox)) goto end; + if (!_updateBBox(shape.outline, shape.bbox)) return false; - if (!_checkValid(shape.outline, shape.bbox, clip)) goto end; + if (!_checkValid(shape.outline, shape.bbox, clip)) return false; + + return true; +} - //Case: Fast Track Rectangle Drawing - if ((shape.rect = _fastTrack(shape.outline))) return true; +bool shapeGenRle(SwShape& shape, const Shape* sdata, const SwSize& clip) +{ + //FIXME: Should we draw it? //Case: Stroke Line - if (shape.outline->opened) return true; + //if (shape.outline->opened) return true; + + //Case A: Fast Track Rectangle Drawing + if ((shape.rect = _fastTrack(shape.outline))) return true; + //Case B: Normale Shape RLE Drawing + if ((shape.rle = rleRender(shape.outline, shape.bbox, clip))) return true; - shape.rle = rleRender(shape.outline, shape.bbox, clip); -end: - if (shape.rle) return true; return false; }