Skip to content

Commit

Permalink
Add prepare(Parser) method to DanmakuSurfaceView
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiao committed Nov 11, 2013
1 parent 176da5d commit 7f5a370
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import master.flame.danmaku.controller.DrawTask;
import master.flame.danmaku.controller.IDrawTask;
import master.flame.danmaku.danmaku.model.DanmakuTimer;
import master.flame.danmaku.danmaku.parser.BaseDanmakuParser;

public class DanmakuSurfaceView extends SurfaceView implements SurfaceHolder.Callback,
View.OnClickListener {
Expand All @@ -59,6 +60,7 @@ public class DanmakuSurfaceView extends SurfaceView implements SurfaceHolder.Cal
private boolean mEnableDanmakuDrwaingCache;

private OnClickListener mOnClickListener;
private BaseDanmakuParser mParser;

public DanmakuSurfaceView(Context context) {
super(context);
Expand Down Expand Up @@ -149,6 +151,11 @@ public void prepare() {
}
}

public void prepare(BaseDanmakuParser parser) {
mParser = parser;
prepare();
}

void drawDanmakus() {
if (!isSurfaceCreated)
return;
Expand Down Expand Up @@ -228,6 +235,7 @@ private IDrawTask createTask(boolean useDrwaingCache, DanmakuTimer timer, Contex
IDrawTask task = useDrwaingCache ? new CacheManagingDrawTask(timer, context, width, height,
taskListener, 1024 * 1024 * getMemoryClass(getContext()) / 3) : new DrawTask(timer,
context, width, height, taskListener);
task.setParser(mParser);
task.prepare();
return task;
}
Expand Down

0 comments on commit 7f5a370

Please sign in to comment.