本文整理汇总了Java中master.flame.danmaku.danmaku.model.android.DrawingCache类的典型用法代码示例。如果您正苦于以下问题:Java DrawingCache类的具体用法?Java DrawingCache怎么用?Java DrawingCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DrawingCache类属于master.flame.danmaku.danmaku.model.android包,在下文中一共展示了DrawingCache类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCache
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
public boolean createCache(BaseDanmaku item) {
if (!item.isMeasured()) {
item.measure(CacheManagingDrawTask.this.mDisp, true);
}
DrawingCache cache = null;
try {
cache = DanmakuUtils.buildDanmakuDrawingCache(item, CacheManagingDrawTask.this.mDisp, (DrawingCache) CacheManager.this.mCachePool.acquire());
item.cache = cache;
return true;
} catch (OutOfMemoryError e) {
if (cache != null) {
CacheManager.this.mCachePool.release(cache);
}
item.cache = null;
return false;
} catch (Exception e2) {
if (cache != null) {
CacheManager.this.mCachePool.release(cache);
}
item.cache = null;
return false;
}
}
示例2: releaseDanmakuCache
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
private void releaseDanmakuCache(BaseDanmaku item, DrawingCache cache) {
if (cache == null) {
cache = item.cache;
}
item.cache = null;
if (cache != null) {
cache.destroy();
CacheManager.this.mCachePool.release(cache);
}
}
示例3: clearCachePool
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
private void clearCachePool() {
while (true) {
DrawingCache item = (DrawingCache) this.mCachePool.acquire();
if (item != null) {
item.destroy();
} else {
return;
}
}
}
示例4: entryRemoved
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
protected void entryRemoved(boolean evicted, BaseDanmaku oldValue, BaseDanmaku newValue) {
IDrawingCache<?> cache = oldValue.getDrawingCache();
if (cache != null) {
long releasedSize = clearCache(oldValue);
if (oldValue.isTimeOut()) {
mContext.getDisplayer().getCacheStuffer().releaseResource(oldValue);
}
if (releasedSize <= 0) return;
mRealSize -= releasedSize;
mCachePool.release((DrawingCache) cache);
}
}
示例5: entryRemoved
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
protected void entryRemoved(boolean evicted, BaseDanmaku oldValue, BaseDanmaku newValue) {
if (oldValue.cache != null) {
if (oldValue.cache.hasReferences()) {
oldValue.cache.decreaseReference();
oldValue.cache = null;
return;
}
mRealSize -= sizeOf(oldValue);
oldValue.cache.destroy();
mCachePool.release((DrawingCache) oldValue.cache);
oldValue.cache = null;
}
}
示例6: entryRemoved
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
protected void entryRemoved(boolean evicted, BaseDanmaku oldValue, BaseDanmaku newValue) {
if (oldValue.cache != null) {
if (oldValue.cache.hasReferences()) {
oldValue.cache.decreaseReference();
oldValue.cache = null;
return;
}
mRealSize -= sizeOf(oldValue);
oldValue.cache.destroy();
mCachePool.release((DrawingCache) oldValue.cache);
oldValue.cache = null;
}
}
示例7: clearCachePool
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
private void clearCachePool() {
DrawingCache item;
while ((item = mCachePool.acquire()) != null) {
item.destroy();
}
}
示例8: handleMessage
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
int what = msg.what;
switch (what) {
case PREPARE:
evictAllNotInScreen();
for (int i = 0; i < 300; i++) {
mCachePool.release(new DrawingCache());
}
case DISPATCH_ACTIONS:
//Log.e(TAG,"dispatch_actions:"+mCacheTimer.currMillisecond+":"+mTimer.currMillisecond);
long delayed = dispatchAction();
if (delayed <= 0) {
delayed = mContext.mDanmakuFactory.MAX_DANMAKU_DURATION / 2;
}
sendEmptyMessageDelayed(DISPATCH_ACTIONS, delayed);
break;
case BUILD_CACHES:
removeMessages(BUILD_CACHES);
boolean repositioned = ((mTaskListener != null && mReadyState == false) || mSeekedFlag);
prepareCaches(repositioned);
if (repositioned)
mSeekedFlag = false;
if (mTaskListener != null && mReadyState == false) {
mTaskListener.ready();
mReadyState = true;
}
// Log.i(TAG,"BUILD_CACHES:"+mCacheTimer.currMillisecond+":"+mTimer.currMillisecond);
break;
case ADD_DANMAKKU:
BaseDanmaku item = (BaseDanmaku) msg.obj;
addDanmakuAndBuildCache(item);
break;
case CLEAR_TIMEOUT_CACHES:
clearTimeOutCaches();
break;
case SEEK:
Long seekMills = (Long) msg.obj;
if (seekMills != null) {
mCacheTimer.update(seekMills.longValue());
mSeekedFlag = true;
evictAllNotInScreen();
resume();
}
break;
case QUIT:
removeCallbacksAndMessages(null);
mPause = true;
evictAll();
clearCachePool();
this.getLooper().quit();
break;
case CLEAR_ALL_CACHES:
evictAll();
mCacheTimer.update(mTimer.currMillisecond - mContext.mDanmakuFactory.MAX_DANMAKU_DURATION);
mSeekedFlag = true;
break;
case CLEAR_OUTSIDE_CACHES:
evictAllNotInScreen(true);
mCacheTimer.update(mTimer.currMillisecond);
break;
case CLEAR_OUTSIDE_CACHES_AND_RESET:
evictAllNotInScreen(true);
mCacheTimer.update(mTimer.currMillisecond);
requestClear();
break;
}
}
示例9: handleMessage
import master.flame.danmaku.danmaku.model.android.DrawingCache; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
int what = msg.what;
switch (what) {
case PREPARE:
evictAllNotInScreen();
for (int i = 0; i < 200; i++) {
mCachePool.release(new DrawingCache());
}
case DISPATCH_ACTIONS:
//Log.e(TAG,"dispatch_actions:"+mCacheTimer.currMillisecond+":"+mTimer.currMillisecond);
long delayed = dispatchAction();
if (delayed <= 0) {
delayed = DanmakuFactory.MAX_DANMAKU_DURATION;
}
sendEmptyMessageDelayed(DISPATCH_ACTIONS, delayed);
break;
case BUILD_CACHES:
boolean repositioned = (mTaskListener != null || mSeekedFlag);
prepareCaches(repositioned);
if (repositioned)
mSeekedFlag = false;
if (mTaskListener != null) {
mTaskListener.ready();
mTaskListener = null;
}
// Log.i(TAG,"BUILD_CACHES:"+mCacheTimer.currMillisecond+":"+mTimer.currMillisecond);
break;
case ADD_DANMAKKU:
synchronized (danmakuList) {
BaseDanmaku item = (BaseDanmaku) msg.obj;
buildCache(item);
CacheManagingDrawTask.super.addDanmaku(item);
if (item.isLive) {
removeUnusedLiveDanmakusIn(5);
mCacheTimer.update(mTimer.currMillisecond
+ DanmakuFactory.MAX_DANMAKU_DURATION * mScreenSize);
}
}
break;
case CLEAR_TIMEOUT_CACHES:
clearTimeOutCaches();
break;
case SEEK:
Long seekMills = (Long)msg.obj;
if(seekMills!=null){
mCacheTimer.update(seekMills.longValue());
mSeekedFlag = true;
evictAllNotInScreen();
resume();
}
break;
case QUIT:
removeCallbacksAndMessages(null);
mPause = true;
evictAll();
clearCachePool();
this.getLooper().quit();
break;
case CLEAR_ALL_CACHES:
evictAll();
reset();
// GlobalFlagValues.updateVisibleFlag();
mCacheTimer.update(mTimer.currMillisecond);
mSeekedFlag = true;
clearFlag = 5;
break;
case CLEAR_OUTSIDE_CACHES:
evictAllNotInScreen(true);
mCacheTimer.update(mTimer.currMillisecond);
break;
case CLEAR_OUTSIDE_CACHES_AND_RESET:
evictAllNotInScreen(true);
reset();
mCacheTimer.update(mTimer.currMillisecond);
requestClear();
break;
}
}