Unclipped savelayer support in new renderer
bug:22480459
Change-Id: I89dd5de8d7d008a1e298d227d767aabff5c96e27
diff --git a/libs/hwui/OpReorderer.cpp b/libs/hwui/OpReorderer.cpp
index 34c3d60..cff4f3c 100644
--- a/libs/hwui/OpReorderer.cpp
+++ b/libs/hwui/OpReorderer.cpp
@@ -31,7 +31,6 @@
namespace uirenderer {
class BatchBase {
-
public:
BatchBase(batchid_t batchId, BakedOpState* op, bool merging)
: mBatchId(batchId)
@@ -213,7 +212,8 @@
, repaintRect(repaintRect)
, offscreenBuffer(renderNode ? renderNode->getLayer() : nullptr)
, beginLayerOp(beginLayerOp)
- , renderNode(renderNode) {}
+ , renderNode(renderNode)
+ , viewportClip(Rect(width, height)) {}
// iterate back toward target to see if anything drawn since should overlap the new op
// if no target, merging ops still iterate to find similar batch to insert after
@@ -270,7 +270,8 @@
SimpleRectsOp* op = new (allocator) SimpleRectsOp(bounds,
Matrix4::identity(), nullptr, paint,
verts, vertCount);
- BakedOpState* bakedState = BakedOpState::directConstruct(allocator, bounds, *op);
+ BakedOpState* bakedState = BakedOpState::directConstruct(allocator,
+ &viewportClip, bounds, *op);
deferUnmergeableOp(allocator, bakedState, OpBatchType::Vertices);
@@ -1030,13 +1031,14 @@
dstRect.doIntersect(mCanvasState.currentSnapshot()->getRenderTargetClip());
// Allocate a holding position for the layer object (copyTo will produce, copyFrom will consume)
- OffscreenBuffer** layerHandle = mAllocator.create<OffscreenBuffer*>();
+ OffscreenBuffer** layerHandle = mAllocator.create<OffscreenBuffer*>(nullptr);
/**
* First, defer an operation to copy out the content from the rendertarget into a layer.
*/
auto copyToOp = new (mAllocator) CopyToLayerOp(op, layerHandle);
- BakedOpState* bakedState = BakedOpState::directConstruct(mAllocator, dstRect, *copyToOp);
+ BakedOpState* bakedState = BakedOpState::directConstruct(mAllocator,
+ &(currentLayer().viewportClip), dstRect, *copyToOp);
currentLayer().deferUnmergeableOp(mAllocator, bakedState, OpBatchType::CopyToLayer);
/**
@@ -1050,11 +1052,12 @@
* a balanced EndUnclippedLayerOp is seen
*/
auto copyFromOp = new (mAllocator) CopyFromLayerOp(op, layerHandle);
- bakedState = BakedOpState::directConstruct(mAllocator, dstRect, *copyFromOp);
+ bakedState = BakedOpState::directConstruct(mAllocator,
+ &(currentLayer().viewportClip), dstRect, *copyFromOp);
currentLayer().activeUnclippedSaveLayers.push_back(bakedState);
}
-void OpReorderer::deferEndUnclippedLayerOp(const EndUnclippedLayerOp& op) {
+void OpReorderer::deferEndUnclippedLayerOp(const EndUnclippedLayerOp& /* ignored */) {
LOG_ALWAYS_FATAL_IF(currentLayer().activeUnclippedSaveLayers.empty(), "no layer to end!");
BakedOpState* copyFromLayerOp = currentLayer().activeUnclippedSaveLayers.back();