flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [3/3] git commit: [flex-falcon] [refs/heads/develop] - fix rgba handling
Date Tue, 28 Jul 2015 18:42:51 GMT
fix rgba handling


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/b26f9943
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/b26f9943
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/b26f9943

Branch: refs/heads/develop
Commit: b26f9943152b7f0e0af95e6e3fbe88ed15d31103
Parents: 78ff074
Author: Alex Harui <aharui@apache.org>
Authored: Tue Jul 28 11:42:31 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Jul 28 11:42:43 2015 -0700

----------------------------------------------------------------------
 .../internal/css/CSSRgbaColorPropertyValue.java   | 18 +++++++++++++++---
 .../compiler/internal/css/codegen/CSSReducer.java |  5 +++++
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b26f9943/compiler/src/org/apache/flex/compiler/internal/css/CSSRgbaColorPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSRgbaColorPropertyValue.java
b/compiler/src/org/apache/flex/compiler/internal/css/CSSRgbaColorPropertyValue.java
index 792b6ea..6f9d637 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSRgbaColorPropertyValue.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSRgbaColorPropertyValue.java
@@ -73,9 +73,21 @@ public class CSSRgbaColorPropertyValue extends CSSPropertyValue
                 sb.append(Character.forDigit(digit & 15, 16));
                 
             } else {
-                digit = Float.valueOf(t).intValue();
-                sb.append(Character.forDigit((digit >> 4) & 15, 16));
-                sb.append(Character.forDigit(digit & 15, 16));
+                if (st.hasMoreElements())
+                {
+                    digit = Float.valueOf(t).intValue();
+                    sb.append(Character.forDigit((digit >> 4) & 15, 16));
+                    sb.append(Character.forDigit(digit & 15, 16));
+                }
+                else
+                {
+                    // alpha
+                    Float alpha = Float.valueOf(t);
+                    alpha *= 255;
+                    digit = alpha.intValue();
+                    sb.append(Character.forDigit((digit >> 4) & 15, 16));
+                    sb.append(Character.forDigit(digit & 15, 16));
+                }
             }            
         }
         return Integer.parseInt( sb.substring(0, 6).toString(), 16 );

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/b26f9943/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
index 751495e..1e53e45 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
@@ -57,6 +57,7 @@ import org.apache.flex.compiler.internal.css.CSSFunctionCallPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSKeywordPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSNumberPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSRgbColorPropertyValue;
+import org.apache.flex.compiler.internal.css.CSSRgbaColorPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSRule;
 import org.apache.flex.compiler.internal.css.CSSSelector;
 import org.apache.flex.compiler.internal.css.CSSStringPropertyValue;
@@ -458,6 +459,10 @@ public class CSSReducer implements ICSSCodeGenResult
         {
             valueInstructions.addInstruction(ABCConstants.OP_pushint, new Integer(((CSSRgbColorPropertyValue)value).getColorAsInt()));
         }
+        else if (value instanceof CSSRgbaColorPropertyValue)
+        {
+            valueInstructions.addInstruction(ABCConstants.OP_pushint, new Integer(((CSSRgbaColorPropertyValue)value).getColorAsInt()));
+        }
         else if (value instanceof CSSKeywordPropertyValue)
         {
             CSSKeywordPropertyValue keywordValue = (CSSKeywordPropertyValue)value;


Mime
View raw message