tvg_saver: do not merge if the shapes have outlines.
authorHermet Park <chuneon.park@samsung.com>
Wed, 15 Sep 2021 12:05:20 +0000 (21:05 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 16 Sep 2021 01:20:40 +0000 (10:20 +0900)
Merged shapes with outlines expects the layered,
unfortunately tvg can't cover the situation.

@Issues: https://github.com/Samsung/thorvg/issues/783

src/examples/images/penrose-staircase.tvg
src/examples/images/test.tvg
src/savers/tvg/tvgTvgSaver.cpp

index 7aabee9..0d2043c 100644 (file)
Binary files a/src/examples/images/penrose-staircase.tvg and b/src/examples/images/penrose-staircase.tvg differ
index 78bb48f..d822a90 100644 (file)
Binary files a/src/examples/images/test.tvg and b/src/examples/images/test.tvg differ
index 8be2831..01d2bb7 100644 (file)
@@ -108,6 +108,10 @@ static bool _merge(Shape* from, Shape* to)
     if (r != r2 || g != g2 || b != b2 || a != a2) return false;
 
     if (fabs(from->strokeWidth() - to->strokeWidth()) > FLT_EPSILON) return false;
+
+    //OPTIMIZE: Yet we can't merge outlining shapes unless we can support merging shapes feature.
+    if (from->strokeWidth() > 0 || to->strokeWidth() > 0) return false;
+
     if (from->strokeCap() != to->strokeCap()) return false;
     if (from->strokeJoin() != to->strokeJoin()) return false;
     if (from->strokeDash(nullptr) > 0 || to->strokeDash(nullptr) > 0) return false;