flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Mclean (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-35272) [FlexJS] RGBA colour support needs fixing
Date Sun, 19 Feb 2017 21:59:44 GMT
Justin Mclean created FLEX-35272:
------------------------------------

             Summary: [FlexJS] RGBA colour support needs fixing
                 Key: FLEX-35272
                 URL: https://issues.apache.org/jira/browse/FLEX-35272
             Project: Apache Flex
          Issue Type: Bug
          Components: FlexJS
    Affects Versions: Apache FlexJS 0.8.0
            Reporter: Justin Mclean


In SimpleCSSVAluesImpl parseStyle method this code:

{code}
if (value.charAt(0) == "#") {
        obj[pieces[0]] = org.apache.flex.utils.CSSUtils.toColor(value);
      }
{code}

Should be something like:
{code}
if (value.charAt(0) == "#" || value.indexOf("rgb") == 0) {
        obj[pieces[0]] = org.apache.flex.utils.CSSUtils.toColor(value);
      }
{code}

And in CSSUtils the parsing of rgba values is broken - this code;

{code}
} else if ((c = stringValue.indexOf("rgba(")) != -1) {
  c2 = stringValue.indexOf(")");
  stringValue = stringValue.substring(c + 4, c2);
  var /** @type {Array} */ parts4 = stringValue.split(",");(org.apache.flex.utils.Language.uint(parts4[3])
<< 24 + org.apache.flex.utils.Language.uint(parts3[0]) << 16 + org.apache.flex.utils.Language.uint(parts3[1])
<< 8 + org.apache.flex.utils.Language.uint(parts3[2]));
{code}

Should be:
{code}
} else if ((c = stringValue.indexOf("rgba(")) != -1) {
  c2 = stringValue.indexOf(")");
  stringValue = stringValue.substring(c + 5, c2);
  var /** @type {Array} */ parts4 = stringValue.split(",");(org.apache.flex.utils.Language.uint(parts4[3]*255)
<< 24 + org.apache.flex.utils.Language.uint(parts4[0]) << 16 + org.apache.flex.utils.Language.uint(parts4[1])
<< 8 + org.apache.flex.utils.Language.uint(parts4[2]));
{code}

Note the c+5 rather than c+4, using the parts4 array rather than parts3 array and multiplying
the parts4 by 255 as it is the range 0.1 to 1.0.

Also the value it gets is wrong - adding a few brackets seems to get the right answer and
not overflow.
{code}
(org.apache.flex.utils.Language.uint(parts4[3]*255) << 24) + (org.apache.flex.utils.Language.uint(parts4[0])
<< 16) + (org.apache.flex.utils.Language.uint(parts4[1]) << 8) + org.apache.flex.utils.Language.uint(parts4[2])
{code}




--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message