From ee79ef6bc5813035cc1d4fa89f4e3bd5db485583 Mon Sep 17 00:00:00 2001 From: ctiao Date: Fri, 11 Sep 2015 11:08:19 +0800 Subject: [PATCH] DanmakuRenderer: skip drawing if danmaku is filtered by FILTER_TYPE_OVERLAPPING|FILTER_TYPE_MAXIMUM_LINES(ignore priority) --- .../master/flame/danmaku/danmaku/model/BaseDanmaku.java | 6 +++++- .../danmaku/danmaku/renderer/android/DanmakuRenderer.java | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/BaseDanmaku.java b/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/BaseDanmaku.java index ec867730..ac2b34b2 100644 --- a/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/BaseDanmaku.java +++ b/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/model/BaseDanmaku.java @@ -236,7 +236,11 @@ public boolean hasPassedFilter() { } public boolean isFiltered() { - return mFilterParam != 0 && filterResetFlag == GlobalFlagValues.FILTER_RESET_FLAG; + return filterResetFlag == GlobalFlagValues.FILTER_RESET_FLAG && mFilterParam != 0; + } + + public boolean isFilteredBy(int flag) { + return filterResetFlag == GlobalFlagValues.FILTER_RESET_FLAG && (mFilterParam & flag) == flag; } public void setVisibility(boolean b) { diff --git a/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/renderer/android/DanmakuRenderer.java b/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/renderer/android/DanmakuRenderer.java index 9cd8fe9e..dc64ea1c 100644 --- a/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/renderer/android/DanmakuRenderer.java +++ b/DanmakuFlameMaster/src/main/java/master/flame/danmaku/danmaku/renderer/android/DanmakuRenderer.java @@ -76,7 +76,9 @@ public RenderingState draw(IDisplayer disp, IDanmakus danmakus, long startRender } if (drawItem.time < startRenderTime - || (drawItem.priority == 0 && drawItem.isFiltered())) { + || (drawItem.priority == 0 && drawItem.isFiltered()) + || drawItem.isFilteredBy(DanmakuFilters.FILTER_TYPE_OVERLAPPING) + || drawItem.isFilteredBy(DanmakuFilters.FILTER_TYPE_MAXIMUM_LINES)) { continue; }