Skip to content

Commit

Permalink
Improve post-processing
Browse files Browse the repository at this point in the history
  • Loading branch information
plamenko authored and tyronen committed Apr 15, 2015
1 parent 8ef45c6 commit 18be280
Show file tree
Hide file tree
Showing 7 changed files with 389 additions and 212 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.facebook.imagepipeline.animated.impl.AnimatedDrawableCachingBackendImpl;
import com.facebook.imagepipeline.animated.impl.AnimatedDrawableCachingBackendImplProvider;
import com.facebook.imagepipeline.animated.util.AnimatedDrawableUtil;
import com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory;
import com.facebook.imagepipeline.cache.BitmapCountingMemoryCacheFactory;
import com.facebook.imagepipeline.cache.BitmapMemoryCacheFactory;
import com.facebook.imagepipeline.cache.BitmapMemoryCacheKey;
Expand All @@ -42,7 +43,6 @@
import com.facebook.imagepipeline.cache.EncodedCountingMemoryCacheFactory;
import com.facebook.imagepipeline.cache.EncodedMemoryCacheFactory;
import com.facebook.imagepipeline.cache.MemoryCache;
import com.facebook.imagepipeline.decoder.CloseableImageCopier;
import com.facebook.imagepipeline.bitmaps.EmptyJpegGenerator;
import com.facebook.imagepipeline.image.CloseableImage;
import com.facebook.imagepipeline.memory.PooledByteBuffer;
Expand Down Expand Up @@ -94,7 +94,6 @@ public static void shutDown() {
private EmptyJpegGenerator mEmptyJpegGenerator;
private CountingMemoryCache<CacheKey, PooledByteBuffer, Void> mEncodedCountingMemoryCache;
private MemoryCache<CacheKey, PooledByteBuffer, Void> mEncodedMemoryCache;
private CloseableImageCopier mCloseableImageCopier;
private BufferedDiskCache mMainBufferedDiskCache;
private DiskStorageCache mMainDiskStorageCache;
private ImagePipeline mImagePipeline;
Expand Down Expand Up @@ -160,14 +159,6 @@ public MemoryCache<CacheKey, PooledByteBuffer, Void> getEncodedMemoryCache() {
return mEncodedMemoryCache;
}

public CloseableImageCopier getCloseableImageCopier() {
if (mCloseableImageCopier == null) {
mCloseableImageCopier =
new CloseableImageCopier(mConfig.getPlatformBitmapFactory());
}
return mCloseableImageCopier;
}

private BufferedDiskCache getMainBufferedDiskCache() {
if (mMainBufferedDiskCache == null) {
mMainBufferedDiskCache =
Expand Down Expand Up @@ -204,6 +195,10 @@ public ImagePipeline getImagePipeline() {
return mImagePipeline;
}

public PlatformBitmapFactory getPlatformBitmapFactory() {
return mConfig.getPlatformBitmapFactory();
}

private ProducerFactory getProducerFactory() {
if (mProducerFactory == null) {
mProducerFactory =
Expand All @@ -219,7 +214,7 @@ private ProducerFactory getProducerFactory() {
getMainBufferedDiskCache(),
getSmallImageBufferedDiskCache(),
mConfig.getCacheKeyFactory(),
getCloseableImageCopier());
mConfig.getPlatformBitmapFactory());
}
return mProducerFactory;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import com.facebook.cache.common.CacheKey;
import com.facebook.common.references.CloseableReference;
import com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory;
import com.facebook.imagepipeline.cache.BitmapMemoryCacheKey;
import com.facebook.imagepipeline.cache.BufferedDiskCache;
import com.facebook.imagepipeline.cache.CacheKeyFactory;
import com.facebook.imagepipeline.cache.MemoryCache;
import com.facebook.imagepipeline.decoder.CloseableImageCopier;
import com.facebook.imagepipeline.decoder.ImageDecoder;
import com.facebook.imagepipeline.decoder.ProgressiveJpegConfig;
import com.facebook.imagepipeline.image.CloseableImage;
Expand Down Expand Up @@ -79,7 +79,7 @@ public class ProducerFactory {
private final CacheKeyFactory mCacheKeyFactory;

// Postproc dependencies
private final CloseableImageCopier mCloseableImageCopier;
private final PlatformBitmapFactory mPlatformBitmapFactory;

public ProducerFactory(
Context context,
Expand All @@ -93,7 +93,7 @@ public ProducerFactory(
BufferedDiskCache defaultBufferedDiskCache,
BufferedDiskCache smallImageBufferedDiskCache,
CacheKeyFactory cacheKeyFactory,
CloseableImageCopier closeableImageCopier) {
PlatformBitmapFactory platformBitmapFactory) {
mContentResolver = context.getApplicationContext().getContentResolver();
mResources = context.getApplicationContext().getResources();
mAssetManager = context.getApplicationContext().getAssets();
Expand All @@ -111,7 +111,7 @@ public ProducerFactory(
mSmallImageBufferedDiskCache = smallImageBufferedDiskCache;
mCacheKeyFactory = cacheKeyFactory;

mCloseableImageCopier = closeableImageCopier;
mPlatformBitmapFactory = platformBitmapFactory;
}

public static AddImageTransformMetaDataProducer newAddImageTransformMetaDataProducer(
Expand Down Expand Up @@ -217,7 +217,7 @@ public static <T> NullProducer<T> newNullProducer() {
public PostprocessorProducer newPostprocessorProducer(
Producer<CloseableReference<CloseableImage>> nextProducer) {
return new PostprocessorProducer(
nextProducer, mCloseableImageCopier, mExecutorSupplier.forBackground());
nextProducer, mPlatformBitmapFactory, mExecutorSupplier.forBackground());
}

public static RemoveImageTransformMetaDataProducer newRemoveImageTransformMetaDataProducer(
Expand Down

This file was deleted.

Loading

0 comments on commit 18be280

Please sign in to comment.