From cbb88109494ffc7916f6639c20ce05c0cec941a9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 07 四月 2021 15:07:45 +0800
Subject: [PATCH] 3.9.1bug修复

---
 library-common/src/com/lcjian/library/util/glide/GlideRoundTransform.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/library-common/src/com/lcjian/library/util/glide/GlideRoundTransform.java b/library-common/src/com/lcjian/library/util/glide/GlideRoundTransform.java
index 60dab9e..68cbc84 100644
--- a/library-common/src/com/lcjian/library/util/glide/GlideRoundTransform.java
+++ b/library-common/src/com/lcjian/library/util/glide/GlideRoundTransform.java
@@ -8,9 +8,11 @@
 import android.graphics.Paint;
 import android.graphics.RectF;
 import android.support.annotation.NonNull;
+import android.util.Log;
 
 import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
 import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
+import com.bumptech.glide.load.resource.bitmap.TransformationUtils;
 import com.bumptech.glide.util.Util;
 
 import java.io.UnsupportedEncodingException;
@@ -24,8 +26,9 @@
  */
 public class GlideRoundTransform extends BitmapTransformation {
     private static final String ID = GlideRoundTransform.class.getClass().getName();
+    private static final String TAG = "GlideRoundTransform";
     private static byte[] ID_BYTES = null;
-    private static float radius = 0f;
+    private  float radius = 0f;
 
     public GlideRoundTransform(Context context) {
         this(context, 12);
@@ -48,13 +51,17 @@
     @Override
     protected Bitmap transform(BitmapPool pool, Bitmap toTransform,
                                int outWidth, int outHeight) {
-        return roundCrop(pool, toTransform);
+        //澶勭悊centercrop
+        Bitmap bitmap = TransformationUtils.centerCrop(pool, toTransform, outWidth, outHeight);
+        return roundCrop(pool, bitmap == null ? toTransform : bitmap);
     }
 
-    private static Bitmap roundCrop(BitmapPool pool, Bitmap source) {
+    private  Bitmap roundCrop(BitmapPool pool, Bitmap source) {
         if (source == null)
             return null;
 
+        Log.i(TAG, "婧愬浘鐗囧ぇ灏�:" + source.getWidth() + "-" + source.getHeight());
+
         Bitmap result = pool.get(source.getWidth(), source.getHeight(),
                 Bitmap.Config.ARGB_8888);
         if (result == null) {

--
Gitblit v1.8.0