OSDN Git Service

Fix view z translation with 3d projection disabled
authorChris Craik <ccraik@google.com>
Thu, 16 Jan 2014 22:48:54 +0000 (14:48 -0800)
committerChris Craik <ccraik@google.com>
Thu, 16 Jan 2014 22:48:54 +0000 (14:48 -0800)
The ortho projection can't handle 3d translation, so skip that step if
perspective projection isn't enabled.

Change-Id: I231e6bcecc82e876b697e098e034f0fd3b06efde

libs/hwui/DisplayList.cpp

index d3d2613..a156341 100644 (file)
@@ -418,11 +418,16 @@ void DisplayList::setViewProperties(OpenGLRenderer& renderer, T& handler,
         renderer.concatMatrix(mAnimationMatrix);
     }
     if (mMatrixFlags != 0) {
-        if (mMatrixFlags == TRANSLATION) {
-            renderer.translate(mTranslationX, mTranslationY, mTranslationZ);
-        } else {
-            if (Caches::getInstance().propertyEnable3d) {
+        if (Caches::getInstance().propertyEnable3d) {
+            if (mMatrixFlags == TRANSLATION) {
+                renderer.translate(mTranslationX, mTranslationY, mTranslationZ);
+            } else {
                 renderer.concatMatrix(mTransform);
+            }
+        } else {
+            // avoid setting translationZ, use SkMatrix
+            if (mMatrixFlags == TRANSLATION) {
+                renderer.translate(mTranslationX, mTranslationY, 0);
             } else {
                 renderer.concatMatrix(mTransformMatrix);
             }