From 28ce94a4ffc7576f40776d212f1ada79fafaa061 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Fri, 31 May 2013 11:38:03 -0700 Subject: Overdraw avoidance and merging of clipped ops bug:8951267 If an opaque op, or group of opaque ops covers the invalidate region, skip draw operations that precede it. Clipped operations may now be merged, but only if they share a clipRect - this is a very case for e.g. ListView, where all background elements may now be a part of the same MergingDrawBatch. It is this more aggressive merging that groups together clipped background elements in the ListView case, enabling the overdraw avoidance skipping the window background. Change-Id: Ib0961977e272c5ac37f59e4c67d828467422d259 --- libs/hwui/Layer.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libs/hwui/Layer.cpp') diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 134f452aa4d1..7c22bbb6f973 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -188,12 +188,6 @@ void Layer::allocateTexture() { } void Layer::defer() { - if (!deferredList) { - deferredList = new DeferredDisplayList; - } - DeferStateStruct deferredState(*deferredList, *renderer, - DisplayList::kReplayFlag_ClipChildren); - const float width = layer.getWidth(); const float height = layer.getHeight(); @@ -202,6 +196,14 @@ void Layer::defer() { dirtyRect.set(0, 0, width, height); } + if (deferredList) { + deferredList->reset(dirtyRect); + } else { + deferredList = new DeferredDisplayList(dirtyRect); + } + DeferStateStruct deferredState(*deferredList, *renderer, + DisplayList::kReplayFlag_ClipChildren); + renderer->initViewport(width, height); renderer->setupFrameState(dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom, !isBlend()); -- cgit v1.2.3-59-g8ed1b