Search in sources :

Example 1 with VitoImageRequest

use of com.facebook.fresco.vito.core.VitoImageRequest in project fresco by facebook.

the class VitoImagePipelineImpl method createImageRequest.

@Override
public VitoImageRequest createImageRequest(Resources resources, ImageSource imageSource, @Nullable ImageOptions options) {
    if (options == null) {
        options = ImageOptions.defaults();
    }
    if (!(imageSource instanceof VitoImageSource)) {
        throw new IllegalArgumentException("ImageSource not supported: " + imageSource);
    }
    VitoImageSource vitoImageSource = (VitoImageSource) imageSource;
    CacheKey finalImageCacheKey = null;
    ImageRequest finalImageRequest = vitoImageSource.maybeExtractFinalImageRequest(mImagePipelineUtils, options);
    if (finalImageRequest != null) {
        finalImageCacheKey = mImagePipeline.getCacheKey(finalImageRequest, null);
    }
    return new VitoImageRequest(resources, imageSource, options, finalImageRequest, finalImageCacheKey);
}
Also used : VitoImageRequest(com.facebook.fresco.vito.core.VitoImageRequest) VitoImageRequest(com.facebook.fresco.vito.core.VitoImageRequest) ImageRequest(com.facebook.imagepipeline.request.ImageRequest) VitoImageSource(com.facebook.fresco.vito.core.impl.source.VitoImageSource) CacheKey(com.facebook.cache.common.CacheKey)

Example 2 with VitoImageRequest

use of com.facebook.fresco.vito.core.VitoImageRequest in project fresco by facebook.

the class FrescoController2Impl method obtainExtras.

private static Extras obtainExtras(@Nullable DataSource<CloseableReference<CloseableImage>> dataSource, @Nullable CloseableReference<CloseableImage> image, FrescoDrawable2 drawable) {
    Map<String, Object> imageExtras = null;
    if (image != null) {
        imageExtras = image.get().getExtras();
    }
    Uri sourceUri = null;
    VitoImageRequest vitoImageRequest = drawable.getImageRequest();
    if (vitoImageRequest != null) {
        if (vitoImageRequest.finalImageRequest != null) {
            sourceUri = vitoImageRequest.finalImageRequest.getSourceUri();
        }
    }
    return MiddlewareUtils.obtainExtras(COMPONENT_EXTRAS, SHORTCUT_EXTRAS, dataSource == null ? null : dataSource.getExtras(), drawable.getViewportDimensions(), String.valueOf(drawable.getActualImageScaleType()), drawable.getActualImageFocusPoint(), imageExtras, drawable.getCallerContext(), sourceUri);
}
Also used : VitoImageRequest(com.facebook.fresco.vito.core.VitoImageRequest) Uri(android.net.Uri)

Example 3 with VitoImageRequest

use of com.facebook.fresco.vito.core.VitoImageRequest in project fresco by facebook.

the class FrescoController2Impl method onRelease.

@Override
public void onRelease(final FrescoDrawable2Impl drawable) {
    final VitoImageRequest imageRequest = drawable.getImageRequest();
    if (imageRequest != null) {
        // Notify listeners
        drawable.getInternalListener().onRelease(drawable.getImageId(), imageRequest, obtainExtras(null, null, drawable));
    }
    drawable.getImagePerfListener().onImageRelease(drawable);
}
Also used : VitoImageRequest(com.facebook.fresco.vito.core.VitoImageRequest)

Aggregations

VitoImageRequest (com.facebook.fresco.vito.core.VitoImageRequest)3 Uri (android.net.Uri)1 CacheKey (com.facebook.cache.common.CacheKey)1 VitoImageSource (com.facebook.fresco.vito.core.impl.source.VitoImageSource)1 ImageRequest (com.facebook.imagepipeline.request.ImageRequest)1