Support projection of DisplayLists onto ancestors.

For now, ancestor views signal the acceptance of projections with a
save(0x20)/restore pair.

During the order traversal, each view with the save(0x20) code will
collect descendent views with mProjectToContainedVolume (which still
needs to be renamed) so that they can be drawn out of order later.

- *Temporary* sample code added to HwAccelerationTest.

- Note that a projected displaylist must not be clipped.

Change-Id: I45c493e845961535b958d59c53e8aff3f8891d9f
diff --git a/libs/hwui/DisplayList.h b/libs/hwui/DisplayList.h
index d3113a3..5399185 100644
--- a/libs/hwui/DisplayList.h
+++ b/libs/hwui/DisplayList.h
@@ -112,6 +112,7 @@
  */
 class DisplayListData : public LightRefBase<DisplayListData> {
 public:
+    DisplayListData() : projectionIndex(-1) {}
     // allocator into which all ops were allocated
     LinearAllocator allocator;
 
@@ -120,6 +121,10 @@
 
     // list of children display lists for quick, non-drawing traversal
     Vector<DrawDisplayListOp*> children;
+
+    // index of DisplayListOp restore, after which projected descendents should be drawn
+    int projectionIndex;
+    Matrix4 projectionTransform;
 };
 
 /**
@@ -522,8 +527,10 @@
     void applyViewPropertyTransforms(mat4& matrix);
 
     void computeOrderingImpl(DrawDisplayListOp* opState,
-            Vector<ZDrawDisplayListOpPair>* compositedChildrenOf3dRoot,
-            const mat4* transformFromRoot);
+        Vector<ZDrawDisplayListOpPair>* compositedChildrenOf3dRoot,
+        const mat4* transformFrom3dRoot,
+        Vector<DrawDisplayListOp*>* compositedChildrenOfProjectionSurface,
+        const mat4* transformFromProjectionSurface);
 
     template <class T>
     inline void setViewProperties(OpenGLRenderer& renderer, T& handler, const int level);
@@ -533,6 +540,9 @@
         T& handler, const int level);
 
     template <class T>
+    inline void iterateProjectedChildren(OpenGLRenderer& renderer, T& handler, const int level);
+
+    template <class T>
     inline void iterate(OpenGLRenderer& renderer, T& handler, const int level);
 
     void init();
@@ -610,6 +620,9 @@
 
     // for 3d roots, contains a z sorted list of all children items
     Vector<ZDrawDisplayListOpPair> m3dNodes;
+
+    // for projection surfaces, contains a list of all children items
+    Vector<DrawDisplayListOp*> mProjectedNodes;
 }; // class DisplayList
 
 }; // namespace uirenderer