diff options
author | 2014-04-09 23:01:02 +0000 | |
---|---|---|
committer | 2014-04-09 23:01:02 +0000 | |
commit | 8e1f918738abf70a4dc86dbb12b386a9deea37f8 (patch) | |
tree | 2f8b775662768ed77b50ec5740e5d7af608e56c8 /libs/hwui/RenderNode.cpp | |
parent | 3c86a27d3e9044d04d0f176e59a1ebbcd774a54c (diff) | |
parent | 8de65a8e05285df52a1e6f0c1d5616dd233298a7 (diff) |
Merge "Switch DisplayListData to a staging model"
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 501007679308..761fb84c25ab 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -49,7 +49,12 @@ void RenderNode::outputLogBuffer(int fd) { fflush(file); } -RenderNode::RenderNode() : mDestroyed(false), mNeedsPropertiesSync(false), mDisplayListData(0) { +RenderNode::RenderNode() + : mDestroyed(false) + , mNeedsPropertiesSync(false) + , mNeedsDisplayListDataSync(false) + , mDisplayListData(0) + , mStagingDisplayListData(0) { } RenderNode::~RenderNode() { @@ -57,13 +62,15 @@ RenderNode::~RenderNode() { mDestroyed = true; delete mDisplayListData; + delete mStagingDisplayListData; } -void RenderNode::setData(DisplayListData* data) { - delete mDisplayListData; - mDisplayListData = data; - if (mDisplayListData) { - Caches::getInstance().registerFunctors(mDisplayListData->functorCount); +void RenderNode::setStagingDisplayList(DisplayListData* data) { + mNeedsDisplayListDataSync = true; + delete mStagingDisplayListData; + mStagingDisplayListData = data; + if (mStagingDisplayListData) { + Caches::getInstance().registerFunctors(mStagingDisplayListData->functorCount); } } @@ -86,16 +93,29 @@ void RenderNode::output(uint32_t level) { ALOGD("%*sDone (%p, %s)", (level - 1) * 2, "", this, mName.string()); } -void RenderNode::updateProperties() { +void RenderNode::pushStagingChanges() { if (mNeedsPropertiesSync) { mNeedsPropertiesSync = false; mProperties = mStagingProperties; } + if (mNeedsDisplayListDataSync) { + mNeedsDisplayListDataSync = false; + // Do a push pass on the old tree to handle freeing DisplayListData + // that are no longer used + pushSubTreeStagingChanges(mDisplayListData); + delete mDisplayListData; + mDisplayListData = mStagingDisplayListData; + mStagingDisplayListData = 0; + } + + pushSubTreeStagingChanges(mDisplayListData); +} - if (mDisplayListData) { - for (size_t i = 0; i < mDisplayListData->children().size(); i++) { - RenderNode* childNode = mDisplayListData->children()[i]->mDisplayList; - childNode->updateProperties(); +void RenderNode::pushSubTreeStagingChanges(DisplayListData* subtree) { + if (subtree) { + for (size_t i = 0; i < subtree->children().size(); i++) { + RenderNode* childNode = subtree->children()[i]->mDisplayList; + childNode->pushStagingChanges(); } } } |