Merge "Avoid using JUnit code in production WallpaperCropper"
am: 9598c98db0
Change-Id: I15b0bbe22d18feca699ecaf4146dc9e2c279e5b5
This commit is contained in:
@@ -18,8 +18,6 @@ package com.android.gallery3d.glrenderer;
|
|||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
// BitmapTexture is a texture whose content is specified by a fixed Bitmap.
|
// 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
|
// The texture does not own the Bitmap. The user should make sure the Bitmap
|
||||||
@@ -34,7 +32,9 @@ public class BitmapTexture extends UploadedTexture {
|
|||||||
|
|
||||||
public BitmapTexture(Bitmap bitmap, boolean hasBorder) {
|
public BitmapTexture(Bitmap bitmap, boolean hasBorder) {
|
||||||
super(hasBorder);
|
super(hasBorder);
|
||||||
Assert.assertTrue(bitmap != null && !bitmap.isRecycled());
|
if (bitmap == null || bitmap.isRecycled()) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
mContentBitmap = bitmap;
|
mContentBitmap = bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.gallery3d.glrenderer;
|
package com.android.gallery3d.glrenderer;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
public class GLPaint {
|
public class GLPaint {
|
||||||
private float mLineWidth = 1f;
|
private float mLineWidth = 1f;
|
||||||
private int mColor = 0;
|
private int mColor = 0;
|
||||||
@@ -31,7 +29,9 @@ public class GLPaint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setLineWidth(float width) {
|
public void setLineWidth(float width) {
|
||||||
Assert.assertTrue(width >= 0);
|
if (width < 0) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
mLineWidth = width;
|
mLineWidth = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Bitmap.Config;
|
import android.graphics.Bitmap.Config;
|
||||||
import android.opengl.GLUtils;
|
import android.opengl.GLUtils;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import javax.microedition.khronos.opengles.GL11;
|
import javax.microedition.khronos.opengles.GL11;
|
||||||
@@ -144,7 +142,9 @@ public abstract class UploadedTexture extends BasicTexture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void freeBitmap() {
|
private void freeBitmap() {
|
||||||
Assert.assertTrue(mBitmap != null);
|
if (mBitmap == null) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
onFreeBitmap(mBitmap);
|
onFreeBitmap(mBitmap);
|
||||||
mBitmap = null;
|
mBitmap = null;
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,9 @@ public abstract class UploadedTexture extends BasicTexture {
|
|||||||
int texWidth = getTextureWidth();
|
int texWidth = getTextureWidth();
|
||||||
int texHeight = getTextureHeight();
|
int texHeight = getTextureHeight();
|
||||||
|
|
||||||
Assert.assertTrue(bWidth <= texWidth && bHeight <= texHeight);
|
if (bWidth > texWidth || bHeight > texHeight) {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
// Upload the bitmap to a new texture.
|
// Upload the bitmap to a new texture.
|
||||||
mId = canvas.getGLId().generateTexture();
|
mId = canvas.getGLId().generateTexture();
|
||||||
|
|||||||
Reference in New Issue
Block a user