From aef7541ea3b41905e85da63f90c565aab7243e95 Mon Sep 17 00:00:00 2001 From: wasabeef Date: Fri, 27 Nov 2015 17:11:58 +0900 Subject: [PATCH] fix leak code and constractor --- .../glide/transformations/MaskTransformation.java | 8 ++++++-- .../transformations/RoundedCornersTransformation.java | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/transformations/src/main/java/jp/wasabeef/glide/transformations/MaskTransformation.java b/transformations/src/main/java/jp/wasabeef/glide/transformations/MaskTransformation.java index 4d84d5a..20839b4 100644 --- a/transformations/src/main/java/jp/wasabeef/glide/transformations/MaskTransformation.java +++ b/transformations/src/main/java/jp/wasabeef/glide/transformations/MaskTransformation.java @@ -47,8 +47,12 @@ public class MaskTransformation implements Transformation { * same make file name. If you have a good idea please tell us, thanks. */ public MaskTransformation(Context context, int maskId) { - mBitmapPool = Glide.get(context).getBitmapPool(); - mContext = context; + this(context, Glide.get(context).getBitmapPool(), maskId); + } + + public MaskTransformation(Context context, BitmapPool pool, int maskId) { + mBitmapPool = pool; + mContext = context.getApplicationContext(); mMaskId = maskId; } diff --git a/transformations/src/main/java/jp/wasabeef/glide/transformations/RoundedCornersTransformation.java b/transformations/src/main/java/jp/wasabeef/glide/transformations/RoundedCornersTransformation.java index 973ab81..cd517f8 100644 --- a/transformations/src/main/java/jp/wasabeef/glide/transformations/RoundedCornersTransformation.java +++ b/transformations/src/main/java/jp/wasabeef/glide/transformations/RoundedCornersTransformation.java @@ -49,9 +49,18 @@ public class RoundedCornersTransformation implements Transformation { this(context, radius, margin, CornerType.ALL); } + public RoundedCornersTransformation(BitmapPool pool, int radius, int margin) { + this(pool, radius, margin, CornerType.ALL); + } + public RoundedCornersTransformation(Context context, int radius, int margin, CornerType cornerType) { - mBitmapPool = Glide.get(context).getBitmapPool(); + this(Glide.get(context).getBitmapPool(), radius, margin, cornerType); + } + + public RoundedCornersTransformation(BitmapPool pool, int radius, int margin, + CornerType cornerType) { + mBitmapPool = pool; mRadius = radius; mDiameter = mRadius * 2; mMargin = margin;