Пример #1
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);
   }
 }
Пример #2
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);
   }
 }
 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);
   }
 }
 private void clearCachePool() {
   DrawingCache item;
   while ((item = mCachePool.acquire()) != null) {
     item.destroy();
   }
 }