From 1206b9bba91f7ed899c5c87427cce725fe5aadfc Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Thu, 4 Apr 2013 14:46:24 -0700 Subject: [PATCH] Traverse layers in update order bug:8540150 Layers now require traversal in update order, as it will be child first, then parent for layer-in-layer Fixes issue with deferred layer playback not flushing in order, and thus child not painting before parent Also fixes DisplayList to only be cleared after flush in deferred list Change-Id: I2f284d00079cdb20798aeef6a1c94e823940db40 --- libs/hwui/DeferredDisplayList.h | 4 ++-- libs/hwui/Layer.cpp | 3 +-- libs/hwui/OpenGLRenderer.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h index 3e450daf888ac..653f315c69fb5 100644 --- a/libs/hwui/DeferredDisplayList.h +++ b/libs/hwui/DeferredDisplayList.h @@ -52,8 +52,6 @@ public: kOpBatch_Count, // Add other batch ids before this }; - void clear(); - bool isEmpty() { return mBatches.isEmpty(); } /** @@ -80,6 +78,8 @@ private: */ void resetBatchingState(); + void clear(); + void storeStateOpBarrier(OpenGLRenderer& renderer, StateOp* op); void storeRestoreToCountBarrier(OpenGLRenderer& renderer, StateOp* op, int newSaveCount); diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 63bb73f12775b..d257110c5088d 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -167,7 +167,6 @@ void Layer::defer() { displayList->defer(deferredState, 0); deferredUpdateScheduled = false; - displayList = NULL; } void Layer::flush() { @@ -182,7 +181,7 @@ void Layer::flush() { renderer = NULL; dirtyRect.setEmpty(); - deferredList->clear(); + displayList = NULL; } } diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 1138998432a6e..d34246d815335 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -571,8 +571,8 @@ void OpenGLRenderer::updateLayers() { startMark("Defer Layer Updates"); } - // Note: it is very important to update the layers in reverse order - for (int i = count - 1; i >= 0; i--) { + // Note: it is very important to update the layers in order + for (int i = 0; i < count; i++) { Layer* layer = mLayerUpdates.itemAt(i); updateLayer(layer, false); if (CC_UNLIKELY(mCaches.drawDeferDisabled)) { @@ -594,8 +594,8 @@ void OpenGLRenderer::flushLayers() { startMark("Apply Layer Updates"); char layerName[12]; - // Note: it is very important to update the layers in reverse order - for (int i = count - 1; i >= 0; i--) { + // Note: it is very important to update the layers in order + for (int i = 0; i < count; i++) { sprintf(layerName, "Layer #%d", i); startMark(layerName);