use of com.facebook.fresco.vito.core.impl.source.VitoImageSource in project fresco by facebook.
the class VitoImagePipelineImpl method fetchDecodedImage.
@Override
public DataSource<CloseableReference<CloseableImage>> fetchDecodedImage(final VitoImageRequest imageRequest, @Nullable final Object callerContext, @Nullable final RequestListener requestListener, final long uiComponentId) {
if (!(imageRequest.imageSource instanceof VitoImageSource)) {
return DataSources.immediateFailedDataSource(new IllegalArgumentException("Unknown ImageSource " + imageRequest.imageSource));
}
VitoImageSource vitoImageSource = (VitoImageSource) imageRequest.imageSource;
final String stringId = VitoUtils.getStringId(uiComponentId);
return vitoImageSource.createDataSourceSupplier(mImagePipeline, mImagePipelineUtils, imageRequest.imageOptions, callerContext, requestListener, stringId).get();
}
use of com.facebook.fresco.vito.core.impl.source.VitoImageSource 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);
}
Aggregations