Search in sources :

Example 1 with DebugControllerOverlayDrawable

use of com.facebook.drawee.debug.DebugControllerOverlayDrawable in project fresco by facebook.

the class PipelineDraweeController method maybeUpdateDebugOverlay.

private void maybeUpdateDebugOverlay(@Nullable CloseableImage image) {
    if (!mDrawDebugOverlay) {
        return;
    }
    Drawable controllerOverlay = getControllerOverlay();
    if (controllerOverlay == null) {
        controllerOverlay = new DebugControllerOverlayDrawable();
        setControllerOverlay(controllerOverlay);
    }
    if (controllerOverlay instanceof DebugControllerOverlayDrawable) {
        DebugControllerOverlayDrawable debugOverlay = (DebugControllerOverlayDrawable) controllerOverlay;
        debugOverlay.setControllerId(getId());
        final DraweeHierarchy draweeHierarchy = getHierarchy();
        ScaleType scaleType = null;
        if (draweeHierarchy != null) {
            final ScaleTypeDrawable scaleTypeDrawable = ScalingUtils.getActiveScaleTypeDrawable(draweeHierarchy.getTopLevelDrawable());
            scaleType = scaleTypeDrawable != null ? scaleTypeDrawable.getScaleType() : null;
        }
        debugOverlay.setScaleType(scaleType);
        if (image != null) {
            debugOverlay.setDimensions(image.getWidth(), image.getHeight());
            debugOverlay.setImageSize(image.getSizeInBytes());
        } else {
            debugOverlay.reset();
        }
    }
}
Also used : DebugControllerOverlayDrawable(com.facebook.drawee.debug.DebugControllerOverlayDrawable) ScaleType(com.facebook.drawee.drawable.ScalingUtils.ScaleType) Drawable(android.graphics.drawable.Drawable) ScaleTypeDrawable(com.facebook.drawee.drawable.ScaleTypeDrawable) OrientedDrawable(com.facebook.drawee.drawable.OrientedDrawable) BitmapDrawable(android.graphics.drawable.BitmapDrawable) DebugControllerOverlayDrawable(com.facebook.drawee.debug.DebugControllerOverlayDrawable) ScaleTypeDrawable(com.facebook.drawee.drawable.ScaleTypeDrawable) SettableDraweeHierarchy(com.facebook.drawee.interfaces.SettableDraweeHierarchy) DraweeHierarchy(com.facebook.drawee.interfaces.DraweeHierarchy)

Aggregations

BitmapDrawable (android.graphics.drawable.BitmapDrawable)1 Drawable (android.graphics.drawable.Drawable)1 DebugControllerOverlayDrawable (com.facebook.drawee.debug.DebugControllerOverlayDrawable)1 OrientedDrawable (com.facebook.drawee.drawable.OrientedDrawable)1 ScaleTypeDrawable (com.facebook.drawee.drawable.ScaleTypeDrawable)1 ScaleType (com.facebook.drawee.drawable.ScalingUtils.ScaleType)1 DraweeHierarchy (com.facebook.drawee.interfaces.DraweeHierarchy)1 SettableDraweeHierarchy (com.facebook.drawee.interfaces.SettableDraweeHierarchy)1