mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-10-05 02:13:22 +08:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4c23e38206 | ||
|
ffae37274c | ||
|
0c6f696ba7 | ||
|
3aea08abaa | ||
|
883c131ad6 | ||
|
ee1f533999 |
@@ -1,6 +1,11 @@
|
||||
Change Log
|
||||
==========
|
||||
|
||||
Version 1.0.4 *(2015-02-13)*
|
||||
----------------------------
|
||||
|
||||
Bug fix : remove original bitmap resource recycling.
|
||||
|
||||
Version 1.0.3 *(2015-02-05)*
|
||||
----------------------------
|
||||
|
||||
|
@@ -32,7 +32,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'jp.wasabeef:glide-transformations:1.0.3@aar'
|
||||
compile 'jp.wasabeef:glide-transformations:1.0.4@aar'
|
||||
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3@aar'
|
||||
}
|
||||
```
|
||||
|
@@ -53,7 +53,7 @@ def getKeyAliasPasswordProperty() {
|
||||
|
||||
dependencies {
|
||||
compile project(':transformations')
|
||||
// compile 'jp.wasabeef:glide-transformations:1.0.3'
|
||||
// compile 'jp.wasabeef:glide-transformations:1.0.4'
|
||||
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.2.3'
|
||||
compile 'com.android.support:appcompat-v7:21.+'
|
||||
compile 'com.android.support:recyclerview-v7:21.+'
|
||||
|
@@ -1,5 +1,5 @@
|
||||
VERSION_NAME=1.0.3
|
||||
VERSION_CODE=3
|
||||
VERSION_NAME=1.0.5
|
||||
VERSION_CODE=5
|
||||
GROUP=jp.wasabeef
|
||||
ARTIFACT_ID=glide-transformations
|
||||
|
||||
|
@@ -24,8 +24,6 @@ import com.bumptech.glide.load.resource.bitmap.BitmapResource;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.support.v8.renderscript.Allocation;
|
||||
import android.support.v8.renderscript.RenderScript;
|
||||
import android.support.v8.renderscript.ScriptIntrinsicBlur;
|
||||
@@ -74,7 +72,6 @@ public class BlurTransformation implements Transformation<Bitmap> {
|
||||
blur.forEach(overlayAlloc);
|
||||
overlayAlloc.copyTo(bitmap);
|
||||
|
||||
source.recycle();
|
||||
rs.destroy();
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
|
@@ -58,8 +58,6 @@ public class ColorFilterTransformation implements Transformation<Bitmap> {
|
||||
paint.setColorFilter(new PorterDuffColorFilter(mColor, PorterDuff.Mode.SRC_ATOP));
|
||||
canvas.drawBitmap(source, 0, 0, paint);
|
||||
|
||||
source.recycle();
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
}
|
||||
|
||||
|
@@ -43,28 +43,26 @@ public class CropCircleTransformation implements Transformation<Bitmap> {
|
||||
int width = (source.getWidth() - size) / 2;
|
||||
int height = (source.getHeight() - size) / 2;
|
||||
|
||||
Bitmap.Config config =
|
||||
source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
|
||||
Bitmap bitmap = mBitmapPool.get(size, size, config);
|
||||
Bitmap bitmap = mBitmapPool.get(size, size, Bitmap.Config.ARGB_8888);
|
||||
if (bitmap == null) {
|
||||
bitmap = Bitmap.createBitmap(size, size, config);
|
||||
bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
Paint paint = new Paint();
|
||||
BitmapShader shader = new BitmapShader(source, BitmapShader.TileMode.CLAMP,
|
||||
BitmapShader.TileMode.CLAMP);
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate(-width, -height);
|
||||
shader.setLocalMatrix(matrix);
|
||||
if (width != 0 || height != 0) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate(-width, -height);
|
||||
shader.setLocalMatrix(matrix);
|
||||
}
|
||||
paint.setShader(shader);
|
||||
paint.setAntiAlias(true);
|
||||
|
||||
float r = size / 2f;
|
||||
canvas.drawCircle(r, r, r, paint);
|
||||
|
||||
source.recycle();
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
}
|
||||
|
||||
|
@@ -48,10 +48,6 @@ public class CropSquareTransformation implements Transformation<Bitmap> {
|
||||
bitmap = Bitmap.createBitmap(source, mWidth, mHeight, size, size);
|
||||
}
|
||||
|
||||
if (bitmap != source) {
|
||||
source.recycle();
|
||||
}
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
}
|
||||
|
||||
|
@@ -71,8 +71,6 @@ public class CropTransformation implements Transformation<Bitmap> {
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
canvas.drawBitmap(source, null, targetRect, null);
|
||||
|
||||
source.recycle();
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
}
|
||||
|
||||
|
@@ -56,8 +56,6 @@ public class GrayscaleTransformation implements Transformation<Bitmap> {
|
||||
paint.setColorFilter(new ColorMatrixColorFilter(saturation));
|
||||
canvas.drawBitmap(source, 0, 0, paint);
|
||||
|
||||
source.recycle();
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
}
|
||||
|
||||
|
@@ -48,11 +48,9 @@ public class RoundedCornersTransformation implements Transformation<Bitmap> {
|
||||
int width = source.getWidth();
|
||||
int height = source.getHeight();
|
||||
|
||||
Bitmap.Config config =
|
||||
source.getConfig() != null ? source.getConfig() : Bitmap.Config.ARGB_8888;
|
||||
Bitmap bitmap = mBitmapPool.get(width, height, config);
|
||||
Bitmap bitmap = mBitmapPool.get(width, height, Bitmap.Config.ARGB_8888);
|
||||
if (bitmap == null) {
|
||||
bitmap = Bitmap.createBitmap(width, height, config);
|
||||
bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
@@ -62,8 +60,6 @@ public class RoundedCornersTransformation implements Transformation<Bitmap> {
|
||||
canvas.drawRoundRect(new RectF(margin, margin, width - margin, height - margin),
|
||||
radius, radius, paint);
|
||||
|
||||
source.recycle();
|
||||
|
||||
return BitmapResource.obtain(bitmap, mBitmapPool);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user