Add missing nothingToDraw() check
Fixes: 34598346
Prior to 2874daa4d38bddd3a5f0edb3774d5e5884dd9554 we
never freed the resources of root nodes. Now that this is being
done we need to ensure that the backdrop has content before
we try to draw that content. All other nodes passed in
deferRenderNodeScene check that nothingToDraw() returns false
before drawing them, but that check was missed on the backdrop
node.
Test: manual. open calculator then long-press on recents
Change-Id: I495749161b38b57278bdb60d5f872eeeb2b218d0
diff --git a/libs/hwui/FrameBuilder.cpp b/libs/hwui/FrameBuilder.cpp
index a53a55a..1d8b021 100644
--- a/libs/hwui/FrameBuilder.cpp
+++ b/libs/hwui/FrameBuilder.cpp
@@ -180,16 +180,18 @@
}
}
- if (!backdrop.isEmpty()) {
- // content node translation to catch up with backdrop
- float dx = contentDrawBounds.left - backdrop.left;
- float dy = contentDrawBounds.top - backdrop.top;
+ if (!nodes[1]->nothingToDraw()) {
+ if (!backdrop.isEmpty()) {
+ // content node translation to catch up with backdrop
+ float dx = contentDrawBounds.left - backdrop.left;
+ float dy = contentDrawBounds.top - backdrop.top;
- Rect contentLocalClip = backdrop;
- contentLocalClip.translate(dx, dy);
- deferRenderNode(-dx, -dy, contentLocalClip, *nodes[1]);
- } else {
- deferRenderNode(*nodes[1]);
+ Rect contentLocalClip = backdrop;
+ contentLocalClip.translate(dx, dy);
+ deferRenderNode(-dx, -dy, contentLocalClip, *nodes[1]);
+ } else {
+ deferRenderNode(*nodes[1]);
+ }
}
// remaining overlay nodes, simply defer