This is an automated email from the ASF dual-hosted git repository.

gregdove pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new b373c9f3b6 avoid negative radii in PathBuilder's drawRoundedRectComplex
b373c9f3b6 is described below

commit b373c9f3b67b9db6e5e31cdeea668bd2b500a656
Author: greg-dove <[email protected]>
AuthorDate: Mon Jan 15 10:35:59 2024 +1300

    avoid negative radii in PathBuilder's drawRoundedRectComplex
---
 .../src/main/royale/org/apache/royale/graphics/PathBuilder.as  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/graphics/PathBuilder.as
 
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/graphics/PathBuilder.as
index 7a3f44d602..33e23d665d 100644
--- 
a/frameworks/projects/Graphics/src/main/royale/org/apache/royale/graphics/PathBuilder.as
+++ 
b/frameworks/projects/Graphics/src/main/royale/org/apache/royale/graphics/PathBuilder.as
@@ -206,10 +206,12 @@ package org.apache.royale.graphics
             // Make sure none of the radius values are exceeding the minimum 
of w/2 and h/2
             // These are all inlined to avoid function calling overhead
             var maxSize:Number = width < height ? width * 0.5 : height * 0.5;
-            topLeftRadius = topLeftRadius <= maxSize ? topLeftRadius : maxSize;
-            topRightRadius = topRightRadius <= maxSize ? topRightRadius : 
maxSize;
-            bottomLeftRadius = bottomLeftRadius <= maxSize ? bottomLeftRadius 
: maxSize;
-            bottomRightRadius = bottomRightRadius <= maxSize ? 
bottomRightRadius : maxSize;
+            //behavior below
+            //if any radius is greater than its max size, then it is set to 
max size. If it is less than zero, it is set to zero
+            topLeftRadius = topLeftRadius <= maxSize ? (topLeftRadius < 0 ? 0 
: topLeftRadius) : maxSize;
+            topRightRadius = topRightRadius <= maxSize ? (topRightRadius < 0 ? 
0 : topRightRadius) : maxSize;
+            bottomLeftRadius = bottomLeftRadius <= maxSize ? (bottomLeftRadius 
< 0 ? 0 : bottomLeftRadius) : maxSize;
+            bottomRightRadius = bottomRightRadius <= maxSize ? 
(bottomRightRadius < 0 ? 0 : bottomRightRadius) : maxSize;
             
             // Math.sin and Math,tan values for optimal performance.
             // Math.rad = Math.PI / 180 = 0.0174532925199433

Reply via email to