private CloseableReference<CloseableImage> postprocessInternal(CloseableImage sourceImage) { CloseableStaticBitmap staticBitmap = (CloseableStaticBitmap) sourceImage; Bitmap sourceBitmap = staticBitmap.getUnderlyingBitmap(); CloseableReference<Bitmap> bitmapRef = mPostprocessor.process(sourceBitmap, mBitmapFactory); int rotationAngle = staticBitmap.getRotationAngle(); try { return CloseableReference.<CloseableImage>of( new CloseableStaticBitmap(bitmapRef, sourceImage.getQualityInfo(), rotationAngle)); } finally { CloseableReference.closeSafely(bitmapRef); } }
@Before public void setUp() { MockitoAnnotations.initMocks(this); mBitmapMemoryCacheGetProducer = new BitmapMemoryCacheGetProducer(mMemoryCache, mCacheKeyFactory, mInputProducer); mCloseableImage1 = mock(CloseableImage.class); mFinalImageReference = CloseableReference.of(mCloseableImage1); when(mCloseableImage1.getQualityInfo()).thenReturn(ImmutableQualityInfo.FULL_QUALITY); when(mProducerContext.getImageRequest()).thenReturn(mImageRequest); when(mProducerContext.getListener()).thenReturn(mProducerListener); when(mProducerContext.getId()).thenReturn(mRequestId); when(mProducerListener.requiresExtraMap(mRequestId)).thenReturn(true); when(mProducerContext.getLowestPermittedRequestLevel()) .thenReturn(ImageRequest.RequestLevel.FULL_FETCH); when(mProducerContext.getCallerContext()).thenReturn(PRODUCER_NAME); when(mCacheKeyFactory.getBitmapCacheKey(mImageRequest, PRODUCER_NAME)).thenReturn(mCacheKey); }