paint: fastTrack should return false for the skew transformations 96/289796/2
authorMira Grudzinska <veleveta@gmail.com>
Tue, 27 Dec 2022 17:32:43 +0000 (18:32 +0100)
committerMichal Szczecinski <mihashco89@gmail.com>
Tue, 14 Mar 2023 08:57:28 +0000 (09:57 +0100)
Change-Id: Ib5e5d6aca3d732963ac9855b0a79e1055dcf3d7c

src/lib/tvgMath.h
src/lib/tvgPaint.cpp

index 6120216..74f34fb 100644 (file)
@@ -53,6 +53,12 @@ static inline bool mathRightAngle(const Matrix* m)
 }
 
 
+static inline bool mathSkewed(const Matrix* m)
+{
+    return (fabsf(m->e21 + m->e12) > FLT_EPSILON);
+}
+
+
 static inline bool mathIdentity(const Matrix* m)
 {
     if (!mathEqual(m->e11, 1.0f) || !mathZero(m->e12) || !mathZero(m->e13) ||
index d0e908d..984f24e 100644 (file)
@@ -38,9 +38,9 @@ static bool _compFastTrack(Paint* cmpTarget, const RenderTransform* pTransform,
 
     if (rTransform) rTransform->update();
 
-    //No rotational.
-    if (pTransform && !mathRightAngle(&pTransform->m)) return false;
-    if (rTransform && !mathRightAngle(&rTransform->m)) return false;
+    //No rotation and no skewing
+    if (pTransform && (!mathRightAngle(&pTransform->m) || mathSkewed(&pTransform->m))) return false;
+    if (rTransform && (!mathRightAngle(&rTransform->m) || mathSkewed(&rTransform->m))) return false;
 
     //Perpendicular Rectangle?
     auto pt1 = pts + 0;