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

harbs 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 3b6cb3e  Use pinValue to make code a bit more legible
3b6cb3e is described below

commit 3b6cb3e32d23aa6786b6e30c02e50a059d2085ea
Author: Harbs <[email protected]>
AuthorDate: Tue Jan 5 14:45:03 2021 +0200

    Use pinValue to make code a bit more legible
---
 .../Core/src/main/royale/org/apache/royale/utils/ColorUtil.as     | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ColorUtil.as 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ColorUtil.as
index d463be7..f85ecce 100644
--- 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ColorUtil.as
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/ColorUtil.as
@@ -20,6 +20,8 @@
 package org.apache.royale.utils
 {
        
+       import org.apache.royale.utils.number.pinValue;
+
        /**
         *  The ColorUtil class is an all-static class
         *  with methods for working with RGB colors within Royale.
@@ -65,9 +67,9 @@ package org.apache.royale.utils
                 */
                public static function adjustBrightness(rgb:uint, 
brite:Number):uint
                {
-                       var r:Number = Math.max(Math.min(((rgb >> 16) & 0xFF) + 
brite, 255), 0);
-                       var g:Number = Math.max(Math.min(((rgb >> 8) & 0xFF) + 
brite, 255), 0);
-                       var b:Number = Math.max(Math.min((rgb & 0xFF) + brite, 
255), 0);
+                       var r:Number = pinValue(((rgb >> 16) & 0xFF) + brite, 
0, 255);
+                       var g:Number = pinValue(((rgb >> 8) & 0xFF) + brite, 0, 
255);
+                       var b:Number = pinValue((rgb & 0xFF) + brite, 0, 255);
                        
                        return (r << 16) | (g << 8) | b;
                } 

Reply via email to