Updated Branches: refs/heads/NewDPIBuckets 22b68dedd -> 651b2ed8e
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/NewDPIBuckets Commit: 786fc5d0179bbede32c6de68e1f1bc65f8cc809f Parents: 22b68de Author: Justin Mclean <jmcl...@apache.org> Authored: Sat Aug 10 03:48:17 2013 +1000 Committer: Justin Mclean <jmcl...@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><200 DPI</td></tr> - * <tr><td>240 DPI</td><td>>=200 DPI and <280 DPI</td></tr> - * <tr><td>320 DPI</td><td>>=280 DPI and <400 DPI</td></tr> - * <tr><td>480 DPI</td><td>>=400 DPI</td></tr> + * <tr><td>160 DPI</td><td><140 DPI</td></tr> + * <tr><td>160 DPI</td><td>>=140 DPI and <=200 DPI</td></tr> + * <tr><td>240 DPI</td><td>>=200 DPI and <=280 DPI</td></tr> + * <tr><td>320 DPI</td><td>>=280 DPI and <=400 DPI</td></tr> + * <tr><td>480 DPI</td><td>>=400 DPI and <=560 DPI</td></tr> + * <tr><td>640 DPI</td><td>>=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; }