You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ma...@apache.org on 2013/11/01 23:27:38 UTC

[1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Updated Branches:
  refs/heads/develop 3c3d2c01f -> 2a1212652


FIX FLEX-33861 Flex Incorrectly Scaling Down Application
mutella test pass:
tests/mobile/*


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

Branch: refs/heads/develop
Commit: bb65af3083b876480802dfac3d35c26fb59de232
Parents: 246600d
Author: mamsellem <ma...@systar.com>
Authored: Fri Nov 1 23:23:48 2013 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Fri Nov 1 23:23:48 2013 +0100

----------------------------------------------------------------------
 .../framework/src/mx/core/RuntimeDPIProvider.as | 51 +++++++++++++++++---
 1 file changed, 43 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bb65af30/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
index 03e3b42..8f94de4 100644
--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
@@ -19,9 +19,12 @@
 
 package mx.core
 {
+import flash.display.DisplayObject;
+import flash.display.Stage;
 import flash.system.Capabilities;
 
 import mx.core.mx_internal;
+import mx.managers.SystemManager;
 
 use namespace mx_internal;
 
@@ -47,6 +50,8 @@ use namespace mx_internal;
  *        <tr><td>640 DPI</td><td>&gt;=640 DPI</td></tr>
  *     </table>
  *  </p>
+ *
+ *
  * 
  *  <p>Subclasses of RuntimeDPIProvider should only depend on runtime APIs
  *  and should not depend on any classes specific to the Flex framework except
@@ -68,7 +73,7 @@ public class RuntimeDPIProvider
 {
     /**
      *  Constructor.
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
@@ -77,32 +82,62 @@ public class RuntimeDPIProvider
     public function RuntimeDPIProvider()
     {
     }
-    
+
     /**
      *  Returns the runtime DPI of the current device by mapping its
      *  <code>flash.system.Capabilities.screenDPI</code> to one of several DPI
      *  values in <code>mx.core.DPIClassification</code>.
-     * 
+     *
      *  A number of devices can have slightly different DPI values and Flex maps these
      *  into the several DPI classes.
-     * 
+     *
      *  Flex uses this method to calculate the current DPI value when an Application
      *  authored for a specific DPI is adapted to the current one through scaling.
-     * 
+     *
+     *  <p> Exceptions: </p>
+     *  <ul>
+     *      <li>All non-retina iPads  receive 160 DPI </li>
+     *      <li>All retina iPads  receive 320 DPI </li>
+     *   </ul>
+     *
      *  @param dpi The DPI value.
      *  @return The corresponding <code>DPIClassification</code> value.
-     *  
+     *                                                                               isI
      *  @see flash.system.Capabilities
      *  @see mx.core.DPIClassification
-     *  
+     *
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 2.5
      *  @productversion Flex 4.5
      */
+
     public function get runtimeDPI():Number
     {
-        return classifyDPI(Capabilities.screenDPI);
+
+        var isIOS:Boolean = Capabilities.version.indexOf("IOS") == 0;
+        var screenDPI : Number= Capabilities.screenDPI;
+
+        if (isIOS) {
+
+            var root:DisplayObject = SystemManager.getSWFRoot(this);
+            if (root != null )  {
+                var stage:Stage = root.stage;
+                if (stage != null){
+                    var scX:Number = stage.fullScreenWidth;
+                    var scY:Number = stage.fullScreenHeight;
+                    /*  as of Dec 2013,  iPad (resp. iPad retina)   are the only iOS devices to have 1024 (resp. 2048) screen width or height
+                     cf http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple
+                     * */
+                    if ((scX == 2048 || scY == 2048))
+                        return DPIClassification.DPI_320;
+                    else if (scX == 1024 || scY == 1024)
+                        return DPIClassification.DPI_160;
+                }
+            }
+        }
+        return classifyDPI(screenDPI);
+
     }
     
     /**


Re: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Posted by Justin Mclean <ju...@classsoftware.com>.
Hi,

Minor concern re fullScreenWidth and fullScreenHeight as I believe the height doesn't include system toolbars - not sure if that happens on iOS or not.

Looking at this:
http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html

It states:

Unfortunately devices often report the wrong dpi (notably for iOS displays). Capabilities.screenDPI is actually a best guess based on other information, but it may also be wrong. For comparison, you can get the original dpi reported by the operating system as follows:

var serverString:String = unescape(Capabilities.serverString);
var reportedDpi:Number = Number(serverString.split("&DP=", 2)[1]);

Thanks,
Justin

[2/2] git commit: [flex-sdk] [refs/heads/develop] - Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop

Posted by ma...@apache.org.
Merge branch 'develop' of https://git-wip-us.apache.org/repos/asf/flex-sdk into develop


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

Branch: refs/heads/develop
Commit: 2a12126525a222262f4a0685082608b86dbd13e4
Parents: bb65af3 3c3d2c0
Author: mamsellem <ma...@systar.com>
Authored: Fri Nov 1 23:24:31 2013 +0100
Committer: mamsellem <ma...@systar.com>
Committed: Fri Nov 1 23:24:31 2013 +0100

----------------------------------------------------------------------
 .../framework/src/mx/core/UIComponent.as        | 457 +++++++++++++++----
 .../src/spark/components/SkinnableContainer.as  |  11 +-
 mustella/as3/src/mustella/UnitTester.as         | 427 ++++++++++++++++-
 3 files changed, 782 insertions(+), 113 deletions(-)
----------------------------------------------------------------------



RE: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Posted by Maurice Amsellem <ma...@systar.com>.
Sorry, didn't see your comment as it fell in the "commits" directory.

Yes, I will put them in static vars 

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : samedi 2 novembre 2013 04:54
À : dev@flex.apache.org; commits@flex.apache.org
Objet : Re: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Looks fine.  One random thought:  If this code doesn't get called often, putting some of the constants like 1024 and 2048 into static vars would allow someone to change those numbers if needed.

-Alex

On 11/1/13 3:27 PM, "mamsellem@apache.org" <ma...@apache.org> wrote:

>Updated Branches:
>  refs/heads/develop 3c3d2c01f -> 2a1212652
>
>
>FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test 
>pass:
>tests/mobile/*
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/bb65af30
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/bb65af30
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/bb65af30
>
>Branch: refs/heads/develop
>Commit: bb65af3083b876480802dfac3d35c26fb59de232
>Parents: 246600d
>Author: mamsellem <ma...@systar.com>
>Authored: Fri Nov 1 23:23:48 2013 +0100
>Committer: mamsellem <ma...@systar.com>
>Committed: Fri Nov 1 23:23:48 2013 +0100
>
>----------------------------------------------------------------------
> .../framework/src/mx/core/RuntimeDPIProvider.as | 51 
>+++++++++++++++++---
> 1 file changed, 43 insertions(+), 8 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bb65af30/framework
>s/p rojects/framework/src/mx/core/RuntimeDPIProvider.as
>----------------------------------------------------------------------
>diff --git
>a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>index 03e3b42..8f94de4 100644
>--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>@@ -19,9 +19,12 @@
> 
> package mx.core
> {
>+import flash.display.DisplayObject;
>+import flash.display.Stage;
> import flash.system.Capabilities;
> 
> import mx.core.mx_internal;
>+import mx.managers.SystemManager;
> 
> use namespace mx_internal;
> 
>@@ -47,6 +50,8 @@ use namespace mx_internal;
>  *        <tr><td>640 DPI</td><td>&gt;=640 DPI</td></tr>
>  *     </table>
>  *  </p>
>+ *
>+ *
>  *
>  *  <p>Subclasses of RuntimeDPIProvider should only depend on runtime 
>APIs
>  *  and should not depend on any classes specific to the Flex 
>framework except @@ -68,7 +73,7 @@ public class RuntimeDPIProvider  {
>     /**
>      *  Constructor.
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>@@ -77,32 +82,62 @@ public class RuntimeDPIProvider
>     public function RuntimeDPIProvider()
>     {
>     }
>-    
>+
>     /**
>      *  Returns the runtime DPI of the current device by mapping its
>      *  <code>flash.system.Capabilities.screenDPI</code> to one of 
>several DPI
>      *  values in <code>mx.core.DPIClassification</code>.
>-     * 
>+     *
>      *  A number of devices can have slightly different DPI values and 
>Flex maps these
>      *  into the several DPI classes.
>-     * 
>+     *
>      *  Flex uses this method to calculate the current DPI value when 
>an Application
>      *  authored for a specific DPI is adapted to the current one 
>through scaling.
>-     * 
>+     *
>+     *  <p> Exceptions: </p>
>+     *  <ul>
>+     *      <li>All non-retina iPads  receive 160 DPI </li>
>+     *      <li>All retina iPads  receive 320 DPI </li>
>+     *   </ul>
>+     *
>      *  @param dpi The DPI value.
>      *  @return The corresponding <code>DPIClassification</code> value.
>-     *  
>+     *           
>            isI
>      *  @see flash.system.Capabilities
>      *  @see mx.core.DPIClassification
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>      *  @productversion Flex 4.5
>      */
>+
>     public function get runtimeDPI():Number
>     {
>-        return classifyDPI(Capabilities.screenDPI);
>+
>+        var isIOS:Boolean = Capabilities.version.indexOf("IOS") == 0;
>+        var screenDPI : Number= Capabilities.screenDPI;
>+
>+        if (isIOS) {
>+
>+            var root:DisplayObject = SystemManager.getSWFRoot(this);
>+            if (root != null )  {
>+                var stage:Stage = root.stage;
>+                if (stage != null){
>+                    var scX:Number = stage.fullScreenWidth;
>+                    var scY:Number = stage.fullScreenHeight;
>+                    /*  as of Dec 2013,  iPad (resp. iPad retina)   are
>the only iOS devices to have 1024 (resp. 2048) screen width or height
>+                     cf
>http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple
>+                     * */
>+                    if ((scX == 2048 || scY == 2048))
>+                        return DPIClassification.DPI_320;
>+                    else if (scX == 1024 || scY == 1024)
>+                        return DPIClassification.DPI_160;
>+                }
>+            }
>+        }
>+        return classifyDPI(screenDPI);
>+
>     }
>     
>     /**
>


RE: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Posted by Maurice Amsellem <ma...@systar.com>.
Sorry, didn't see your comment as it fell in the "commits" directory.

Yes, I will put them in static vars 

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : samedi 2 novembre 2013 04:54
À : dev@flex.apache.org; commits@flex.apache.org
Objet : Re: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Looks fine.  One random thought:  If this code doesn't get called often, putting some of the constants like 1024 and 2048 into static vars would allow someone to change those numbers if needed.

-Alex

On 11/1/13 3:27 PM, "mamsellem@apache.org" <ma...@apache.org> wrote:

>Updated Branches:
>  refs/heads/develop 3c3d2c01f -> 2a1212652
>
>
>FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test 
>pass:
>tests/mobile/*
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/bb65af30
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/bb65af30
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/bb65af30
>
>Branch: refs/heads/develop
>Commit: bb65af3083b876480802dfac3d35c26fb59de232
>Parents: 246600d
>Author: mamsellem <ma...@systar.com>
>Authored: Fri Nov 1 23:23:48 2013 +0100
>Committer: mamsellem <ma...@systar.com>
>Committed: Fri Nov 1 23:23:48 2013 +0100
>
>----------------------------------------------------------------------
> .../framework/src/mx/core/RuntimeDPIProvider.as | 51 
>+++++++++++++++++---
> 1 file changed, 43 insertions(+), 8 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bb65af30/framework
>s/p rojects/framework/src/mx/core/RuntimeDPIProvider.as
>----------------------------------------------------------------------
>diff --git
>a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>index 03e3b42..8f94de4 100644
>--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>@@ -19,9 +19,12 @@
> 
> package mx.core
> {
>+import flash.display.DisplayObject;
>+import flash.display.Stage;
> import flash.system.Capabilities;
> 
> import mx.core.mx_internal;
>+import mx.managers.SystemManager;
> 
> use namespace mx_internal;
> 
>@@ -47,6 +50,8 @@ use namespace mx_internal;
>  *        <tr><td>640 DPI</td><td>&gt;=640 DPI</td></tr>
>  *     </table>
>  *  </p>
>+ *
>+ *
>  *
>  *  <p>Subclasses of RuntimeDPIProvider should only depend on runtime 
>APIs
>  *  and should not depend on any classes specific to the Flex 
>framework except @@ -68,7 +73,7 @@ public class RuntimeDPIProvider  {
>     /**
>      *  Constructor.
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>@@ -77,32 +82,62 @@ public class RuntimeDPIProvider
>     public function RuntimeDPIProvider()
>     {
>     }
>-    
>+
>     /**
>      *  Returns the runtime DPI of the current device by mapping its
>      *  <code>flash.system.Capabilities.screenDPI</code> to one of 
>several DPI
>      *  values in <code>mx.core.DPIClassification</code>.
>-     * 
>+     *
>      *  A number of devices can have slightly different DPI values and 
>Flex maps these
>      *  into the several DPI classes.
>-     * 
>+     *
>      *  Flex uses this method to calculate the current DPI value when 
>an Application
>      *  authored for a specific DPI is adapted to the current one 
>through scaling.
>-     * 
>+     *
>+     *  <p> Exceptions: </p>
>+     *  <ul>
>+     *      <li>All non-retina iPads  receive 160 DPI </li>
>+     *      <li>All retina iPads  receive 320 DPI </li>
>+     *   </ul>
>+     *
>      *  @param dpi The DPI value.
>      *  @return The corresponding <code>DPIClassification</code> value.
>-     *  
>+     *           
>            isI
>      *  @see flash.system.Capabilities
>      *  @see mx.core.DPIClassification
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>      *  @productversion Flex 4.5
>      */
>+
>     public function get runtimeDPI():Number
>     {
>-        return classifyDPI(Capabilities.screenDPI);
>+
>+        var isIOS:Boolean = Capabilities.version.indexOf("IOS") == 0;
>+        var screenDPI : Number= Capabilities.screenDPI;
>+
>+        if (isIOS) {
>+
>+            var root:DisplayObject = SystemManager.getSWFRoot(this);
>+            if (root != null )  {
>+                var stage:Stage = root.stage;
>+                if (stage != null){
>+                    var scX:Number = stage.fullScreenWidth;
>+                    var scY:Number = stage.fullScreenHeight;
>+                    /*  as of Dec 2013,  iPad (resp. iPad retina)   are
>the only iOS devices to have 1024 (resp. 2048) screen width or height
>+                     cf
>http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple
>+                     * */
>+                    if ((scX == 2048 || scY == 2048))
>+                        return DPIClassification.DPI_320;
>+                    else if (scX == 1024 || scY == 1024)
>+                        return DPIClassification.DPI_160;
>+                }
>+            }
>+        }
>+        return classifyDPI(screenDPI);
>+
>     }
>     
>     /**
>


Re: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Posted by Alex Harui <ah...@adobe.com>.
Looks fine.  One random thought:  If this code doesn't get called often,
putting some of the constants like 1024 and 2048 into static vars would
allow someone to change those numbers if needed.

-Alex

On 11/1/13 3:27 PM, "mamsellem@apache.org" <ma...@apache.org> wrote:

>Updated Branches:
>  refs/heads/develop 3c3d2c01f -> 2a1212652
>
>
>FIX FLEX-33861 Flex Incorrectly Scaling Down Application
>mutella test pass:
>tests/mobile/*
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/bb65af30
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/bb65af30
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/bb65af30
>
>Branch: refs/heads/develop
>Commit: bb65af3083b876480802dfac3d35c26fb59de232
>Parents: 246600d
>Author: mamsellem <ma...@systar.com>
>Authored: Fri Nov 1 23:23:48 2013 +0100
>Committer: mamsellem <ma...@systar.com>
>Committed: Fri Nov 1 23:23:48 2013 +0100
>
>----------------------------------------------------------------------
> .../framework/src/mx/core/RuntimeDPIProvider.as | 51 +++++++++++++++++---
> 1 file changed, 43 insertions(+), 8 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bb65af30/frameworks/p
>rojects/framework/src/mx/core/RuntimeDPIProvider.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>index 03e3b42..8f94de4 100644
>--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>@@ -19,9 +19,12 @@
> 
> package mx.core
> {
>+import flash.display.DisplayObject;
>+import flash.display.Stage;
> import flash.system.Capabilities;
> 
> import mx.core.mx_internal;
>+import mx.managers.SystemManager;
> 
> use namespace mx_internal;
> 
>@@ -47,6 +50,8 @@ use namespace mx_internal;
>  *        <tr><td>640 DPI</td><td>&gt;=640 DPI</td></tr>
>  *     </table>
>  *  </p>
>+ *
>+ *
>  * 
>  *  <p>Subclasses of RuntimeDPIProvider should only depend on runtime
>APIs
>  *  and should not depend on any classes specific to the Flex framework
>except
>@@ -68,7 +73,7 @@ public class RuntimeDPIProvider
> {
>     /**
>      *  Constructor.
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>@@ -77,32 +82,62 @@ public class RuntimeDPIProvider
>     public function RuntimeDPIProvider()
>     {
>     }
>-    
>+
>     /**
>      *  Returns the runtime DPI of the current device by mapping its
>      *  <code>flash.system.Capabilities.screenDPI</code> to one of
>several DPI
>      *  values in <code>mx.core.DPIClassification</code>.
>-     * 
>+     *
>      *  A number of devices can have slightly different DPI values and
>Flex maps these
>      *  into the several DPI classes.
>-     * 
>+     *
>      *  Flex uses this method to calculate the current DPI value when an
>Application
>      *  authored for a specific DPI is adapted to the current one
>through scaling.
>-     * 
>+     *
>+     *  <p> Exceptions: </p>
>+     *  <ul>
>+     *      <li>All non-retina iPads  receive 160 DPI </li>
>+     *      <li>All retina iPads  receive 320 DPI </li>
>+     *   </ul>
>+     *
>      *  @param dpi The DPI value.
>      *  @return The corresponding <code>DPIClassification</code> value.
>-     *  
>+     *           
>            isI
>      *  @see flash.system.Capabilities
>      *  @see mx.core.DPIClassification
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>      *  @productversion Flex 4.5
>      */
>+
>     public function get runtimeDPI():Number
>     {
>-        return classifyDPI(Capabilities.screenDPI);
>+
>+        var isIOS:Boolean = Capabilities.version.indexOf("IOS") == 0;
>+        var screenDPI : Number= Capabilities.screenDPI;
>+
>+        if (isIOS) {
>+
>+            var root:DisplayObject = SystemManager.getSWFRoot(this);
>+            if (root != null )  {
>+                var stage:Stage = root.stage;
>+                if (stage != null){
>+                    var scX:Number = stage.fullScreenWidth;
>+                    var scY:Number = stage.fullScreenHeight;
>+                    /*  as of Dec 2013,  iPad (resp. iPad retina)   are
>the only iOS devices to have 1024 (resp. 2048) screen width or height
>+                     cf
>http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple
>+                     * */
>+                    if ((scX == 2048 || scY == 2048))
>+                        return DPIClassification.DPI_320;
>+                    else if (scX == 1024 || scY == 1024)
>+                        return DPIClassification.DPI_160;
>+                }
>+            }
>+        }
>+        return classifyDPI(screenDPI);
>+
>     }
>     
>     /**
>


Re: [1/2] git commit: [flex-sdk] [refs/heads/develop] - FIX FLEX-33861 Flex Incorrectly Scaling Down Application mutella test pass: tests/mobile/*

Posted by Alex Harui <ah...@adobe.com>.
Looks fine.  One random thought:  If this code doesn't get called often,
putting some of the constants like 1024 and 2048 into static vars would
allow someone to change those numbers if needed.

-Alex

On 11/1/13 3:27 PM, "mamsellem@apache.org" <ma...@apache.org> wrote:

>Updated Branches:
>  refs/heads/develop 3c3d2c01f -> 2a1212652
>
>
>FIX FLEX-33861 Flex Incorrectly Scaling Down Application
>mutella test pass:
>tests/mobile/*
>
>
>Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
>Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/bb65af30
>Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/bb65af30
>Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/bb65af30
>
>Branch: refs/heads/develop
>Commit: bb65af3083b876480802dfac3d35c26fb59de232
>Parents: 246600d
>Author: mamsellem <ma...@systar.com>
>Authored: Fri Nov 1 23:23:48 2013 +0100
>Committer: mamsellem <ma...@systar.com>
>Committed: Fri Nov 1 23:23:48 2013 +0100
>
>----------------------------------------------------------------------
> .../framework/src/mx/core/RuntimeDPIProvider.as | 51 +++++++++++++++++---
> 1 file changed, 43 insertions(+), 8 deletions(-)
>----------------------------------------------------------------------
>
>
>http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/bb65af30/frameworks/p
>rojects/framework/src/mx/core/RuntimeDPIProvider.as
>----------------------------------------------------------------------
>diff --git 
>a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>index 03e3b42..8f94de4 100644
>--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
>@@ -19,9 +19,12 @@
> 
> package mx.core
> {
>+import flash.display.DisplayObject;
>+import flash.display.Stage;
> import flash.system.Capabilities;
> 
> import mx.core.mx_internal;
>+import mx.managers.SystemManager;
> 
> use namespace mx_internal;
> 
>@@ -47,6 +50,8 @@ use namespace mx_internal;
>  *        <tr><td>640 DPI</td><td>&gt;=640 DPI</td></tr>
>  *     </table>
>  *  </p>
>+ *
>+ *
>  * 
>  *  <p>Subclasses of RuntimeDPIProvider should only depend on runtime
>APIs
>  *  and should not depend on any classes specific to the Flex framework
>except
>@@ -68,7 +73,7 @@ public class RuntimeDPIProvider
> {
>     /**
>      *  Constructor.
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>@@ -77,32 +82,62 @@ public class RuntimeDPIProvider
>     public function RuntimeDPIProvider()
>     {
>     }
>-    
>+
>     /**
>      *  Returns the runtime DPI of the current device by mapping its
>      *  <code>flash.system.Capabilities.screenDPI</code> to one of
>several DPI
>      *  values in <code>mx.core.DPIClassification</code>.
>-     * 
>+     *
>      *  A number of devices can have slightly different DPI values and
>Flex maps these
>      *  into the several DPI classes.
>-     * 
>+     *
>      *  Flex uses this method to calculate the current DPI value when an
>Application
>      *  authored for a specific DPI is adapted to the current one
>through scaling.
>-     * 
>+     *
>+     *  <p> Exceptions: </p>
>+     *  <ul>
>+     *      <li>All non-retina iPads  receive 160 DPI </li>
>+     *      <li>All retina iPads  receive 320 DPI </li>
>+     *   </ul>
>+     *
>      *  @param dpi The DPI value.
>      *  @return The corresponding <code>DPIClassification</code> value.
>-     *  
>+     *           
>            isI
>      *  @see flash.system.Capabilities
>      *  @see mx.core.DPIClassification
>-     *  
>+     *
>      *  @langversion 3.0
>      *  @playerversion Flash 10
>      *  @playerversion AIR 2.5
>      *  @productversion Flex 4.5
>      */
>+
>     public function get runtimeDPI():Number
>     {
>-        return classifyDPI(Capabilities.screenDPI);
>+
>+        var isIOS:Boolean = Capabilities.version.indexOf("IOS") == 0;
>+        var screenDPI : Number= Capabilities.screenDPI;
>+
>+        if (isIOS) {
>+
>+            var root:DisplayObject = SystemManager.getSWFRoot(this);
>+            if (root != null )  {
>+                var stage:Stage = root.stage;
>+                if (stage != null){
>+                    var scX:Number = stage.fullScreenWidth;
>+                    var scY:Number = stage.fullScreenHeight;
>+                    /*  as of Dec 2013,  iPad (resp. iPad retina)   are
>the only iOS devices to have 1024 (resp. 2048) screen width or height
>+                     cf
>http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density#Apple
>+                     * */
>+                    if ((scX == 2048 || scY == 2048))
>+                        return DPIClassification.DPI_320;
>+                    else if (scX == 1024 || scY == 1024)
>+                        return DPIClassification.DPI_160;
>+                }
>+            }
>+        }
>+        return classifyDPI(screenDPI);
>+
>     }
>     
>     /**
>