From: Mira Grudzinska Date: Sun, 1 Nov 2020 15:38:14 +0000 (+0100) Subject: sw_engine shape: change of the rectangle fast tracking algorithm X-Git-Tag: submit/tizen/20201108.215920~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=517b68d652192c1ae84e7154cf4a3dff8e1551d8;p=platform%2Fcore%2Fgraphics%2Ftizenvg.git sw_engine shape: change of the rectangle fast tracking algorithm The algorithm erroneously treated some shapes (like isosceles trapezoids and specifically arranged zero width parallelograms) as rectangles, which causes the whole bbox to be filled. Change-Id: If5aa87c53cf174367841323ac813b28ead4871b4 --- diff --git a/src/lib/sw_engine/tvgSwShape.cpp b/src/lib/sw_engine/tvgSwShape.cpp index a0cbce1..44066f3 100644 --- a/src/lib/sw_engine/tvgSwShape.cpp +++ b/src/lib/sw_engine/tvgSwShape.cpp @@ -430,13 +430,14 @@ bool _fastTrack(const SwOutline* outline) auto pt3 = outline->pts + 2; auto pt4 = outline->pts + 3; - auto min1 = pt1->y < pt3->y ? pt1 : pt3; - auto min2 = pt2->y < pt4->y ? pt2 : pt4; - if (min1->y != min2->y) return false; - - SwCoord len1 = pow(pt1->x - pt3->x, 2) + pow(pt1->y - pt3->y, 2); - SwCoord len2 = pow(pt2->x - pt4->x, 2) + pow(pt2->y - pt4->y, 2); - if (len1 == len2) return true; + SwPoint a; + SwPoint b; + a.x = pt1->x; + a.y = pt3->y; + b.x = pt3->x; + b.y = pt1->y; + + if ((*pt2 == a && *pt4 == b) || (*pt2 == b && *pt4 == a)) return true; return false; }