예제 #1
0
 protected RenderingState drawDanmakus(AbsDisplayer<?> disp, DanmakuTimer timer) {
   if (danmakuList != null) {
     Canvas canvas = (Canvas) disp.getExtraData();
     if (clearFlag > 0) {
       DrawHelper.clearCanvas(canvas);
       clearFlag--;
     } else {
       float[] refreshRect = mRenderer.getRefreshArea().mRefreshRect;
       mRectCache.push(refreshRect);
       float[] rect = mRectCache.getRect();
       DrawHelper.clearCanvas(
           canvas,
           Math.max(0, rect[0]),
           Math.max(0, rect[1]),
           Math.min(disp.getWidth(), rect[2]),
           Math.min(disp.getHeight(), rect[3]));
     }
     long currMills = timer.currMillisecond;
     danmakus = danmakuList.sub(currMills - DanmakuFactory.MAX_DANMAKU_DURATION - 100, currMills);
     if (danmakus != null) {
       return mRenderer.draw(mDisp, danmakus, mStartRenderTime);
     }
   }
   return null;
 }
예제 #2
0
 protected RenderingState drawDanmakus(AbsDisplayer<?> disp, DanmakuTimer timer) {
   if (clearRetainerFlag) {
     DanmakusRetainer.clear();
     clearRetainerFlag = false;
   }
   if (danmakuList != null) {
     Canvas canvas = (Canvas) disp.getExtraData();
     DrawHelper.clearCanvas(canvas);
     if (mIsHidden) {
       return mRenderingState;
     }
     long beginMills = timer.currMillisecond - DanmakuFactory.MAX_DANMAKU_DURATION - 100;
     long endMills = timer.currMillisecond + DanmakuFactory.MAX_DANMAKU_DURATION;
     if (mLastBeginMills > beginMills || timer.currMillisecond > mLastEndMills) {
       IDanmakus subDanmakus = danmakuList.sub(beginMills, endMills);
       if (subDanmakus != null) {
         danmakus = subDanmakus;
       } else {
         danmakus.clear();
       }
       mLastBeginMills = beginMills;
       mLastEndMills = endMills;
     } else {
       beginMills = mLastBeginMills;
       endMills = mLastEndMills;
     }
     if (danmakus != null && !danmakus.isEmpty()) {
       RenderingState renderingState =
           mRenderingState = mRenderer.draw(mDisp, danmakus, mStartRenderTime);
       if (renderingState.nothingRendered) {
         if (renderingState.beginTime == RenderingState.UNKNOWN_TIME) {
           renderingState.beginTime = beginMills;
         }
         if (renderingState.endTime == RenderingState.UNKNOWN_TIME) {
           renderingState.endTime = endMills;
         }
       }
       return renderingState;
     } else {
       mRenderingState.nothingRendered = true;
       mRenderingState.beginTime = beginMills;
       mRenderingState.endTime = endMills;
       return mRenderingState;
     }
   }
   return null;
 }