Skip to content

Commit a908abc

Browse files
committed
bump up 1.4.0
1 parent 3e0738d commit a908abc

File tree

9 files changed

+318
-20
lines changed

9 files changed

+318
-20
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Change Log
22
==========
33

4+
Version 1.4.0 *(2016-02-28)*
5+
----------------------------
6+
7+
fix Issue [#29](https://github.com/wasabeef/glide-transformations/issues/29)
8+
Use FastBlur as a fallback upon RenderScript failure.
9+
410
Version 1.3.1 *(2015-11-27)*
511
----------------------------
612

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ repositories {
3333
}
3434
3535
dependencies {
36-
compile 'jp.wasabeef:glide-transformations:1.3.1'
36+
compile 'jp.wasabeef:glide-transformations:1.4.0'
3737
// If you want to use the GPU Filters
3838
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
3939
}
@@ -97,10 +97,6 @@ android {
9797
`SwirlFilterTransformation`, `BrightnessFilterTransformation`, `KuwaharaFilterTransformation`
9898
`VignetteFilterTransformation`
9999

100-
### Proguard
101-
```
102-
-dontwarn jp.co.cyberagent.android.gpuimage.**
103-
```
104100

105101
Applications using Glide Transformations
106102
---

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
8+
classpath 'com.android.tools.build:gradle:2.0.0-beta6'
99
classpath 'com.novoda:bintray-release:0.3.4'
1010

1111
// NOTE: Do not place your application dependencies here; they belong

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=1.3.1
1+
VERSION_NAME=1.4.0
22
GROUP=jp.wasabeef
33
ARTIFACT_ID=glide-transformations
44

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip

transformations/build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ android {
1414
// Warning:Renderscript support mode is not currently supported with renderscript target 21+
1515
renderscriptTargetApi RENDERSCRIPT_TARGET_API as int
1616
renderscriptSupportModeEnabled true
17+
18+
consumerProguardFiles 'proguard-rules.txt'
1719
}
1820
}
1921

@@ -22,6 +24,26 @@ dependencies {
2224
provided "jp.co.cyberagent.android.gpuimage:gpuimage-library:${GPUIMAGE_VERSION}"
2325
}
2426

27+
task androidJavadocs(type: Javadoc) {
28+
source = android.sourceSets.main.java.srcDirs
29+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
30+
}
31+
32+
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
33+
classifier = 'javadoc'
34+
from androidJavadocs.destinationDir
35+
}
36+
37+
task androidSourcesJar(type: Jar) {
38+
classifier = 'sources'
39+
from android.sourceSets.main.java.srcDirs
40+
}
41+
42+
artifacts {
43+
archives androidSourcesJar
44+
archives androidJavadocsJar
45+
}
46+
2547
publish {
2648
userOrg = POM_DEVELOPER_ID
2749
groupId = GROUP

transformations/proguard-rules.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-keepclasseswithmembernames class * {
2+
native <methods>;
3+
}
4+
5+
-keep class android.support.v8.renderscript.** { *; }
6+
7+
-dontwarn jp.co.cyberagent.android.gpuimage.**

transformations/src/main/java/jp/wasabeef/glide/transformations/BlurTransformation.java

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
import android.graphics.Paint;
2323
import android.support.v8.renderscript.Allocation;
2424
import android.support.v8.renderscript.Element;
25+
import android.support.v8.renderscript.RSRuntimeException;
2526
import android.support.v8.renderscript.RenderScript;
2627
import android.support.v8.renderscript.ScriptIntrinsicBlur;
2728
import com.bumptech.glide.Glide;
2829
import com.bumptech.glide.load.Transformation;
2930
import com.bumptech.glide.load.engine.Resource;
3031
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
3132
import com.bumptech.glide.load.resource.bitmap.BitmapResource;
33+
import jp.wasabeef.glide.transformations.internal.FastBlur;
3234

3335
public class BlurTransformation implements Transformation<Bitmap> {
3436

@@ -88,18 +90,26 @@ public Resource<Bitmap> transform(Resource<Bitmap> resource, int outWidth, int o
8890
paint.setFlags(Paint.FILTER_BITMAP_FLAG);
8991
canvas.drawBitmap(source, 0, 0, paint);
9092

91-
RenderScript rs = RenderScript.create(mContext);
92-
Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
93-
Allocation.USAGE_SCRIPT);
94-
Allocation output = Allocation.createTyped(rs, input.getType());
95-
ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
96-
97-
blur.setInput(input);
98-
blur.setRadius(mRadius);
99-
blur.forEach(output);
100-
output.copyTo(bitmap);
101-
102-
rs.destroy();
93+
RenderScript rs = null;
94+
try {
95+
rs = RenderScript.create(mContext);
96+
Allocation input =
97+
Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_NONE,
98+
Allocation.USAGE_SCRIPT);
99+
Allocation output = Allocation.createTyped(rs, input.getType());
100+
ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
101+
102+
blur.setInput(input);
103+
blur.setRadius(mRadius);
104+
blur.forEach(output);
105+
output.copyTo(bitmap);
106+
} catch (RSRuntimeException e) {
107+
bitmap = FastBlur.doBlur(bitmap, mRadius, true);
108+
} finally {
109+
if (rs != null) {
110+
rs.destroy();
111+
}
112+
}
103113

104114
return BitmapResource.obtain(bitmap, mBitmapPool);
105115
}

0 commit comments

Comments
 (0)