summaryrefslogtreecommitdiff
path: root/packages/WallpaperCropper
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2017-02-20 13:27:38 +0000
committerPaul Duffin <paulduffin@google.com>2017-02-20 13:27:38 +0000
commit0589d8287ef05b701754dcb916cc3079c907f847 (patch)
treeeaa673dc2e27053488af681b80c03647e6d60ce5 /packages/WallpaperCropper
parent9598c98db0b4bbab38c0c0667fd31afb95d49a62 (diff)
Use Utils.assertTrue() in code that used junit.framework.Assert.assertTrue()
The previous changes to these files, which inlined the behavior of Assert.assertTrue() were done in a hurry to fix the build. This change makes use of the existing Utils.assertTrue() method that was created for this purpose. Bug: 30188076 Test: make checkbuild Change-Id: Iacd505f8c3f7cefe6de94d30b56e39600bb9b0af
Diffstat (limited to 'packages/WallpaperCropper')
-rw-r--r--packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java6
-rw-r--r--packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java6
-rw-r--r--packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java10
3 files changed, 10 insertions, 12 deletions
diff --git a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java
index e708d53e556c..f8b01cb428c4 100644
--- a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java
+++ b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java
@@ -18,6 +18,8 @@ package com.android.gallery3d.glrenderer;
import android.graphics.Bitmap;
+import com.android.gallery3d.common.Utils;
+
// BitmapTexture is a texture whose content is specified by a fixed Bitmap.
//
// The texture does not own the Bitmap. The user should make sure the Bitmap
@@ -32,9 +34,7 @@ public class BitmapTexture extends UploadedTexture {
public BitmapTexture(Bitmap bitmap, boolean hasBorder) {
super(hasBorder);
- if (bitmap == null || bitmap.isRecycled()) {
- throw new AssertionError();
- }
+ Utils.assertTrue(bitmap != null && !bitmap.isRecycled());
mContentBitmap = bitmap;
}
diff --git a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java
index 358b2dc36693..b26e9ab29447 100644
--- a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java
+++ b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java
@@ -16,6 +16,8 @@
package com.android.gallery3d.glrenderer;
+import com.android.gallery3d.common.Utils;
+
public class GLPaint {
private float mLineWidth = 1f;
private int mColor = 0;
@@ -29,9 +31,7 @@ public class GLPaint {
}
public void setLineWidth(float width) {
- if (width < 0) {
- throw new AssertionError();
- }
+ Utils.assertTrue(width >= 0);
mLineWidth = width;
}
diff --git a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java
index 2e878791e7fe..417102a386b6 100644
--- a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java
+++ b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java
@@ -20,6 +20,8 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.opengl.GLUtils;
+import com.android.gallery3d.common.Utils;
+
import java.util.HashMap;
import javax.microedition.khronos.opengles.GL11;
@@ -142,9 +144,7 @@ public abstract class UploadedTexture extends BasicTexture {
}
private void freeBitmap() {
- if (mBitmap == null) {
- throw new AssertionError();
- }
+ Utils.assertTrue(mBitmap != null);
onFreeBitmap(mBitmap);
mBitmap = null;
}
@@ -219,9 +219,7 @@ public abstract class UploadedTexture extends BasicTexture {
int texWidth = getTextureWidth();
int texHeight = getTextureHeight();
- if (bWidth > texWidth || bHeight > texHeight) {
- throw new AssertionError();
- }
+ Utils.assertTrue(bWidth <= texWidth && bHeight <= texHeight);
// Upload the bitmap to a new texture.
mId = canvas.getGLId().generateTexture();