コード例 #1
0
  private IDrawTask createTask(
      boolean useDrwaingCache,
      DanmakuTimer timer,
      Context context,
      int width,
      int height,
      IDrawTask.TaskListener taskListener) {
    mDisp = new AndroidDisplayer();
    mDisp.setSize(width, height);
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    mDisp.setDensities(
        displayMetrics.density, displayMetrics.densityDpi, displayMetrics.scaledDensity);
    mDisp.resetSlopPixel(DanmakuGlobalConfig.DEFAULT.scaleTextSize);

    IDrawTask task =
        useDrwaingCache
            ? new CacheManagingDrawTask(
                timer,
                context,
                mDisp,
                taskListener,
                1024 * 1024 * AndroidUtils.getMemoryClass(context) / 3)
            : new DrawTask(timer, context, mDisp, taskListener);
    task.setParser(mParser);
    task.prepare();
    return task;
  }
コード例 #2
0
 private IDrawTask createDrawTask(
     boolean useDrwaingCache,
     DanmakuTimer timer,
     Context context,
     int width,
     int height,
     boolean isHardwareAccelerated,
     IDrawTask.TaskListener taskListener) {
   mDisp = mContext.getDisplayer();
   mDisp.setSize(width, height);
   DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
   mDisp.setDensities(
       displayMetrics.density, displayMetrics.densityDpi, displayMetrics.scaledDensity);
   mDisp.resetSlopPixel(mContext.scaleTextSize);
   mDisp.setHardwareAccelerated(isHardwareAccelerated);
   IDrawTask task =
       useDrwaingCache
           ? new CacheManagingDrawTask(
               timer,
               mContext,
               taskListener,
               1024 * 1024 * AndroidUtils.getMemoryClass(context) / 3)
           : new DrawTask(timer, mContext, taskListener);
   task.setParser(mParser);
   task.prepare();
   obtainMessage(NOTIFY_DISP_SIZE_CHANGED, false).sendToTarget();
   return task;
 }