diff --git a/vito/drawee-support/src/main/java/com/facebook/fresco/vito/draweesupport/RoundingParamsWrapper.kt b/vito/drawee-support/src/main/java/com/facebook/fresco/vito/draweesupport/RoundingParamsWrapper.kt index f62e5b9000..9626d83e81 100644 --- a/vito/drawee-support/src/main/java/com/facebook/fresco/vito/draweesupport/RoundingParamsWrapper.kt +++ b/vito/drawee-support/src/main/java/com/facebook/fresco/vito/draweesupport/RoundingParamsWrapper.kt @@ -10,16 +10,30 @@ package com.facebook.fresco.vito.draweesupport import com.facebook.drawee.generic.RoundingParams import com.facebook.fresco.vito.options.BorderOptions import com.facebook.fresco.vito.options.RoundingOptions +import com.facebook.fresco.vito.options.RoundingOptions.Companion.CORNER_RADIUS_UNSET object RoundingParamsWrapper { @JvmStatic - fun roundingOptionsFromRoundingParams(roundingParams: RoundingParams?): RoundingOptions? { + @JvmOverloads + fun roundingOptionsFromRoundingParams( + roundingParams: RoundingParams?, + roundAtRenderTime: Boolean = false + ): RoundingOptions? { return when { roundingParams == null -> null - roundingParams.roundAsCircle -> RoundingOptions.asCircle(true) + roundingParams.roundAsCircle -> + if (roundAtRenderTime) { + RoundingOptions.asCircle(true, true) + } else { + RoundingOptions.asCircle() + } roundingParams.cornersRadii != null -> - RoundingOptions.forCornerRadii(roundingParams.cornersRadii!!, true) + if (roundAtRenderTime) { + RoundingOptions(false, CORNER_RADIUS_UNSET, roundingParams.cornersRadii!!, true, true) + } else { + RoundingOptions.forCornerRadii(roundingParams.cornersRadii!!, true) + } // TODO: we also have an overlay color mode where you specify a color to be drawn on top. Vito // does not support this. // Probably only used for borders