コード例 #1
0
 /// <summary>
 /// Gets the animated factory.
 /// </summary>
 public static IAnimatedFactory GetAnimatedFactory(
     PlatformBitmapFactory platformBitmapFactory,
     IExecutorSupplier executorSupplier)
 {
     // TODO: Adding animated factory
     return(default(IAnimatedFactory));
 }
コード例 #2
0
        private ImagePipelineConfig(Builder builder)
        {
            _animatedImageFactory            = builder.AnimatedImageFactory;
            _bitmapMemoryCacheParamsSupplier = builder.BitmapMemoryCacheParamsSupplier ??
                                               new DefaultBitmapMemoryCacheParamsSupplier();

            _bitmapConfig = builder.BitmapConfig == default(BitmapPixelFormat) ?
                            BitmapPixelFormat.Bgra8 : builder.BitmapConfig;

            _cacheKeyFactory = builder.CacheKeyFactory ?? DefaultCacheKeyFactory.Instance;

            _decodeMemoryFileEnabled = builder.IsDecodeMemoryFileEnabled;
            _fileCacheFactory        = builder.FileCacheFactory ??
                                       new DiskStorageCacheFactory(new DynamicDefaultDiskStorageFactory());

            _downsampleEnabled = builder.IsDownsampleEnabled;
            _encodedMemoryCacheParamsSupplier = builder.EncodedMemoryCacheParamsSupplier ??
                                                new DefaultEncodedMemoryCacheParamsSupplier();

            _imageCacheStatsTracker = builder.ImageCacheStatsTracker ??
                                      NoOpImageCacheStatsTracker.Instance;

            _imageDecoder = builder.ImageDecoder;
            _isPrefetchEnabledSupplier = builder.IsPrefetchEnabledSupplier ??
                                         new SupplierImpl <bool>(
                () =>
            {
                return(true);
            });

            _mainDiskCacheConfig = builder.MainDiskCacheConfig ??
                                   GetDefaultMainDiskCacheConfig();

            _memoryTrimmableRegistry = builder.MemoryTrimmableRegistry ??
                                       NoOpMemoryTrimmableRegistry.Instance;

            _networkFetcher        = builder.NetworkFetcher ?? new HttpUrlConnectionNetworkFetcher();
            _platformBitmapFactory = builder.PlatformBitmapFactory;
            _poolFactory           = builder.PoolFactory ?? new PoolFactory(PoolConfig.NewBuilder().Build());
            _progressiveJpegConfig = builder.ProgressiveJpegConfig == default(IProgressiveJpegConfig) ?
                                     new SimpleProgressiveJpegConfig() : builder.ProgressiveJpegConfig;

            _requestListeners = builder.RequestListeners ?? new HashSet <IRequestListener>();
            _resizeAndRotateEnabledForNetwork = builder.ResizeAndRotateEnabledForNetwork;
            _smallImageDiskCacheConfig        = builder.SmallImageDiskCacheConfig ?? _mainDiskCacheConfig;

            // Below this comment can't be built in alphabetical order, because of dependencies
            int numCpuBoundThreads = _poolFactory.FlexByteArrayPoolMaxNumThreads;

            _executorSupplier = builder.ExecutorSupplier ??
                                new DefaultExecutorSupplier(numCpuBoundThreads);

            _imagePipelineExperiments = builder.Experiment.Build();
        }
コード例 #3
0
        /// <summary>
        /// Instantiates the <see cref="ProducerFactory"/>
        /// </summary>
        /// <param name="byteArrayPool">
        /// The IByteArrayPool used by DecodeProducer.
        /// </param>
        /// <param name="imageDecoder">
        /// The image decoder.
        /// </param>
        /// <param name="progressiveJpegConfig">
        /// The progressive Jpeg configuration.
        /// </param>
        /// <param name="downsampleEnabled">
        /// Enabling downsample.
        /// </param>
        /// <param name="resizeAndRotateEnabledForNetwork">
        /// Enabling resize and rotate.
        /// </param>
        /// <param name="executorSupplier">
        /// The supplier for tasks.
        /// </param>
        /// <param name="pooledByteBufferFactory">
        /// The factory that allocates IPooledByteBuffer memory.
        /// </param>
        /// <param name="bitmapMemoryCache">
        /// The memory cache for CloseableImage.
        /// </param>
        /// <param name="encodedMemoryCache">
        /// The memory cache for IPooledByteBuffer.
        /// </param>
        /// <param name="defaultBufferedDiskCache">
        /// The default buffered disk cache.
        /// </param>
        /// <param name="smallImageBufferedDiskCache">
        /// The buffered disk cache used for small images.
        /// </param>
        /// <param name="cacheKeyFactory">
        /// The factory that creates cache keys for the pipeline.
        /// </param>
        /// <param name="platformBitmapFactory">
        /// The bitmap factory used for post process.
        /// </param>
        /// <param name="flexByteArrayPool">
        /// The memory pool used for post process.
        /// </param>
        /// <param name="forceSmallCacheThresholdBytes">
        /// The threshold set for using the small buffered disk cache.
        /// </param>
        public ProducerFactory(
            IByteArrayPool byteArrayPool,
            ImageDecoder imageDecoder,
            IProgressiveJpegConfig progressiveJpegConfig,
            bool downsampleEnabled,
            bool resizeAndRotateEnabledForNetwork,
            IExecutorSupplier executorSupplier,
            IPooledByteBufferFactory pooledByteBufferFactory,
            IMemoryCache <ICacheKey, CloseableImage> bitmapMemoryCache,
            IMemoryCache <ICacheKey, IPooledByteBuffer> encodedMemoryCache,
            BufferedDiskCache defaultBufferedDiskCache,
            BufferedDiskCache smallImageBufferedDiskCache,
            ICacheKeyFactory cacheKeyFactory,
            PlatformBitmapFactory platformBitmapFactory,
            FlexByteArrayPool flexByteArrayPool,
            int forceSmallCacheThresholdBytes)
        {
            _forceSmallCacheThresholdBytes = forceSmallCacheThresholdBytes;

            _byteArrayPool                    = byteArrayPool;
            _imageDecoder                     = imageDecoder;
            _progressiveJpegConfig            = progressiveJpegConfig;
            _downsampleEnabled                = downsampleEnabled;
            _resizeAndRotateEnabledForNetwork = resizeAndRotateEnabledForNetwork;

            _executorSupplier        = executorSupplier;
            _pooledByteBufferFactory = pooledByteBufferFactory;

            _bitmapMemoryCache           = bitmapMemoryCache;
            _encodedMemoryCache          = encodedMemoryCache;
            _defaultBufferedDiskCache    = defaultBufferedDiskCache;
            _smallImageBufferedDiskCache = smallImageBufferedDiskCache;
            _cacheKeyFactory             = cacheKeyFactory;

            _platformBitmapFactory = platformBitmapFactory;
            _flexByteArrayPool     = flexByteArrayPool;
        }
コード例 #4
0
 /// <summary>
 /// Sets the executor supplier.
 /// </summary>
 public Builder SetExecutorSupplier(IExecutorSupplier executorSupplier)
 {
     ExecutorSupplier = executorSupplier;
     return(this);
 }