use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.
the class ExperimentalAnimationFactory method createAnimationBackend.
private AnimationBackend createAnimationBackend(AnimatedImageResult animatedImageResult) {
// Create the animated drawable backend
AnimatedImage animatedImage = animatedImageResult.getImage();
Rect initialBounds = new Rect(0, 0, animatedImage.getWidth(), animatedImage.getHeight());
AnimatedDrawableBackend animatedDrawableBackend = mAnimatedDrawableBackendProvider.get(animatedImageResult, initialBounds);
// Add caching backend
AnimatedDrawableCachingBackend animatedDrawableCachingBackend = mAnimatedDrawableCachingBackendProvider.get(animatedDrawableBackend, AnimatedDrawableOptions.DEFAULTS);
AnimatedDrawableCachingBackendWrapper animatedDrawableCachingBackendWrapper = new AnimatedDrawableCachingBackendWrapper(animatedDrawableCachingBackend);
// Add inactivity check
return AnimationBackendDelegateWithInactivityCheck.createForBackend(animatedDrawableCachingBackendWrapper, mMonotonicClock, mScheduledExecutorServiceForUiThread);
}
use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.
the class AnimatedDrawableCachingBackendWrapper method setBounds.
@Override
public void setBounds(@Nullable Rect bounds) {
if (bounds != null && bounds.equals(mBounds)) {
return;
}
mBounds = bounds;
AnimatedDrawableCachingBackend newBackend = mAnimatedDrawableCachingBackend.forNewBounds(bounds);
if (newBackend != mAnimatedDrawableCachingBackend) {
mAnimatedDrawableCachingBackend.dropCaches();
}
mAnimatedDrawableCachingBackend = newBackend;
CloseableReference.closeSafely(mLastDrawnFrame);
mLastDrawnFrame = null;
}
use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.
the class AnimatedDrawableFactoryImpl method createAnimatedDrawable.
private AnimatedDrawable createAnimatedDrawable(AnimatedDrawableOptions options, AnimatedDrawableBackend animatedDrawableBackend) {
DisplayMetrics displayMetrics = mResources.getDisplayMetrics();
AnimatedDrawableDiagnostics animatedDrawableDiagnostics;
AnimatedDrawableCachingBackend animatedDrawableCachingBackend = mAnimatedDrawableCachingBackendProvider.get(animatedDrawableBackend, options);
if (options.enableDebugging) {
animatedDrawableDiagnostics = new AnimatedDrawableDiagnosticsImpl(mAnimatedDrawableUtil, displayMetrics);
} else {
animatedDrawableDiagnostics = AnimatedDrawableDiagnosticsNoop.getInstance();
}
return new AnimatedDrawable(mScheduledExecutorServiceForUiThread, animatedDrawableCachingBackend, animatedDrawableDiagnostics, mMonotonicClock);
}
use of com.facebook.imagepipeline.animated.base.AnimatedDrawableCachingBackend in project fresco by facebook.
the class AnimatedDrawableFactoryImplSupport method createAnimatedDrawable.
private AnimatedDrawableSupport createAnimatedDrawable(AnimatedDrawableOptions options, AnimatedDrawableBackend animatedDrawableBackend) {
DisplayMetrics displayMetrics = mResources.getDisplayMetrics();
AnimatedDrawableDiagnostics animatedDrawableDiagnostics;
AnimatedDrawableCachingBackend animatedDrawableCachingBackend = mAnimatedDrawableCachingBackendProvider.get(animatedDrawableBackend, options);
if (options.enableDebugging) {
animatedDrawableDiagnostics = new AnimatedDrawableDiagnosticsImpl(mAnimatedDrawableUtil, displayMetrics);
} else {
animatedDrawableDiagnostics = AnimatedDrawableDiagnosticsNoop.getInstance();
}
return new AnimatedDrawableSupport(mScheduledExecutorServiceForUiThread, animatedDrawableCachingBackend, animatedDrawableDiagnostics, mMonotonicClock);
}
Aggregations