@@ -157,6 +157,7 @@ void DisplayList::clearResources() {
157157 mAnimationMatrix = NULL ;
158158
159159 Caches& caches = Caches::getInstance ();
160+ caches.unregisterFunctors (mFunctorCount );
160161 caches.resourceCache .lock ();
161162
162163 for (size_t i = 0 ; i < mBitmapResources .size (); i++) {
@@ -218,6 +219,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde
218219 init ();
219220
220221 if (writer.size () == 0 ) {
222+ mFunctorCount = 0 ;
221223 return ;
222224 }
223225
@@ -232,7 +234,10 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde
232234 writer.flatten (buffer);
233235 mReader .setMemory (buffer, mSize );
234236
237+ mFunctorCount = recorder.getFunctorCount ();
238+
235239 Caches& caches = Caches::getInstance ();
240+ caches.registerFunctors (mFunctorCount );
236241 caches.resourceCache .lock ();
237242
238243 const Vector<SkBitmap*>& bitmapResources = recorder.getBitmapResources ();
@@ -1340,7 +1345,8 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag
13401345
13411346DisplayListRenderer::DisplayListRenderer ():
13421347 mCaches (Caches::getInstance()), mWriter (MIN_WRITER_SIZE),
1343- mTranslateX (0 .0f ), mTranslateY (0 .0f ), mHasTranslate (false ), mHasDrawOps (false ) {
1348+ mTranslateX (0 .0f ), mTranslateY (0 .0f ), mHasTranslate (false ),
1349+ mHasDrawOps (false ), mFunctorCount (0 ) {
13441350}
13451351
13461352DisplayListRenderer::~DisplayListRenderer () {
@@ -1397,6 +1403,7 @@ void DisplayListRenderer::reset() {
13971403 mLayers .clear ();
13981404
13991405 mHasDrawOps = false ;
1406+ mFunctorCount = 0 ;
14001407}
14011408
14021409// /////////////////////////////////////////////////////////////////////////////
@@ -1453,6 +1460,7 @@ status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty)
14531460 // Ignore dirty during recording, it matters only when we replay
14541461 addOp (DisplayList::DrawGLFunction);
14551462 addInt ((int ) functor);
1463+ mFunctorCount ++;
14561464 return DrawGlInfo::kStatusDone ; // No invalidate needed at record-time
14571465}
14581466
0 commit comments