flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcl...@apache.org
Subject [01/41] git commit: [flex-sdk] [refs/heads/develop] - Added 160 and 640 DPI constants
Date Sun, 01 Sep 2013 23:40:03 GMT
Updated Branches:
  refs/heads/develop 65c219c11 -> dea298c0d


Added 160 and 640 DPI constants


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

Branch: refs/heads/develop
Commit: 786fc5d0179bbede32c6de68e1f1bc65f8cc809f
Parents: 22b68de
Author: Justin Mclean <jmclean@apache.org>
Authored: Sat Aug 10 03:48:17 2013 +1000
Committer: Justin Mclean <jmclean@apache.org>
Committed: Sat Aug 10 03:48:17 2013 +1000

----------------------------------------------------------------------
 .../framework/src/mx/core/DPIClassification.as  | 22 +++++++++++++++++++-
 .../framework/src/mx/core/RuntimeDPIProvider.as | 20 ++++++++++++------
 .../framework/src/mx/utils/DensityUtil.as       |  4 ++--
 3 files changed, 37 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/786fc5d0/frameworks/projects/framework/src/mx/core/DPIClassification.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/core/DPIClassification.as b/frameworks/projects/framework/src/mx/core/DPIClassification.as
index f1d09d2..acd4a2d 100644
--- a/frameworks/projects/framework/src/mx/core/DPIClassification.as
+++ b/frameworks/projects/framework/src/mx/core/DPIClassification.as
@@ -35,6 +35,16 @@ package mx.core
  */
 public final class DPIClassification
 {
+	/**
+	 *  Density value for extra-low-density devices.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 2.5
+	 *  @productversion ApacheFlex 4.11
+	 */
+	public static const DPI_120:Number = 120;
+	
     /**
      *  Density value for low-density devices.
      *  
@@ -66,7 +76,7 @@ public final class DPIClassification
 	public static const DPI_320:Number = 320;
 	
 	/**
-	 *  Density value for high-density devices.
+	 *  Density value for extra-high-density devices.
 	 *  
 	 *  @langversion 3.0
 	 *  @playerversion Flash 10
@@ -74,5 +84,15 @@ public final class DPIClassification
 	 *  @productversion ApacheFlex 4.10
 	 */
 	public static const DPI_480:Number = 480;
+	
+	/**
+	 *  Density value for extra-extra-high-density devices.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10
+	 *  @playerversion AIR 2.5
+	 *  @productversion ApacheFlex 4.11
+	 */
+	public static const DPI_640:Number = 640;
 }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/786fc5d0/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 6eca5d8..03e3b42 100644
--- a/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
+++ b/frameworks/projects/framework/src/mx/core/RuntimeDPIProvider.as
@@ -39,10 +39,12 @@ use namespace mx_internal;
  * 
  *  <p>Flex's default mappings are:
  *     <table class="innertable">
- *        <tr><td>160 DPI</td><td>&lt;200 DPI</td></tr>
- *        <tr><td>240 DPI</td><td>&gt;=200 DPI and &lt;280
DPI</td></tr>
- *        <tr><td>320 DPI</td><td>&gt;=280 DPI and &lt;400
DPI</td></tr>
- *        <tr><td>480 DPI</td><td>&gt;=400 DPI</td></tr>
+ *        <tr><td>160 DPI</td><td>&lt;140 DPI</td></tr>
+ *        <tr><td>160 DPI</td><td>&gt;=140 DPI and &lt;=200
DPI</td></tr>
+ *        <tr><td>240 DPI</td><td>&gt;=200 DPI and &lt;=280
DPI</td></tr>
+ *        <tr><td>320 DPI</td><td>&gt;=280 DPI and &lt;=400
DPI</td></tr>
+ *        <tr><td>480 DPI</td><td>&gt;=400 DPI and &lt;=560
DPI</td></tr>
+ *        <tr><td>640 DPI</td><td>&gt;=640 DPI</td></tr>
  *     </table>
  *  </p>
  * 
@@ -117,7 +119,10 @@ public class RuntimeDPIProvider
      */
     mx_internal static function classifyDPI(dpi:Number):Number
     {
-        if (dpi < 200)
+		if (dpi <= 140)
+			return DPIClassification.DPI_120;
+		
+        if (dpi <= 200)
             return DPIClassification.DPI_160;
         
         if (dpi <= 280)
@@ -125,8 +130,11 @@ public class RuntimeDPIProvider
 		
 		if (dpi <= 400)
 			return DPIClassification.DPI_320;
+		
+		if (dpi <= 560)
+			return DPIClassification.DPI_480;
         
-        return DPIClassification.DPI_480;
+        return DPIClassification.DPI_640;
     }
 }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/786fc5d0/frameworks/projects/framework/src/mx/utils/DensityUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/framework/src/mx/utils/DensityUtil.as b/frameworks/projects/framework/src/mx/utils/DensityUtil.as
index d0e1acb..e80bad5 100644
--- a/frameworks/projects/framework/src/mx/utils/DensityUtil.as
+++ b/frameworks/projects/framework/src/mx/utils/DensityUtil.as
@@ -86,8 +86,8 @@ public class DensityUtil
     public static function getDPIScale(sourceDPI:Number, targetDPI:Number):Number
     {
         // Unknown dpi returns NaN
-        if ((sourceDPI != DPIClassification.DPI_160 && sourceDPI != DPIClassification.DPI_240
&& sourceDPI != DPIClassification.DPI_320 && sourceDPI != DPIClassification.DPI_480)
||
-            (targetDPI != DPIClassification.DPI_160 && targetDPI != DPIClassification.DPI_240
&& targetDPI != DPIClassification.DPI_320 && targetDPI != DPIClassification.DPI_480))
+        if ((sourceDPI != DPIClassification.DPI_120 && sourceDPI != DPIClassification.DPI_160
&& sourceDPI != DPIClassification.DPI_240 && sourceDPI != DPIClassification.DPI_320
&& sourceDPI != DPIClassification.DPI_480 && sourceDPI != DPIClassification.DPI_640)
||
+            (targetDPI != DPIClassification.DPI_120 && targetDPI != DPIClassification.DPI_160
&& targetDPI != DPIClassification.DPI_240 && targetDPI != DPIClassification.DPI_320
&& targetDPI != DPIClassification.DPI_480 && targetDPI != DPIClassification.DPI_640))
         {
             return NaN;
         }


Mime
View raw message