Fix for https://issues.apache.org/jira/browse/FLEX-34556 (thanks to Jorn Nolles)


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

Branch: refs/heads/iso7skins
Commit: 74dca41e004668f1914b1dc494a9d454f7205e61
Parents: e72f72e
Author: OmPrakash Muppirala <bigosma...@gmail.com>
Authored: Tue Oct 7 12:26:03 2014 -0700
Committer: OmPrakash Muppirala <bigosma...@gmail.com>
Committed: Tue Oct 7 12:26:03 2014 -0700

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


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/74dca41e/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 7ce8cc7..7d82fb8 100644
--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
@@ -118,31 +118,34 @@ public class RuntimeDPIProvider
      */
 
     public function get runtimeDPI():Number
-    {
-        var isIOS:Boolean = Platform.isIOS;
-        var screenDPI:Number = Capabilities.screenDPI;
-
-        if (isIOS) // as isIPad returns false in the simulator
+       {
+               if (Platform.isIOS) // as isIPad returns false in the simulator
                {
-            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 == IPAD_RETINA_MAX_EXTENT || scY == 
IPAD_RETINA_MAX_EXTENT))
-                        return DPIClassification.DPI_320;
-                    else if (scX == IPAD_MAX_EXTENT || scY == IPAD_MAX_EXTENT)
-                        return DPIClassification.DPI_160;
-                }
-            }
-        }
-               
-        return classifyDPI(screenDPI);
-    }
+                       var scX:Number = Capabilities.screenResolutionX;
+                       var scY:Number = Capabilities.screenResolutionY;
+                                       
+                       // Use the stage width/height only when debugging, 
because Capabilities reports the computer resolution
+                       if (Capabilities.isDebugger)
+                       {
+                               var root:DisplayObject = 
SystemManager.getSWFRoot(this);
+                               if (root && root.stage)
+                               {
+                                       scX = root.stage.fullScreenWidth;
+                                       scY = root.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 == IPAD_MAX_EXTENT || scY == IPAD_MAX_EXTENT)
+                               return DPIClassification.DPI_160;
+                       else if ((scX == IPAD_RETINA_MAX_EXTENT || scY == 
IPAD_RETINA_MAX_EXTENT))
+                               return DPIClassification.DPI_320;
+               }
+                               
+               return classifyDPI(Capabilities.screenDPI);
+       }
     
     /**
      *  @private

Reply via email to