Search in sources :

Example 1 with ScrollPerfExecutorSupplier

use of com.facebook.samples.scrollperf.internal.ScrollPerfExecutorSupplier in project fresco by facebook.

the class ScrollPerfApplication method onCreate.

@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);
}
Also used : Config(com.facebook.samples.scrollperf.conf.Config) DraweeConfig(com.facebook.drawee.backends.pipeline.DraweeConfig) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) DefaultExecutorSupplier(com.facebook.imagepipeline.core.DefaultExecutorSupplier) ScrollPerfExecutorSupplier(com.facebook.samples.scrollperf.internal.ScrollPerfExecutorSupplier) DraweeConfig(com.facebook.drawee.backends.pipeline.DraweeConfig)

Aggregations

DraweeConfig (com.facebook.drawee.backends.pipeline.DraweeConfig)1 DefaultExecutorSupplier (com.facebook.imagepipeline.core.DefaultExecutorSupplier)1 ImagePipelineConfig (com.facebook.imagepipeline.core.ImagePipelineConfig)1 Config (com.facebook.samples.scrollperf.conf.Config)1 ScrollPerfExecutorSupplier (com.facebook.samples.scrollperf.internal.ScrollPerfExecutorSupplier)1