Updated Branches: refs/heads/develop 1277b0970 -> 0b6fa00f2
FIX FLEX-33878 avoid unnecessary matrix allocations Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/0b6fa00f Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/0b6fa00f Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/0b6fa00f Branch: refs/heads/develop Commit: 0b6fa00f277024616fbfd638ee2ebc656a8363f5 Parents: 1277b09 Author: mamsellem <[email protected]> Authored: Tue Nov 5 12:23:04 2013 +0100 Committer: mamsellem <[email protected]> Committed: Tue Nov 5 12:23:04 2013 +0100 ---------------------------------------------------------------------- .../projects/framework/src/mx/core/UIComponent.as | 8 +++++--- .../projects/framework/src/mx/utils/MatrixUtil.as | 13 +++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0b6fa00f/frameworks/projects/framework/src/mx/core/UIComponent.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/core/UIComponent.as b/frameworks/projects/framework/src/mx/core/UIComponent.as index d181000..cec9a4b 100644 --- a/frameworks/projects/framework/src/mx/core/UIComponent.as +++ b/frameworks/projects/framework/src/mx/core/UIComponent.as @@ -6093,7 +6093,8 @@ public class UIComponent extends FlexSprite { if (_layoutFeatures == null) { - _hasComplexLayoutMatrix = super.transform.matrix && !MatrixUtil.isDeltaIdentity(super.transform.matrix); + var tmpMatrix:Matrix = super.transform.matrix; + _hasComplexLayoutMatrix = tmpMatrix && !MatrixUtil.isDeltaIdentity(tmpMatrix); return _hasComplexLayoutMatrix; } else @@ -14470,7 +14471,8 @@ public class UIComponent extends FlexSprite */ public function getLayoutMatrix():Matrix { - if (_layoutFeatures != null || super.transform.matrix == null) + var superMatrix:Matrix = super.transform.matrix; + if (_layoutFeatures != null || superMatrix == null) { // TODO: this is a workaround for a situation in which the // object is in 2D, but used to be in 3D and the player has not @@ -14494,7 +14496,7 @@ public class UIComponent extends FlexSprite else { // flash also returns copies. - return super.transform.matrix; + return superMatrix; } } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/0b6fa00f/frameworks/projects/framework/src/mx/utils/MatrixUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/utils/MatrixUtil.as b/frameworks/projects/framework/src/mx/utils/MatrixUtil.as index b7ba3ff..264986e 100644 --- a/frameworks/projects/framework/src/mx/utils/MatrixUtil.as +++ b/frameworks/projects/framework/src/mx/utils/MatrixUtil.as @@ -29,7 +29,6 @@ import flash.geom.Rectangle; import flash.geom.Utils3D; import flash.geom.Vector3D; import flash.system.ApplicationDomain; -import flash.utils.getDefinitionByName; import mx.core.mx_internal; @@ -1694,8 +1693,11 @@ public final class MatrixUtil if ($transformProperty == null) $transformProperty = new QName(mx_internal, "$transform"); - - while (displayObject && displayObject.transform.matrix && displayObject != topParent) + + + var displayObjectMatrix:Matrix = displayObject ? displayObject.transform.matrix : null ; + var notTopAndHasMatrix:Boolean = displayObjectMatrix!=null && displayObject != topParent; + while (notTopAndHasMatrix) { var scrollRect:Rectangle = displayObject.scrollRect; if (scrollRect != null) @@ -1730,13 +1732,16 @@ public final class MatrixUtil else if (isUIMovieClip) m.concat(displayObject[$transformProperty].matrix); else - m.concat(displayObject.transform.matrix); + m.concat(displayObjectMatrix); // Try to access $parent, which is the true display list parent if (isUIComponent) displayObject = displayObject[fakeDollarParent] as DisplayObject; else displayObject = displayObject.parent as DisplayObject; + + displayObjectMatrix = displayObject ? displayObject.transform.matrix : null; + notTopAndHasMatrix = displayObjectMatrix!=null && displayObject != topParent; } return m; }
