Fix a couple crashes in the new reorderer
Also fixes the layer clear scissor logic in BakedOpRenderer, fixing a
flicker.
Change-Id: I61106a18938ea35e31f0a0b585b5743544245773
diff --git a/libs/hwui/FrameReorderer.cpp b/libs/hwui/FrameReorderer.cpp
index f492c7d..e95b267 100644
--- a/libs/hwui/FrameReorderer.cpp
+++ b/libs/hwui/FrameReorderer.cpp
@@ -40,7 +40,8 @@
mLayerStack.reserve(layers.entries().size());
// Prepare to defer Fbo0
- mLayerReorderers.emplace_back(viewportWidth, viewportHeight, Rect(clip));
+ auto fbo0 = mAllocator.create<LayerReorderer>(viewportWidth, viewportHeight, Rect(clip));
+ mLayerReorderers.push_back(fbo0);
mLayerStack.push_back(0);
mCanvasState.initializeSaveStack(viewportWidth, viewportHeight,
clip.fLeft, clip.fTop, clip.fRight, clip.fBottom,
@@ -602,7 +603,9 @@
// create a new layer repaint, and push its index on the stack
mLayerStack.push_back(mLayerReorderers.size());
- mLayerReorderers.emplace_back(layerWidth, layerHeight, repaintRect, beginLayerOp, renderNode);
+ auto newFbo = mAllocator.create<LayerReorderer>(layerWidth, layerHeight,
+ repaintRect, beginLayerOp, renderNode);
+ mLayerReorderers.push_back(newFbo);
}
void FrameReorderer::restoreForLayer() {
@@ -671,7 +674,7 @@
beginLayerOp.localMatrix,
beginLayerOp.localClip,
beginLayerOp.paint,
- &mLayerReorderers[finishedLayerIndex].offscreenBuffer);
+ &(mLayerReorderers[finishedLayerIndex]->offscreenBuffer));
BakedOpState* bakedOpState = tryBakeOpState(*drawLayerOp);
if (bakedOpState) {
@@ -681,7 +684,7 @@
// Layer won't be drawn - delete its drawing batches to prevent it from doing any work
// TODO: need to prevent any render work from being done
// - create layerop earlier for reject purposes?
- mLayerReorderers[finishedLayerIndex].clear();
+ mLayerReorderers[finishedLayerIndex]->clear();
return;
}
}