From aa6e84f21ddf89ea649a3f00044bc23adfe86978 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 16 Jun 2016 15:36:13 -0700 Subject: Move SurfaceView offscreen if the app stops drawing it Bug: 29360411 Change-Id: Iefb9d7a9dafb34a2b4f79130a2a8b5a7cf7de906 --- libs/hwui/RenderNode.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'libs/hwui/RenderNode.h') diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h index acdc3d835b4d..f80be5ec9ae9 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -196,7 +196,7 @@ public: } ANDROID_API virtual void prepareTree(TreeInfo& info); - void destroyHardwareResources(TreeObserver* observer); + void destroyHardwareResources(TreeObserver* observer, TreeInfo* info = nullptr); // UI thread only! ANDROID_API void addAnimator(const sp& animator); @@ -228,10 +228,19 @@ public: OffscreenBuffer** getLayerHandle() { return &mLayer; } // ugh... #endif + // Note: The position callbacks are relying on the listener using + // the frameNumber to appropriately batch/synchronize these transactions. + // There is no other filtering/batching to ensure that only the "final" + // state called once per frame. class ANDROID_API PositionListener { public: virtual ~PositionListener() {} + // Called when the RenderNode's position changes virtual void onPositionUpdated(RenderNode& node, const TreeInfo& info) = 0; + // Called when the RenderNode no longer has a position. As in, it's + // no longer being drawn. + // Note, tree info might be null + virtual void onPositionLost(RenderNode& node, const TreeInfo* info) = 0; }; // Note this is not thread safe, this needs to be called @@ -306,7 +315,7 @@ private: void syncProperties(); - void syncDisplayList(TreeObserver* observer); + void syncDisplayList(TreeInfo* info); void prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer); void pushStagingPropertiesChanges(TreeInfo& info); @@ -317,11 +326,11 @@ private: #endif void prepareLayer(TreeInfo& info, uint32_t dirtyMask); void pushLayerUpdate(TreeInfo& info); - void deleteDisplayList(TreeObserver* observer); + void deleteDisplayList(TreeObserver* observer, TreeInfo* info = nullptr); void damageSelf(TreeInfo& info); void incParentRefCount() { mParentCount++; } - void decParentRefCount(TreeObserver* observer); + void decParentRefCount(TreeObserver* observer, TreeInfo* info = nullptr); String8 mName; sp mUserContext; -- cgit v1.2.3-59-g8ed1b