More colors, now with material colors

Bug: 18052916
Change-Id: I66c2573d796338ee7b7d0ddf240b90cc78a71ce5
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 706e14e..f9af15f 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -156,10 +156,18 @@
     }
 }
 
+static bool wasSkipped(FrameInfo* info) {
+    return info && ((*info)[FrameInfoIndex::kFlags] & FrameInfoFlags::kSkippedFrame);
+}
+
 void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo) {
     mRenderThread.removeFrameCallback(this);
 
-    mCurrentFrameInfo = &mFrames.next();
+    // If the previous frame was dropped we don't need to hold onto it, so
+    // just keep using the previous frame's structure instead
+    if (!wasSkipped(mCurrentFrameInfo)) {
+        mCurrentFrameInfo = &mFrames.next();
+    }
     mCurrentFrameInfo->importUiThreadInfo(uiFrameInfo);
     mCurrentFrameInfo->markSyncStart();