コード例 #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]));
   }
 }
コード例 #2
0
 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);
   }
 }
コード例 #4
0
 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);
   }
 }