Skip to content

Commit

Permalink
DanmakusRetainer: adjust RLDanmakusRetainer
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiao committed Sep 8, 2015
1 parent 6e125ae commit 155cd5d
Showing 1 changed file with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void fix(BaseDanmaku drawItem, IDisplayer disp) {
shown = true;
break;
}

if (firstItem == null)
firstItem = item;

Expand Down Expand Up @@ -151,7 +151,7 @@ public void fix(BaseDanmaku drawItem, IDisplayer disp) {
lastItem = item;

}

boolean checkEdge = true;
if (insertItem != null) {
if (lastItem != null)
topPos = lastItem.getBottom();
Expand All @@ -161,14 +161,10 @@ public void fix(BaseDanmaku drawItem, IDisplayer disp) {
mVisibleDanmakus.removeItem(insertItem);
shown = false;
}
} else if (overwriteInsert) {
if (minRightRow != null) {
topPos = minRightRow.getTop();
if(minRightRow.paintWidth<drawItem.paintWidth){
mVisibleDanmakus.removeItem(minRightRow);
shown = false;
}
}
} else if (overwriteInsert && minRightRow != null) {
topPos = minRightRow.getTop();
checkEdge = false;
shown = false;
} else if (lastItem != null) {
topPos = lastItem.getBottom();
} else if (firstItem != null) {
Expand All @@ -178,9 +174,10 @@ public void fix(BaseDanmaku drawItem, IDisplayer disp) {
} else {
topPos = 0;
}

topPos = checkVerticalEdge(overwriteInsert, drawItem, disp, topPos, firstItem,
lastItem);
if (checkEdge) {
topPos = checkVerticalEdge(overwriteInsert, drawItem, disp, topPos, firstItem,
lastItem);
}
if (topPos == 0 && mVisibleDanmakus.size()==0) {
shown = false;
}
Expand All @@ -195,8 +192,8 @@ public void fix(BaseDanmaku drawItem, IDisplayer disp) {
}

protected float checkVerticalEdge(boolean overwriteInsert, BaseDanmaku drawItem,
IDisplayer disp, float topPos, BaseDanmaku firstItem, BaseDanmaku lastItem) {
if (topPos < 0 || (firstItem!=null && firstItem.getTop() > 0) || topPos + drawItem.paintHeight > disp.getHeight()) {
IDisplayer disp, float topPos, BaseDanmaku firstItem, BaseDanmaku lastItem) {
if (topPos < 0 || (firstItem != null && firstItem.getTop() > 0) || topPos + drawItem.paintHeight > disp.getHeight()) {
topPos = 0;
clear();
}
Expand Down

0 comments on commit 155cd5d

Please sign in to comment.