diff options
| author | Chris Craik <ccraik@google.com> | 2013-10-25 18:30:17 -0700 |
|---|---|---|
| committer | Chris Craik <ccraik@google.com> | 2013-12-12 10:18:23 -0800 |
| commit | f57776b2d195f0937906eb88b777bb55ccc36967 (patch) | |
| tree | f2c160bb0860a6f3d0f883cdf0c520892a1bde24 /core/java/android/view/View.java | |
| parent | c3c4d36df01631883a79163da841ca222497c9d3 (diff) | |
| download | frameworks_base-f57776b2d195f0937906eb88b777bb55ccc36967.zip frameworks_base-f57776b2d195f0937906eb88b777bb55ccc36967.tar.gz frameworks_base-f57776b2d195f0937906eb88b777bb55ccc36967.tar.bz2 | |
3d view system!
True 3d transformations are now supported by DisplayLists and the
renderer, initially with the translationZ property on view.
Renderer operations used directly by DisplayList (formerly,
clip/save/restore/saveLayer) are now more simply managed by allocating
them temporarily on the handler's allocator, which exists for a single
frame. This is much simpler than continuing to expand the pool of
pre-allocated DisplayListOps now that more operations are called
directly by DisplayList, especially with z ordered drawing.
Still TODO:
-APIs for camera positioning, shadows
-Make Z apis public, and expose through XML
-Make invalidation / input 3d aware
Change-Id: I95fe6fa03f9b6ddd34a7e0c6ec8dd9fe47c6c6eb
Diffstat (limited to 'core/java/android/view/View.java')
| -rw-r--r-- | core/java/android/view/View.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5d264b6..4b97c40 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2981,6 +2981,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @ViewDebug.ExportedProperty float mTranslationY = 0f; + @ViewDebug.ExportedProperty + float mTranslationZ = 0f; + /** * The amount of scale in the x direction around the pivot point. A * value of 1 means no scaling is applied. @@ -10484,6 +10487,35 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * @hide + */ + @ViewDebug.ExportedProperty(category = "drawing") + public float getTranslationZ() { + return mTransformationInfo != null ? mTransformationInfo.mTranslationZ : 0; + } + + /** + * @hide + */ + public void setTranslationZ(float translationZ) { + ensureTransformationInfo(); + final TransformationInfo info = mTransformationInfo; + if (info.mTranslationZ != translationZ) { + invalidateViewProperty(true, false); + info.mTranslationZ = translationZ; + info.mMatrixDirty = true; + invalidateViewProperty(false, true); + if (mDisplayList != null) { + mDisplayList.setTranslationZ(translationZ); + } + if ((mPrivateFlags2 & PFLAG2_VIEW_QUICK_REJECTED) == PFLAG2_VIEW_QUICK_REJECTED) { + // View was rejected last time it was drawn by its parent; this may have changed + invalidateParentIfNeeded(); + } + } + } + + /** * Hit rectangle in parent's coordinates * * @param outRect The hit rectangle of the view. @@ -14142,6 +14174,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } displayList.setTransformationInfo(alpha, mTransformationInfo.mTranslationX, mTransformationInfo.mTranslationY, + mTransformationInfo.mTranslationZ, mTransformationInfo.mRotation, mTransformationInfo.mRotationX, mTransformationInfo.mRotationY, mTransformationInfo.mScaleX, mTransformationInfo.mScaleY); |
