From 96f3e0b9ce3c5d619fb497a60fee61a1c50659a3 Mon Sep 17 00:00:00 2001 From: Matej Trakal Date: Wed, 2 Dec 2020 08:51:37 +0100 Subject: [PATCH] CropCircleWithBorderTransformation - border radius incorrect --- .../CropCircleWithBorderTransformation.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/transformations/src/main/java/jp/wasabeef/glide/transformations/CropCircleWithBorderTransformation.java b/transformations/src/main/java/jp/wasabeef/glide/transformations/CropCircleWithBorderTransformation.java index ca6cb9b..45f54c4 100644 --- a/transformations/src/main/java/jp/wasabeef/glide/transformations/CropCircleWithBorderTransformation.java +++ b/transformations/src/main/java/jp/wasabeef/glide/transformations/CropCircleWithBorderTransformation.java @@ -66,11 +66,12 @@ protected Bitmap transform(@NonNull Context context, @NonNull BitmapPool pool, paint.setStrokeWidth(borderSize); paint.setAntiAlias(true); + int outMinEdge = Math.min(outWidth, outHeight); Canvas canvas = new Canvas(bitmap); canvas.drawCircle( - outWidth / 2f, - outHeight / 2f, - Math.max(outWidth, outHeight) / 2f - borderSize / 2f, + outMinEdge / 2f, + outMinEdge / 2f, + outMinEdge / 2f - borderSize / 2f, paint );