当前位置: 首页>>代码示例>>Java>>正文


Java IDrawingCache.get方法代码示例

本文整理汇总了Java中master.flame.danmaku.danmaku.model.IDrawingCache.get方法的典型用法代码示例。如果您正苦于以下问题:Java IDrawingCache.get方法的具体用法?Java IDrawingCache.get怎么用?Java IDrawingCache.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在master.flame.danmaku.danmaku.model.IDrawingCache的用法示例。


在下文中一共展示了IDrawingCache.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:26,代码来源:CacheManagingDrawTask.java

示例2: 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;
}
 
开发者ID:amikey,项目名称:DanmakuFlameMaster,代码行数:26,代码来源:CacheManagingDrawTask.java

示例3: 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;
}
 
开发者ID:jiangerji,项目名称:danmaku-project,代码行数:26,代码来源:CacheManagingDrawTask.java

示例4: 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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:28,代码来源:CacheManagingDrawTask.java

示例5: addDanmakuAndBuildCache

import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
private final void addDanmakuAndBuildCache(BaseDanmaku danmaku) {
    if (danmaku.isTimeOut() || (danmaku.time > mCacheTimer.currMillisecond + mContext.mDanmakuFactory.MAX_DANMAKU_DURATION && !danmaku.isLive)) {
        return;
    }
    if (danmaku.priority == 0 && danmaku.isFiltered()) {
        return;
    }
    IDrawingCache<?> cache = danmaku.getDrawingCache();
    if (cache == null || cache.get() == null) {
        buildCache(danmaku, true);
    }
}
 
开发者ID:amikey,项目名称:DanmakuFlameMaster,代码行数:13,代码来源:CacheManagingDrawTask.java

示例6: 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;
}
 
开发者ID:amikey,项目名称:DanmakuFlameMaster,代码行数:42,代码来源:CacheManagingDrawTask.java

示例7: draw

import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
@Override
public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRenderTime) {
    int lastTotalDanmakuCount = mRenderingState.totalDanmakuCount;
    mRenderingState.reset();       
    IDanmakuIterator itr = danmakus.iterator();
    int orderInScreen = 0;        
    mStartTimer.update(SystemClock.uptimeMillis());
    int sizeInScreen = danmakus.size();
    BaseDanmaku drawItem = null;
    while (itr.hasNext()) {

        drawItem = itr.next();

        if (!drawItem.hasPassedFilter()) {
            mContext.mDanmakuFilters.filter(drawItem, orderInScreen, sizeInScreen, mStartTimer, false, mContext);
        }

        if (drawItem.time < startRenderTime
                || (drawItem.priority == 0 && drawItem.isFiltered())) {
            continue;
        }

        if (drawItem.isLate()) {
            IDrawingCache<?> cache = drawItem.getDrawingCache();
            if (mCacheManager != null && (cache == null || cache.get() == null)) {
                mCacheManager.addDanmaku(drawItem);
            }
            break;
        }
        
        if (drawItem.getType() == BaseDanmaku.TYPE_SCROLL_RL){
            // 同屏弹幕密度只对滚动弹幕有效
            orderInScreen++;
        }

        // measure
        if (!drawItem.isMeasured()) {
            drawItem.measure(disp, false);
        }

        // layout
        mDanmakusRetainer.fix(drawItem, disp, mVerifier);

        // draw
        if (!drawItem.isOutside() && drawItem.isShown()) {
            if (drawItem.lines == null && drawItem.getBottom() > disp.getHeight()) {
                continue;    // skip bottom outside danmaku
            }
            int renderingType = drawItem.draw(disp);
            if(renderingType == IRenderer.CACHE_RENDERING) {
                mRenderingState.cacheHitCount++;
            } else if(renderingType == IRenderer.TEXT_RENDERING) {
                mRenderingState.cacheMissCount++;
                if (mCacheManager != null) {
                    mCacheManager.addDanmaku(drawItem);
                }
            }
            mRenderingState.addCount(drawItem.getType(), 1);
            mRenderingState.addTotalCount(1);

            if (mOnDanmakuShownListener != null
                    && drawItem.firstShownFlag != mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG) {
                drawItem.firstShownFlag = mContext.mGlobalFlagValues.FIRST_SHOWN_RESET_FLAG;
                mOnDanmakuShownListener.onDanmakuShown(drawItem);
            }
        }

    }
    
    mRenderingState.nothingRendered = (mRenderingState.totalDanmakuCount == 0);
    mRenderingState.endTime = drawItem != null ? drawItem.time : RenderingState.UNKNOWN_TIME;
    if (mRenderingState.nothingRendered) {
        mRenderingState.beginTime = RenderingState.UNKNOWN_TIME;
    }
    mRenderingState.incrementCount = mRenderingState.totalDanmakuCount - lastTotalDanmakuCount;
    mRenderingState.consumingTime = mStartTimer.update(SystemClock.uptimeMillis());
    return mRenderingState;
}
 
开发者ID:amikey,项目名称:DanmakuFlameMaster,代码行数:79,代码来源:DanmakuRenderer.java

示例8: draw

import master.flame.danmaku.danmaku.model.IDrawingCache; //导入方法依赖的package包/类
@Override
public int draw(BaseDanmaku danmaku) {
    float top = danmaku.getTop();
    float left = danmaku.getLeft();
    if (canvas != null) {

        Paint alphaPaint = null;
        boolean needRestore = false;
        if (danmaku.getType() == BaseDanmaku.TYPE_SPECIAL) {
            if (danmaku.getAlpha() == AlphaValue.TRANSPARENT) {
                return IRenderer.NOTHING_RENDERING;
            }
            if (danmaku.rotationZ != 0 || danmaku.rotationY != 0) {
                saveCanvas(danmaku, canvas, left, top);
                needRestore = true;
            }

            int alpha = danmaku.getAlpha();
            if (alpha != AlphaValue.MAX) {
                alphaPaint = ALPHA_PAINT;
                alphaPaint.setAlpha(danmaku.getAlpha());
            }
        }

        // skip drawing when danmaku is transparent
        if (alphaPaint != null && alphaPaint.getAlpha() == AlphaValue.TRANSPARENT) {
            return IRenderer.NOTHING_RENDERING;
        }
        // drawing cache
        boolean cacheDrawn = false;
        int result = IRenderer.CACHE_RENDERING;
        IDrawingCache<?> cache = danmaku.getDrawingCache();
        if (cache != null) {
            DrawingCacheHolder holder = (DrawingCacheHolder) cache.get();
            if (holder != null) {
                cacheDrawn = holder.draw(canvas, left, top, alphaPaint);
            }
        }
        if (!cacheDrawn) {
            if (alphaPaint != null) {
                PAINT.setAlpha(alphaPaint.getAlpha());
            } else {
                resetPaintAlpha(PAINT);
            }
            drawDanmaku(danmaku, canvas, left, top, false);
            result = IRenderer.TEXT_RENDERING;
        }

        if (needRestore) {
            restoreCanvas(canvas);
        }

        return result;
    }

    return IRenderer.NOTHING_RENDERING;
}
 
开发者ID:amikey,项目名称:DanmakuFlameMaster,代码行数:58,代码来源:AndroidDisplayer.java


注:本文中的master.flame.danmaku.danmaku.model.IDrawingCache.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。