Search in sources :

Example 1 with DefaultExecutorSupplier

use of com.facebook.imagepipeline.core.DefaultExecutorSupplier 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)

Example 2 with DefaultExecutorSupplier

use of com.facebook.imagepipeline.core.DefaultExecutorSupplier in project gl-react-native by ProjectSeptemberInc.

the class GLCanvasManager method createViewInstance.

@Override
public GLCanvas createViewInstance(ThemedReactContext context) {
    if (executorSupplier == null) {
        PoolFactory poolFactory = new PoolFactory(PoolConfig.newBuilder().build());
        int numCpuBoundThreads = poolFactory.getFlexByteArrayPoolMaxNumThreads();
        executorSupplier = new DefaultExecutorSupplier(numCpuBoundThreads);
    }
    return new GLCanvas(context, executorSupplier);
}
Also used : PoolFactory(com.facebook.imagepipeline.memory.PoolFactory) DefaultExecutorSupplier(com.facebook.imagepipeline.core.DefaultExecutorSupplier)

Aggregations

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