本文整理汇总了Java中master.flame.danmaku.danmaku.model.IDrawingCache.hasReferences方法的典型用法代码示例。如果您正苦于以下问题:Java IDrawingCache.hasReferences方法的具体用法?Java IDrawingCache.hasReferences怎么用?Java IDrawingCache.hasReferences使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类master.flame.danmaku.danmaku.model.IDrawingCache
的用法示例。
在下文中一共展示了IDrawingCache.hasReferences方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evictAllNotInScreen
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private void evictAllNotInScreen(boolean removeAllReferences) {
if (mCaches != null) {
IDanmakuIterator it = mCaches.iterator();
while (it.hasNext()) {
BaseDanmaku danmaku = it.next();
IDrawingCache<?> cache = danmaku.cache;
boolean hasReferences = cache != null && cache.hasReferences();
if (removeAllReferences && hasReferences) {
if (cache.get() != null) {
mRealSize -= cache.size();
cache.destroy();
}
entryRemoved(true, danmaku, null);
it.remove();
continue;
}
if (danmaku.hasDrawingCache() == false || danmaku.isOutside()) {
entryRemoved(true, danmaku, null);
it.remove();
}
}
// mCaches.clear();
}
mRealSize = 0;
}
示例2: onDanmakuRemoved
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
@Override
protected void onDanmakuRemoved(BaseDanmaku danmaku) {
super.onDanmakuRemoved(danmaku);
if (mCacheManager != null) {
if (++mRemaininCacheCount > 5) { // control frequency (it does not require very precise
mCacheManager.requestClearTimeout();
mRemaininCacheCount = 0;
}
} else {
IDrawingCache<?> cache = danmaku.getDrawingCache();
if (cache != null) {
if (cache.hasReferences()) {
cache.decreaseReference();
} else {
cache.destroy();
}
danmaku.cache = null;
}
}
}
示例3: evictAllNotInScreen
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private void evictAllNotInScreen(boolean removeAllReferences) {
if (mCaches != null) {
IDanmakuIterator it = mCaches.iterator();
while (it.hasNext()) {
BaseDanmaku danmaku = it.next();
IDrawingCache<?> cache = danmaku.cache;
boolean hasReferences = cache != null && cache.hasReferences();
if (removeAllReferences && hasReferences) {
if (cache.get() != null) {
mRealSize -= cache.size();
cache.destroy();
}
entryRemoved(true, danmaku, null);
it.remove();
continue;
}
if (danmaku.isOutside()) {
entryRemoved(true, danmaku, null);
it.remove();
}
}
// mCaches.clear();
}
mRealSize = 0;
}
示例4: evictAllNotInScreen
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private synchronized void evictAllNotInScreen(boolean removeAllReferences) {
if (mCaches != null) {
IDanmakuIterator it = mCaches.iterator();
while (it.hasNext()) {
BaseDanmaku danmaku = it.next();
IDrawingCache<?> cache = danmaku.cache;
boolean hasReferences = cache != null && cache.hasReferences();
if (removeAllReferences && hasReferences) {
if (cache.get() != null) {
mRealSize -= cache.size();
cache.destroy();
}
entryRemoved(true, danmaku, null);
it.remove();
continue;
}
if (danmaku.hasDrawingCache() == false || danmaku.isOutside()) {
entryRemoved(true, danmaku, null);
it.remove();
}
}
// mCaches.clear();
}
mRealSize = 0;
}
示例5: evictAllNotInScreen
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private void evictAllNotInScreen(boolean removeAllReferences) {
if (this.mCaches != null) {
IDanmakuIterator it = this.mCaches.iterator();
while (it.hasNext()) {
BaseDanmaku danmaku = it.next();
IDrawingCache<?> cache = danmaku.cache;
boolean hasReferences;
if (cache == null || !cache.hasReferences()) {
hasReferences = false;
} else {
hasReferences = true;
}
if (removeAllReferences && hasReferences) {
if (cache.get() != null) {
this.mRealSize -= cache.size();
cache.destroy();
}
entryRemoved(true, danmaku, null);
it.remove();
} else if (!danmaku.hasDrawingCache() || danmaku.isOutside()) {
entryRemoved(true, danmaku, null);
it.remove();
}
}
}
this.mRealSize = 0;
}
示例6: clearCache
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private long clearCache(BaseDanmaku oldValue) {
IDrawingCache<?> cache = oldValue.cache;
if (cache == null) {
return 0;
}
if (cache.hasReferences()) {
cache.decreaseReference();
oldValue.cache = null;
return 0;
}
long size = sizeOf(oldValue);
cache.destroy();
oldValue.cache = null;
return size;
}
示例7: findReuseableCache
import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private BaseDanmaku findReuseableCache(BaseDanmaku refDanmaku,
boolean strictMode,
int maximumTimes) {
IDanmakuIterator it = mCaches.iterator();
int slopPixel = 0;
if (!strictMode) {
slopPixel = mDisp.getSlopPixel() * 2;
}
int count = 0;
while (it.hasNext() && count++ < maximumTimes) { // limit maximum times
BaseDanmaku danmaku = it.next();
IDrawingCache<?> cache = danmaku.getDrawingCache();
if (cache == null || cache.get() == null) {
continue;
}
if (danmaku.paintWidth == refDanmaku.paintWidth
&& danmaku.paintHeight == refDanmaku.paintHeight
&& danmaku.underlineColor == refDanmaku.underlineColor
&& danmaku.borderColor == refDanmaku.borderColor
&& danmaku.textColor == refDanmaku.textColor
&& danmaku.text.equals(refDanmaku.text)) {
return danmaku;
}
if (strictMode) {
continue;
}
if (!danmaku.isTimeOut()) {
break;
}
if (cache.hasReferences()) {
continue;
}
float widthGap = cache.width() - refDanmaku.paintWidth;
float heightGap = cache.height() - refDanmaku.paintHeight;
if (widthGap >= 0 && widthGap <= slopPixel &&
heightGap >= 0 && heightGap <= slopPixel) {
return danmaku;
}
}
return null;
}