Пример #1
0
 @Override
 public void removeAllDanmakus() {
   if (danmakuList == null || danmakuList.isEmpty()) return;
   synchronized (danmakuList) {
     danmakuList.clear();
   }
 }
 public static void resetDurationsData() {
   sLastDisp = null;
   CURRENT_DISP_WIDTH = CURRENT_DISP_HEIGHT = 0;
   sSpecialDanmakus.clear();
   MAX_Duration_Scroll_Danmaku = null;
   MAX_Duration_Fix_Danmaku = null;
   MAX_Duration_Special_Danmaku = null;
   MAX_DANMAKU_DURATION = MIN_DANMAKU_DURATION;
 }
Пример #3
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;
 }
Пример #4
0
 @Override
 public void reset() {
   if (danmakus != null) danmakus.clear();
   if (mRenderer != null) mRenderer.clear();
 }