Don't set the invisible flag when saving an empty layer.
Bug #3270371
Change-Id: I65e85671c2fb70d74553c91213e5e759e0ac64ee
diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h
index 9f78063..9898df4 100644
--- a/libs/hwui/Snapshot.h
+++ b/libs/hwui/Snapshot.h
@@ -43,7 +43,7 @@
*/
class Snapshot: public LightRefBase<Snapshot> {
public:
- Snapshot(): flags(0), previous(NULL), layer(NULL), fbo(0), invisible(false) {
+ Snapshot(): flags(0), previous(NULL), layer(NULL), fbo(0), invisible(false), empty(false) {
transform = &mTransformRoot;
clipRect = &mClipRectRoot;
region = NULL;
@@ -55,7 +55,7 @@
*/
Snapshot(const sp<Snapshot>& s, int saveFlags):
flags(0), previous(s), layer(NULL), fbo(s->fbo),
- invisible(s->invisible), viewport(s->viewport), height(s->height) {
+ invisible(s->invisible), empty(false), viewport(s->viewport), height(s->height) {
if (saveFlags & SkCanvas::kMatrix_SaveFlag) {
mTransformRoot.load(*s->transform);
transform = &mTransformRoot;
@@ -203,6 +203,10 @@
flags |= Snapshot::kFlagClipSet | Snapshot::kFlagDirtyLocalClip;
}
+ bool isIgnored() const {
+ return invisible || empty;
+ }
+
/**
* Dirty flags.
*/
@@ -225,11 +229,18 @@
/**
* Indicates that this snapshot is invisible and nothing should be drawn
- * inside it.
+ * inside it. This flag is set only when the layer clips drawing to its
+ * bounds and is passed to subsequent snapshots.
*/
bool invisible;
/**
+ * If set to true, the layer will not be composited. This is similar to
+ * invisible but this flag is not passed to subsequent snapshots.
+ */
+ bool empty;
+
+ /**
* Current viewport.
*/
Rect viewport;