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


Java IRenderer类代码示例

本文整理汇总了Java中master.flame.danmaku.danmaku.renderer.IRenderer的典型用法代码示例。如果您正苦于以下问题:Java IRenderer类的具体用法?Java IRenderer怎么用?Java IRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IRenderer类属于master.flame.danmaku.danmaku.renderer包,在下文中一共展示了IRenderer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DrawTask

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的package包/类
public DrawTask(DanmakuTimer timer, DanmakuContext context, TaskListener taskListener) {
    boolean z = false;
    if (context == null) {
        throw new IllegalArgumentException("context is null");
    }
    this.mContext = context;
    this.mDisp = context.getDisplayer();
    this.mTaskListener = taskListener;
    this.mRenderer = new DanmakuRenderer(context);
    this.mRenderer.setOnDanmakuShownListener(new OnDanmakuShownListener() {
        public void onDanmakuShown(BaseDanmaku danmaku) {
            if (DrawTask.this.mTaskListener != null) {
                DrawTask.this.mTaskListener.onDanmakuShown(danmaku);
            }
        }
    });
    IRenderer iRenderer = this.mRenderer;
    if (this.mContext.isPreventOverlappingEnabled() || this.mContext.isMaxLinesLimited()) {
        z = true;
    }
    iRenderer.setVerifierEnabled(z);
    initTimer(timer);
    Boolean enable = Boolean.valueOf(this.mContext.isDuplicateMergingEnabled());
    if (enable == null) {
        return;
    }
    if (enable.booleanValue()) {
        this.mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
    } else {
        this.mContext.mDanmakuFilters.unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:33,代码来源:DrawTask.java

示例2: handleOnDanmakuConfigChanged

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的package包/类
protected boolean handleOnDanmakuConfigChanged(DanmakuContext config, DanmakuConfigTag tag, Object[] values) {
    boolean z = false;
    if (tag == null || DanmakuConfigTag.MAXIMUM_NUMS_IN_SCREEN.equals(tag)) {
        return true;
    }
    if (DanmakuConfigTag.DUPLICATE_MERGING_ENABLED.equals(tag)) {
        Boolean enable = values[0];
        if (enable == null) {
            return false;
        }
        if (enable.booleanValue()) {
            this.mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
        } else {
            this.mContext.mDanmakuFilters.unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
        }
        return true;
    } else if (DanmakuConfigTag.SCALE_TEXTSIZE.equals(tag) || DanmakuConfigTag.SCROLL_SPEED_FACTOR.equals(tag)) {
        requestClearRetainer();
        return false;
    } else if (!DanmakuConfigTag.MAXIMUN_LINES.equals(tag) && !DanmakuConfigTag.OVERLAPPING_ENABLE.equals(tag)) {
        return false;
    } else {
        if (this.mRenderer != null) {
            IRenderer iRenderer = this.mRenderer;
            if (this.mContext.isPreventOverlappingEnabled() || this.mContext.isMaxLinesLimited()) {
                z = true;
            }
            iRenderer.setVerifierEnabled(z);
        }
        return true;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:33,代码来源:DrawTask.java

示例3: DrawTask

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的package包/类
public DrawTask(DanmakuTimer timer, DanmakuContext context,
        TaskListener taskListener) {
    if (context == null) {
        throw new IllegalArgumentException("context is null");
    }
    mContext = context;
    mDisp = context.getDisplayer();
    mTaskListener = taskListener;
    mRenderer = new DanmakuRenderer(context);
    mRenderer.setOnDanmakuShownListener(new IRenderer.OnDanmakuShownListener() {

        @Override
        public void onDanmakuShown(BaseDanmaku danmaku) {
            if (mTaskListener != null) {
                mTaskListener.onDanmakuShown(danmaku);
            }
        }
    });
    mRenderer.setVerifierEnabled(mContext.isPreventOverlappingEnabled() || mContext.isMaxLinesLimited());
    initTimer(timer);
    Boolean enable = mContext.isDuplicateMergingEnabled();
    if (enable != null) {
        if(enable) {
            mContext.mDanmakuFilters.registerFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
        } else {
            mContext.mDanmakuFilters.unregisterFilter(DanmakuFilters.TAG_DUPLICATE_FILTER);
        }
    }
}
 
开发者ID:lisnstatic,项目名称:live_master,代码行数:30,代码来源:DrawTask.java

示例4: draw

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的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()) {
            if (mCacheManager != null && !drawItem.hasDrawingCache()) {
                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:lisnstatic,项目名称:live_master,代码行数:78,代码来源:DanmakuRenderer.java

示例5: draw

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的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;
        if (danmaku.hasDrawingCache()) {
            DrawingCacheHolder holder = ((DrawingCache) danmaku.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:lisnstatic,项目名称:live_master,代码行数:57,代码来源:AndroidDisplayer.java

示例6: draw

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的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

示例7: draw

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的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

示例8: draw

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的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(System.currentTimeMillis());
    int sizeInScreen = danmakus.size();
    BaseDanmaku drawItem = null;
    while (itr.hasNext()) {

        drawItem = itr.next();
        
        if (drawItem.isLate()) {
            break;
        }

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

        if (drawItem.time < startRenderTime
                || (drawItem.priority == 0 && drawItem.isFiltered())) {
            continue;
        }
        
        if (drawItem.getType() == BaseDanmaku.TYPE_SCROLL_RL){
            // 同屏弹幕密度只对滚动弹幕有效
            orderInScreen++;
        }

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

        // 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++;
            }
            mRenderingState.addCount(drawItem.getType(), 1);
            mRenderingState.addTotalCount(1);
        }

    }
    
    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(System.currentTimeMillis());
    return mRenderingState;
}
 
开发者ID:liucloo,项目名称:ijkPlayer-Danmaku,代码行数:66,代码来源:DanmakuRenderer.java

示例9: draw

import master.flame.danmaku.danmaku.renderer.IRenderer; //导入依赖的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;
        if (danmaku.hasDrawingCache()) {
            DrawingCacheHolder holder = ((DrawingCache) danmaku.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, true);
            result = IRenderer.TEXT_RENDERING;
        }

        if (needRestore) {
            restoreCanvas(canvas);
        }

        return result;
    }

    return IRenderer.NOTHING_RENDERING;
}
 
开发者ID:liucloo,项目名称:ijkPlayer-Danmaku,代码行数:57,代码来源:AndroidDisplayer.java


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