svg_loader: preserveAspectRatio fix 78/289178/1
authormgrudzinska <m.grudzinska@samsung.com>
Wed, 23 Feb 2022 20:22:55 +0000 (21:22 +0100)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Thu, 2 Mar 2023 08:12:41 +0000 (09:12 +0100)
The default value should be xMidYMid, now it is.

Change-Id: Idb347ed847f4ac19f687f4dfc7c7507a8ca0abbe

src/loaders/svg/tvgSvgSceneBuilder.cpp

index a02cc32..dc26af8 100644 (file)
@@ -705,17 +705,13 @@ unique_ptr<Scene> svgSceneBuild(SvgNode* node, float vx, float vy, float vw, flo
             auto tvy = vy * scale;
             auto tvw = vw * scale;
             auto tvh = vh * scale;
-            if (vw > vh) tvy -= (h - tvh) * 0.5f;
-            else  tvx -= (w - tvw) * 0.5f;
+            tvx -= (w - tvw) * 0.5f;
+            tvy -= (h - tvh) * 0.5f;
             docNode->translate(-tvx, -tvy);
         } else {
             //Align
             auto tvx = vx * sx;
             auto tvy = vy * sy;
-            auto tvw = vw * sx;
-            auto tvh = vh * sy;
-            if (tvw > tvh) tvy -= (h - tvh) * 0.5f;
-            else tvx -= (w - tvw) * 0.5f;
             Matrix m = {sx, 0, -tvx, 0, sy, -tvy, 0, 0, 1};
             docNode->transform(m);
         }