Java 类com.facebook.imagepipeline.core.DefaultExecutorSupplier 实例源码

项目:GitHub    文件:ScrollPerfApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  final Config config = Config.load(this);
  ImagePipelineConfig.Builder imagePipelineConfigBuilder = ImagePipelineConfig.newBuilder(this)
      .setResizeAndRotateEnabledForNetwork(false)
      .setDownsampleEnabled(config.downsampling);
  if (WebpSupportStatus.sIsWebpSupportRequired) {
    imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled);
  }
  if (config.decodingThreadCount == 0) {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS));
  } else {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount));
  }
  imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation);
  DraweeConfig draweeConfig = DraweeConfig.newBuilder()
      .setDrawDebugOverlay(config.draweeOverlayEnabled)
      .build();
  Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig);
}
项目:android-mg-bootstrap    文件:MGImagesBitmap.java   
/**
 * Convenience method.
 */
public static MGImagesBitmap create(@NonNull String url, int width, int height, boolean circle, final boolean currentThread) {
    return
        MGImagesBitmap
            .builder()
            .url(url)
            .width(width)
            .height(height)
            .circle(circle)
            .executor(new Executor() {
                @Override
                public void execute(@NonNull final Runnable command) {
                    if (currentThread) {
                        command.run();
                    } else {
                        new DefaultExecutorSupplier(1).forDecode();
                    }
                }
            })
            .build();
}
项目:fresco    文件:ScrollPerfApplication.java   
@Override
public void onCreate() {
  super.onCreate();
  final Config config = Config.load(this);
  ImagePipelineConfig.Builder imagePipelineConfigBuilder = ImagePipelineConfig.newBuilder(this)
      .setResizeAndRotateEnabledForNetwork(false)
      .setDownsampleEnabled(config.downsampling);
  if (WebpSupportStatus.sIsWebpSupportRequired) {
    imagePipelineConfigBuilder.experiment().setWebpSupportEnabled(config.webpSupportEnabled);
  }
  if (config.decodingThreadCount == 0) {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new DefaultExecutorSupplier(Const.NUMBER_OF_PROCESSORS));
  } else {
    imagePipelineConfigBuilder.setExecutorSupplier(
        new ScrollPerfExecutorSupplier(Const.NUMBER_OF_PROCESSORS, config.decodingThreadCount));
  }
  imagePipelineConfigBuilder.experiment().setDecodeCancellationEnabled(config.decodeCancellation);
  DraweeConfig draweeConfig = DraweeConfig.newBuilder()
      .setDrawDebugOverlay(config.draweeOverlayEnabled)
      .build();
  Fresco.initialize(this, imagePipelineConfigBuilder.build(), draweeConfig);
}
项目:GitHub    文件:ExampleBitmapAnimationFactory.java   
public static BitmapAnimationBackend createColorBitmapAnimationBackend(
    final int[] colors,
    final int animationDurationMs,
    final BitmapFrameCache bitmapFrameCache) {
  final PlatformBitmapFactory platformBitmapFactory =
      Fresco.getImagePipelineFactory().getPlatformBitmapFactory();
  final BitmapFrameRenderer bitmapFrameRenderer = new ColorAndFrameNumberRenderer(colors);
  final AnimationInformation animationInformation = new ColorListAnimationInformation(
      colors,
      animationDurationMs);
  final ExecutorService executorServiceForFramePreparer = new DefaultSerialExecutorService(
      new DefaultExecutorSupplier(1).forDecode());
  final BitmapFramePreparationStrategy framePreparationStrategy =
      new FixedNumberBitmapFramePreparationStrategy(NUMBER_OF_FRAMES_TO_PREPARE);
  final BitmapFramePreparer bitmapFramePreparer = new DefaultBitmapFramePreparer(
      platformBitmapFactory,
      bitmapFrameRenderer,
      Bitmap.Config.ARGB_8888,
      executorServiceForFramePreparer);

  BitmapAnimationBackend bitmapAnimationBackend = new BitmapAnimationBackend(
      platformBitmapFactory,
      bitmapFrameCache,
      animationInformation,
      bitmapFrameRenderer,
      framePreparationStrategy,
      bitmapFramePreparer);

  bitmapAnimationBackend.setFrameListener(new DebugBitmapAnimationFrameListener());
  return bitmapAnimationBackend;
}
项目:fresco    文件:ExampleBitmapAnimationFactory.java   
public static BitmapAnimationBackend createColorBitmapAnimationBackend(
    final int[] colors,
    final int animationDurationMs,
    final BitmapFrameCache bitmapFrameCache) {
  final PlatformBitmapFactory platformBitmapFactory =
      Fresco.getImagePipelineFactory().getPlatformBitmapFactory();
  final BitmapFrameRenderer bitmapFrameRenderer = new ColorAndFrameNumberRenderer(colors);
  final AnimationInformation animationInformation = new ColorListAnimationInformation(
      colors,
      animationDurationMs);
  final ExecutorService executorServiceForFramePreparer = new DefaultSerialExecutorService(
      new DefaultExecutorSupplier(1).forDecode());
  final BitmapFramePreparationStrategy framePreparationStrategy =
      new FixedNumberBitmapFramePreparationStrategy(NUMBER_OF_FRAMES_TO_PREPARE);
  final BitmapFramePreparer bitmapFramePreparer = new DefaultBitmapFramePreparer(
      platformBitmapFactory,
      bitmapFrameRenderer,
      Bitmap.Config.ARGB_8888,
      executorServiceForFramePreparer);

  BitmapAnimationBackend bitmapAnimationBackend = new BitmapAnimationBackend(
      platformBitmapFactory,
      bitmapFrameCache,
      animationInformation,
      bitmapFrameRenderer,
      framePreparationStrategy,
      bitmapFramePreparer);

  bitmapAnimationBackend.setFrameListener(new DebugBitmapAnimationFrameListener());
  return bitmapAnimationBackend;
}
项目:BigImageViewer    文件:FrescoImageLoader.java   
private FrescoImageLoader(Context appContext) {
    mAppContext = appContext;
    mExecutorSupplier = new DefaultExecutorSupplier(Runtime.getRuntime().availableProcessors());
}
项目:BigImageViewer-master    文件:FrescoImageLoader.java   
private FrescoImageLoader(Context appContext) {
    mAppContext = appContext;

    mExecutorSupplier = new DefaultExecutorSupplier(Runtime.getRuntime().availableProcessors());
}