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
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index ce4ce42..78469c4 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -80,6 +80,15 @@
kDrawOpMode_Flush
};
+enum ClipSideFlags {
+ kClipSide_Unclipped = 0x0,
+ kClipSide_Left = 0x1,
+ kClipSide_Top = 0x2,
+ kClipSide_Right = 0x4,
+ kClipSide_Bottom = 0x8,
+ kClipSide_Full = 0xF
+};
+
struct DeferredDisplayState {
// global op bounds, mapped by mMatrix to be in screen space coordinates, clipped
Rect mBounds;
@@ -87,6 +96,7 @@
// the below are set and used by the OpenGLRenderer at record and deferred playback
bool mClipValid;
Rect mClip;
+ int mClipSideFlags; // specifies which sides of the bounds are clipped, unclipped if cleared
bool mClipped;
mat4 mMatrix;
DrawModifiers mDrawModifiers;
@@ -307,7 +317,7 @@
bool storeDisplayState(DeferredDisplayState& state, int stateDeferFlags);
void restoreDisplayState(const DeferredDisplayState& state, bool skipClipRestore = false);
- void setFullScreenClip();
+ void setupMergedMultiDraw(const Rect* clipRect);
const DrawModifiers& getDrawModifiers() { return mDrawModifiers; }
void setDrawModifiers(const DrawModifiers& drawModifiers) { mDrawModifiers = drawModifiers; }