예제 #1
0
 public RectCache(int capity) {
   mCapity = capity;
   mRectsCachePool = Pools.finitePool(manager, mCapity);
   for (int i = 0; i < mCapity; i++) {
     mRectsCachePool.release(new RectPoolableCache(new float[4]));
   }
 }
 protected void entryRemoved(boolean evicted, BaseDanmaku oldValue, BaseDanmaku newValue) {
   if (oldValue.cache != null) {
     IDrawingCache<?> cache = oldValue.cache;
     long releasedSize = clearCache(oldValue);
     if (releasedSize <= 0) return;
     mRealSize -= releasedSize;
     mCachePool.release((DrawingCache) cache);
   }
 }
예제 #3
0
 public void push(float[] rect) {
   if (mRects.size() >= mCapity) {
     RectPoolableCache rc = mRects.removeFirst();
     mRectsCachePool.release(rc);
   }
   RectPoolableCache rc = mRectsCachePool.acquire();
   if (rc != null) {
     rc.setRect(rect);
     mRects.add(rc);
   }
 }
 protected void entryRemoved(boolean evicted, BaseDanmaku oldValue, BaseDanmaku newValue) {
   if (oldValue.cache != null) {
     IDrawingCache<?> cache = oldValue.cache;
     long releasedSize = clearCache(oldValue);
     if (oldValue.isTimeOut()) {
       mContext.getDisplayer().getCacheStuffer().releaseResource(oldValue);
     }
     if (releasedSize <= 0) return;
     mRealSize -= releasedSize;
     mCachePool.release((DrawingCache) cache);
   }
 }