Search in sources :

Example 11 with DraweeHierarchy

use of com.facebook.drawee.interfaces.DraweeHierarchy in project fresco by facebook.

the class PipelineDraweeController method updateDebugOverlay.

/**
 * updateDebugOverlay updates the debug overlay. Subclasses of {@link PipelineDraweeController}
 * can override this method (and call <code>super</code>) to provide additional debug information.
 */
protected void updateDebugOverlay(@Nullable CloseableImage image, DebugControllerOverlayDrawable debugOverlay) {
    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);
    // fill in image origin text and color hint
    final int origin = mDebugOverlayImageOriginListener.getImageOrigin();
    final String originText = ImageOriginUtils.toString(origin);
    final int originColor = DebugOverlayImageOriginColor.getImageOriginColor(origin);
    debugOverlay.setOrigin(originText, originColor);
    if (image != null) {
        debugOverlay.setDimensions(image.getWidth(), image.getHeight());
        debugOverlay.setImageSize(image.getSizeInBytes());
    } else {
        debugOverlay.reset();
    }
}
Also used : ScaleType(com.facebook.drawee.drawable.ScalingUtils.ScaleType) ScaleTypeDrawable(com.facebook.drawee.drawable.ScaleTypeDrawable) SettableDraweeHierarchy(com.facebook.drawee.interfaces.SettableDraweeHierarchy) DraweeHierarchy(com.facebook.drawee.interfaces.DraweeHierarchy)

Example 12 with DraweeHierarchy

use of com.facebook.drawee.interfaces.DraweeHierarchy in project fresco by facebook.

the class ImagePerfMonitor method addViewportData.

public void addViewportData() {
    DraweeHierarchy hierarchy = mPipelineDraweeController.getHierarchy();
    if (hierarchy != null && hierarchy.getTopLevelDrawable() != null) {
        Rect bounds = hierarchy.getTopLevelDrawable().getBounds();
        mImagePerfState.setOnScreenWidth(bounds.width());
        mImagePerfState.setOnScreenHeight(bounds.height());
    }
}
Also used : Rect(android.graphics.Rect) DraweeHierarchy(com.facebook.drawee.interfaces.DraweeHierarchy)

Aggregations

DraweeHierarchy (com.facebook.drawee.interfaces.DraweeHierarchy)12 Test (org.junit.Test)6 GenericDraweeHierarchy (com.facebook.drawee.generic.GenericDraweeHierarchy)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 Activity (android.app.Activity)1 Rect (android.graphics.Rect)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 MotionEvent (android.view.MotionEvent)1 ScaleTypeDrawable (com.facebook.drawee.drawable.ScaleTypeDrawable)1 ScaleType (com.facebook.drawee.drawable.ScalingUtils.ScaleType)1 GenericDraweeHierarchyBuilder (com.facebook.drawee.generic.GenericDraweeHierarchyBuilder)1 DraweeController (com.facebook.drawee.interfaces.DraweeController)1 SettableDraweeHierarchy (com.facebook.drawee.interfaces.SettableDraweeHierarchy)1 DraweeSpanStringBuilder (com.facebook.drawee.span.DraweeSpanStringBuilder)1 Before (org.junit.Before)1 Answer (org.mockito.stubbing.Answer)1