diff options
Diffstat (limited to 'libs/hwui/DisplayListRenderer.cpp')
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index cc72df6..6ca70a4 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -143,6 +143,7 @@ void DisplayList::destroyDisplayListDeferred(DisplayList* displayList) { void DisplayList::clearResources() { sk_free((void*) mReader.base()); + mReader.setMemory(NULL, 0); delete mTransformMatrix; delete mTransformCamera; @@ -157,6 +158,7 @@ void DisplayList::clearResources() { mAnimationMatrix = NULL; Caches& caches = Caches::getInstance(); + caches.unregisterFunctors(mFunctorCount); caches.resourceCache.lock(); for (size_t i = 0; i < mBitmapResources.size(); i++) { @@ -215,24 +217,28 @@ void DisplayList::clearResources() { void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorder, bool reusing) { const SkWriter32& writer = recorder.writeStream(); - init(); - - if (writer.size() == 0) { - return; - } if (reusing) { // re-using display list - clear out previous allocations clearResources(); } + + init(); initProperties(); + if (writer.size() == 0) { + return; + } + mSize = writer.size(); void* buffer = sk_malloc_throw(mSize); writer.flatten(buffer); mReader.setMemory(buffer, mSize); + mFunctorCount = recorder.getFunctorCount(); + Caches& caches = Caches::getInstance(); + caches.registerFunctors(mFunctorCount); caches.resourceCache.lock(); const Vector<SkBitmap*>& bitmapResources = recorder.getBitmapResources(); @@ -296,6 +302,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde void DisplayList::init() { mSize = 0; mIsRenderable = true; + mFunctorCount = 0; } size_t DisplayList::getSize() { @@ -1340,7 +1347,8 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag DisplayListRenderer::DisplayListRenderer(): mCaches(Caches::getInstance()), mWriter(MIN_WRITER_SIZE), - mTranslateX(0.0f), mTranslateY(0.0f), mHasTranslate(false), mHasDrawOps(false) { + mTranslateX(0.0f), mTranslateY(0.0f), mHasTranslate(false), + mHasDrawOps(false), mFunctorCount(0) { } DisplayListRenderer::~DisplayListRenderer() { @@ -1397,6 +1405,7 @@ void DisplayListRenderer::reset() { mLayers.clear(); mHasDrawOps = false; + mFunctorCount = 0; } /////////////////////////////////////////////////////////////////////////////// @@ -1453,6 +1462,7 @@ status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty) // Ignore dirty during recording, it matters only when we replay addOp(DisplayList::DrawGLFunction); addInt((int) functor); + mFunctorCount++; return DrawGlInfo::kStatusDone; // No invalidate needed at record-time } |