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/10/06 15:57:50 UTC

[09/25] git commit: [flex-sdk] [refs/heads/mobileexperimental] - FLEX-33739 removed duplication

FLEX-33739 removed duplication


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

Branch: refs/heads/mobileexperimental
Commit: c1173bda4177f9675b2a91db124bc2b9210e798c
Parents: a7534ce
Author: Justin Mclean <jm...@apache.org>
Authored: Fri Oct 4 09:55:26 2013 +1000
Committer: Justin Mclean <jm...@apache.org>
Committed: Fri Oct 4 09:55:26 2013 +1000

----------------------------------------------------------------------
 .../src/spark/components/IconItemRenderer.as    |  9 +------
 .../supportClasses/ViewNavigatorBase.as         | 11 +-------
 .../spark/src/spark/primitives/BitmapImage.as   | 17 +-----------
 .../src/spark/utils/MultiDPIBitmapSource.as     | 28 ++++++++++++++++++++
 4 files changed, 31 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c1173bda/frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as b/frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as
index 1f34cfc..3b050e4 100644
--- a/frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as
+++ b/frameworks/projects/mobilecomponents/src/spark/components/IconItemRenderer.as
@@ -1762,14 +1762,7 @@ public class IconItemRenderer extends LabelItemRenderer
             // get the icon source to find out if it is external or not
             if (source is MultiDPIBitmapSource)
             {
-                var app:Object = FlexGlobals.topLevelApplication;
-                var dpi:Number;
-                if ("runtimeDPI" in app)
-                    dpi = app["runtimeDPI"];
-                else
-                    dpi = DensityUtil.getRuntimeDPI();
-                
-                var multiSource:Object = MultiDPIBitmapSource(source).getSource(dpi);  
+                var multiSource:Object = MultiDPIBitmapSource(source).getMultiSource();  
                 isExternalSource = (multiSource is String || multiSource is URLRequest);
             }
         }        

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c1173bda/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as
index 5a04fc1..140b705 100644
--- a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as
+++ b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewNavigatorBase.as
@@ -454,16 +454,7 @@ public class ViewNavigatorBase extends SkinnableContainer
         var iconData:Object = icon;
         
         if (iconData is MultiDPIBitmapSource)
-        {
-            var app:Object = FlexGlobals.topLevelApplication;
-            var dpi:Number;
-            if ("runtimeDPI" in app)
-                dpi = app["runtimeDPI"];
-            else
-                dpi = DensityUtil.getRuntimeDPI();
-
-            iconData = MultiDPIBitmapSource(iconData).getSource(dpi);
-        }
+            iconData = MultiDPIBitmapSource(iconData).getMultiSource();
         
         if (iconData is Class)
             return {label:label, iconClassName:getQualifiedClassName(iconData)};

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c1173bda/frameworks/projects/spark/src/spark/primitives/BitmapImage.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/primitives/BitmapImage.as b/frameworks/projects/spark/src/spark/primitives/BitmapImage.as
index 67e80b8..bc27a57 100644
--- a/frameworks/projects/spark/src/spark/primitives/BitmapImage.as
+++ b/frameworks/projects/spark/src/spark/primitives/BitmapImage.as
@@ -1406,7 +1406,7 @@ public class BitmapImage extends GraphicElement
         var tmpSprite:DisplayObject;
 
         if (value is MultiDPIBitmapSource)
-            value = getActualValue(value as MultiDPIBitmapSource);
+            value = (value as MultiDPIBitmapSource).getMultiSource();
 
         // Clear the previous scaleGrid properties
         _scaleGridLeft = NaN;
@@ -1508,21 +1508,6 @@ public class BitmapImage extends GraphicElement
 
         setBitmapData(bitmapData, currentBitmapCreated);
     }
-
-    /**
-     *  @private
-     *  Figure out which source to use
-     */
-    mx_internal function getActualValue(values:MultiDPIBitmapSource):Object
-    {
-        var app:Object = FlexGlobals.topLevelApplication;
-        var dpi:Number;
-        if ("runtimeDPI" in app)
-            dpi = app["runtimeDPI"];
-        else
-            dpi = DensityUtil.getRuntimeDPI();
-        return values.getSource(dpi);
-    }
 	
 	
 	/**

http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/c1173bda/frameworks/projects/spark/src/spark/utils/MultiDPIBitmapSource.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/utils/MultiDPIBitmapSource.as b/frameworks/projects/spark/src/spark/utils/MultiDPIBitmapSource.as
index 4de2a4b..30e2c9c 100644
--- a/frameworks/projects/spark/src/spark/utils/MultiDPIBitmapSource.as
+++ b/frameworks/projects/spark/src/spark/utils/MultiDPIBitmapSource.as
@@ -20,6 +20,9 @@
 package spark.utils
 {
 import mx.core.DPIClassification;
+import mx.core.FlexGlobals;
+
+import mx.utils.DensityUtil;
     
 /**
  *  This class provides a list of bitmaps for various runtime densities.  It is supplied
@@ -100,6 +103,31 @@ public class MultiDPIBitmapSource
 	 *  @productversion ApacheFlex 4.11
 	 */
 	public var source640dpi:Object;
+	
+	/**
+	 *  Select one of the sourceXXXdpi properties based on the run time DPI.
+	 *
+	 *  @return One of the sourceXXXdpi properties based on the run time DPI.
+	 * 
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Flex 4.11
+	 */
+	public function getMultiSource():Object {
+		var app:Object = FlexGlobals.topLevelApplication;
+		var dpi:Number;
+		var multiSource:Object;
+		
+		if ("runtimeDPI" in app)
+			dpi = app["runtimeDPI"];
+		else
+			dpi = DensityUtil.getRuntimeDPI();
+		
+		multiSource = getSource(dpi);
+		
+		return multiSource;
+	}
     
     /**
      *  Select one of the sourceXXXdpi properties based on the given DPI.  This