diff options
author | John Reck <jreck@google.com> | 2012-12-11 16:31:41 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-12-11 16:31:41 -0800 |
commit | 7d5aeb075548256a8b11ccf06b225ac7b79770dd (patch) | |
tree | 48b7e38949feeee9a90c5ef9c241dd3bea049607 | |
parent | 65161214283cfb3e93b19061f9f7108462da71e4 (diff) | |
parent | a4eae1abb4f2547dfbda84301ee764ce35464881 (diff) | |
download | android_packages_apps_Gallery2-7d5aeb075548256a8b11ccf06b225ac7b79770dd.tar.gz android_packages_apps_Gallery2-7d5aeb075548256a8b11ccf06b225ac7b79770dd.tar.bz2 android_packages_apps_Gallery2-7d5aeb075548256a8b11ccf06b225ac7b79770dd.zip |
Merge "GL packaging refactor" into gb-ub-photos-bryce
67 files changed, 184 insertions, 77 deletions
diff --git a/proguard.flags b/proguard.flags index 8d60103bc..b54b0c791 100644 --- a/proguard.flags +++ b/proguard.flags @@ -55,3 +55,7 @@ # Required for mp4parser -keep public class * implements com.coremedia.iso.boxes.Box +#-assumenosideeffects junit.framework.Assert { +#*; +#} + diff --git a/src/com/android/gallery3d/anim/AlphaAnimation.java b/src/com/android/gallery3d/anim/AlphaAnimation.java index cb17527b8..f9f4cbd2c 100644 --- a/src/com/android/gallery3d/anim/AlphaAnimation.java +++ b/src/com/android/gallery3d/anim/AlphaAnimation.java @@ -17,7 +17,7 @@ package com.android.gallery3d.anim; import com.android.gallery3d.common.Utils; -import com.android.gallery3d.ui.GLCanvas; +import com.android.gallery3d.glrenderer.GLCanvas; public class AlphaAnimation extends CanvasAnimation { private final float mStartAlpha; diff --git a/src/com/android/gallery3d/anim/CanvasAnimation.java b/src/com/android/gallery3d/anim/CanvasAnimation.java index 4c8bcc825..cdc66c6ba 100644 --- a/src/com/android/gallery3d/anim/CanvasAnimation.java +++ b/src/com/android/gallery3d/anim/CanvasAnimation.java @@ -16,7 +16,7 @@ package com.android.gallery3d.anim; -import com.android.gallery3d.ui.GLCanvas; +import com.android.gallery3d.glrenderer.GLCanvas; public abstract class CanvasAnimation extends Animation { diff --git a/src/com/android/gallery3d/anim/StateTransitionAnimation.java b/src/com/android/gallery3d/anim/StateTransitionAnimation.java index cf04d2cc8..bf8a54405 100644 --- a/src/com/android/gallery3d/anim/StateTransitionAnimation.java +++ b/src/com/android/gallery3d/anim/StateTransitionAnimation.java @@ -20,9 +20,9 @@ import android.view.animation.AccelerateInterpolator; import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; -import com.android.gallery3d.ui.GLCanvas; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.RawTexture; import com.android.gallery3d.ui.GLView; -import com.android.gallery3d.ui.RawTexture; import com.android.gallery3d.ui.TiledScreenNail; public class StateTransitionAnimation extends Animation { diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java index b2e39b1cb..fa5a9bd54 100644 --- a/src/com/android/gallery3d/app/ActivityState.java +++ b/src/com/android/gallery3d/app/ActivityState.java @@ -35,9 +35,9 @@ import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.MenuItem; import com.android.gallery3d.R; import com.android.gallery3d.anim.StateTransitionAnimation; +import com.android.gallery3d.glrenderer.RawTexture; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.PreparePageFadeoutTexture; -import com.android.gallery3d.ui.RawTexture; import com.android.gallery3d.util.GalleryUtils; abstract public class ActivityState { diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 60000903d..4de38c5dd 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -45,8 +45,6 @@ import com.android.gallery3d.ui.ActionModeHandler.ActionModeListener; import com.android.gallery3d.ui.AlbumSlotRenderer; import com.android.gallery3d.ui.DetailsHelper; import com.android.gallery3d.ui.DetailsHelper.CloseListener; -import com.android.gallery3d.ui.FadeTexture; -import com.android.gallery3d.ui.GLCanvas; import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.PhotoFallbackEffect; @@ -59,6 +57,8 @@ import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.MediaSetUtils; import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.CropExtras; +import com.android.gallery3d.glrenderer.FadeTexture; +import com.android.gallery3d.glrenderer.GLCanvas; public class AlbumPage extends ActivityState implements GalleryActionBar.ClusterRunner, diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index df68ffbaa..4bafb4737 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -41,6 +41,8 @@ import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.FadeTexture; +import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.picasasource.PicasaSource; import com.android.gallery3d.settings.GallerySettings; import com.android.gallery3d.ui.ActionModeHandler; @@ -48,8 +50,6 @@ import com.android.gallery3d.ui.ActionModeHandler.ActionModeListener; import com.android.gallery3d.ui.AlbumSetSlotRenderer; import com.android.gallery3d.ui.DetailsHelper; import com.android.gallery3d.ui.DetailsHelper.CloseListener; -import com.android.gallery3d.ui.FadeTexture; -import com.android.gallery3d.ui.GLCanvas; import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.SelectionManager; diff --git a/src/com/android/gallery3d/app/ManageCachePage.java b/src/com/android/gallery3d/app/ManageCachePage.java index 37a97626e..4f5c35819 100644 --- a/src/com/android/gallery3d/app/ManageCachePage.java +++ b/src/com/android/gallery3d/app/ManageCachePage.java @@ -35,8 +35,8 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.ui.CacheStorageUsageInfo; -import com.android.gallery3d.ui.GLCanvas; import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.ManageCacheDrawer; diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 8485b25eb..c38d25656 100644 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -30,12 +30,12 @@ import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.TiledTexture; import com.android.gallery3d.ui.PhotoView; import com.android.gallery3d.ui.ScreenNail; import com.android.gallery3d.ui.SynchronizedHandler; import com.android.gallery3d.ui.TileImageViewAdapter; import com.android.gallery3d.ui.TiledScreenNail; -import com.android.gallery3d.ui.TiledTexture; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.FutureListener; import com.android.gallery3d.util.MediaSetUtils; diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java index 80edb367e..54aae67ab 100644 --- a/src/com/android/gallery3d/app/SlideshowPage.java +++ b/src/com/android/gallery3d/app/SlideshowPage.java @@ -31,7 +31,7 @@ import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; -import com.android.gallery3d.ui.GLCanvas; +import com.android.gallery3d.glrenderer.GLCanvas; import com.android.gallery3d.ui.GLView; import com.android.gallery3d.ui.SlideshowView; import com.android.gallery3d.ui.SynchronizedHandler; diff --git a/src/com/android/gallery3d/ui/BasicTexture.java b/src/com/android/gallery3d/glrenderer/BasicTexture.java index 38686d59f..48227f6ef 100644 --- a/src/com/android/gallery3d/ui/BasicTexture.java +++ b/src/com/android/gallery3d/glrenderer/BasicTexture.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; + +import android.util.Log; import com.android.gallery3d.common.Utils; @@ -23,7 +25,7 @@ import java.util.WeakHashMap; // BasicTexture is a Texture corresponds to a real GL texture. // The state of a BasicTexture indicates whether its data is loaded to GL memory. // If a BasicTexture is loaded into GL memory, it has a GL texture id. -abstract class BasicTexture implements Texture { +public abstract class BasicTexture implements Texture { @SuppressWarnings("unused") private static final String TAG = "BasicTexture"; @@ -73,7 +75,7 @@ abstract class BasicTexture implements Texture { * Sets the content size of this texture. In OpenGL, the actual texture * size must be of power of 2, the size of the content may be smaller. */ - protected void setSize(int width, int height) { + public void setSize(int width, int height) { mWidth = width; mHeight = height; mTextureWidth = Utils.nextPowerOf2(width); diff --git a/src/com/android/gallery3d/ui/BitmapTexture.java b/src/com/android/gallery3d/glrenderer/BitmapTexture.java index 607544907..100b0b3b9 100644 --- a/src/com/android/gallery3d/ui/BitmapTexture.java +++ b/src/com/android/gallery3d/glrenderer/BitmapTexture.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; -import com.android.gallery3d.common.Utils; +import junit.framework.Assert; // BitmapTexture is a texture whose content is specified by a fixed Bitmap. // @@ -34,7 +34,7 @@ public class BitmapTexture extends UploadedTexture { public BitmapTexture(Bitmap bitmap, boolean hasBorder) { super(hasBorder); - Utils.assertTrue(bitmap != null && !bitmap.isRecycled()); + Assert.assertTrue(bitmap != null && !bitmap.isRecycled()); mContentBitmap = bitmap; } diff --git a/src/com/android/gallery3d/ui/CanvasTexture.java b/src/com/android/gallery3d/glrenderer/CanvasTexture.java index a2e9e48ad..bff9d4baa 100644 --- a/src/com/android/gallery3d/ui/CanvasTexture.java +++ b/src/com/android/gallery3d/glrenderer/CanvasTexture.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; diff --git a/src/com/android/gallery3d/ui/ColorTexture.java b/src/com/android/gallery3d/glrenderer/ColorTexture.java index 733c05653..904c78e1b 100644 --- a/src/com/android/gallery3d/ui/ColorTexture.java +++ b/src/com/android/gallery3d/glrenderer/ColorTexture.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import com.android.gallery3d.common.Utils; diff --git a/src/com/android/gallery3d/ui/ExtTexture.java b/src/com/android/gallery3d/glrenderer/ExtTexture.java index 180a89dce..b1fbd195c 100644 --- a/src/com/android/gallery3d/ui/ExtTexture.java +++ b/src/com/android/gallery3d/glrenderer/ExtTexture.java @@ -14,8 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; - +package com.android.gallery3d.glrenderer; // ExtTexture is a texture whose content comes from a external texture. // Before drawing, setSize() should be called. diff --git a/src/com/android/gallery3d/ui/FadeInTexture.java b/src/com/android/gallery3d/glrenderer/FadeInTexture.java index c6a9811f6..838d465f5 100644 --- a/src/com/android/gallery3d/ui/FadeInTexture.java +++ b/src/com/android/gallery3d/glrenderer/FadeInTexture.java @@ -14,7 +14,8 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; + // FadeInTexture is a texture which begins with a color, then gradually animates // into a given texture. diff --git a/src/com/android/gallery3d/ui/FadeOutTexture.java b/src/com/android/gallery3d/glrenderer/FadeOutTexture.java index 7050e535e..b05f3b631 100644 --- a/src/com/android/gallery3d/ui/FadeOutTexture.java +++ b/src/com/android/gallery3d/glrenderer/FadeOutTexture.java @@ -14,7 +14,8 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; + // FadeOutTexture is a texture which begins with a given texture, then gradually animates // into fading out totally. diff --git a/src/com/android/gallery3d/ui/FadeTexture.java b/src/com/android/gallery3d/glrenderer/FadeTexture.java index 5236d3639..002c90f5c 100644 --- a/src/com/android/gallery3d/ui/FadeTexture.java +++ b/src/com/android/gallery3d/glrenderer/FadeTexture.java @@ -14,9 +14,10 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import com.android.gallery3d.common.Utils; +import com.android.gallery3d.ui.AnimationTime; // FadeTexture is a texture which fades the given texture along the time. public abstract class FadeTexture implements Texture { diff --git a/src/com/android/gallery3d/ui/GLCanvas.java b/src/com/android/gallery3d/glrenderer/GLCanvas.java index 1dbee5dd9..848af75a9 100644 --- a/src/com/android/gallery3d/ui/GLCanvas.java +++ b/src/com/android/gallery3d/glrenderer/GLCanvas.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.RectF; @@ -50,7 +50,7 @@ public abstract class GLCanvas { } private static GLCanvas instantiateCanvas() { - return ApiHelper.HAS_GLES20_REQUIRED ? new GLES20Canvas() : new GLCanvasImpl(); + return ApiHelper.HAS_GLES20_REQUIRED ? new GLES20Canvas() : new GLES11Canvas(); } public static int getEGLContextClientVersion() { diff --git a/src/com/android/gallery3d/ui/GLCanvasImpl.java b/src/com/android/gallery3d/glrenderer/GLES11Canvas.java index 54c231c3b..c5434215a 100644 --- a/src/com/android/gallery3d/ui/GLCanvasImpl.java +++ b/src/com/android/gallery3d/glrenderer/GLES11Canvas.java @@ -14,17 +14,20 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.RectF; import android.opengl.GLU; import android.opengl.GLUtils; import android.opengl.Matrix; +import android.util.Log; import com.android.gallery3d.common.Utils; import com.android.gallery3d.util.IntArray; +import junit.framework.Assert; + import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -36,7 +39,7 @@ import javax.microedition.khronos.opengles.GL11; import javax.microedition.khronos.opengles.GL11Ext; import javax.microedition.khronos.opengles.GL11ExtensionPack; -public class GLCanvasImpl extends GLCanvas { +public class GLES11Canvas extends GLCanvas { @SuppressWarnings("unused") private static final String TAG = "GLCanvasImp"; @@ -91,12 +94,12 @@ public class GLCanvasImpl extends GLCanvas { int mCountTextureRect; int mCountTextureOES; - GLCanvasImpl() { + GLES11Canvas() { } @Override public void setSize(int width, int height) { - Utils.assertTrue(width >= 0 && height >= 0); + Assert.assertTrue(width >= 0 && height >= 0); if (mTargetTexture == null) { mScreenWidth = width; @@ -124,7 +127,7 @@ public class GLCanvasImpl extends GLCanvas { @Override public void setAlpha(float alpha) { - Utils.assertTrue(alpha >= 0 && alpha <= 1); + Assert.assertTrue(alpha >= 0 && alpha <= 1); mAlpha = alpha; } @@ -135,7 +138,7 @@ public class GLCanvasImpl extends GLCanvas { @Override public void multiplyAlpha(float alpha) { - Utils.assertTrue(alpha >= 0 && alpha <= 1); + Assert.assertTrue(alpha >= 0 && alpha <= 1); mAlpha *= alpha; } @@ -819,7 +822,7 @@ public class GLCanvasImpl extends GLCanvas { Blending mBlending; ConfigState mNextFree; - public void restore(GLCanvasImpl canvas) { + public void restore(GLES11Canvas canvas) { if (mAlpha >= 0) canvas.setAlpha(mAlpha); if (mMatrix[0] != Float.NEGATIVE_INFINITY) { System.arraycopy(mMatrix, 0, canvas.mMatrixValues, 0, 16); @@ -1000,7 +1003,7 @@ public class GLCanvasImpl extends GLCanvas { if (mBlending == blending) { return; } - Utils.assertTrue(blending == Blending.Additive || blending == Blending.Mix); + Assert.assertTrue(blending == Blending.Additive || blending == Blending.Mix); mBlending = blending; int srcFunc = GL11.GL_ONE; int dstFunc = (blending == Blending.Additive) ? GL11.GL_ONE : GL11.GL_ONE_MINUS_SRC_ALPHA; diff --git a/src/com/android/gallery3d/ui/GLES20Canvas.java b/src/com/android/gallery3d/glrenderer/GLES20Canvas.java index b720a773b..3c3eebf20 100644 --- a/src/com/android/gallery3d/ui/GLES20Canvas.java +++ b/src/com/android/gallery3d/glrenderer/GLES20Canvas.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.RectF; diff --git a/src/com/android/gallery3d/ui/GLId.java b/src/com/android/gallery3d/glrenderer/GLId.java index 04977c337..3cec558f6 100644 --- a/src/com/android/gallery3d/ui/GLId.java +++ b/src/com/android/gallery3d/glrenderer/GLId.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import javax.microedition.khronos.opengles.GL11; import javax.microedition.khronos.opengles.GL11ExtensionPack; diff --git a/src/com/android/gallery3d/ui/GLIdImpl.java b/src/com/android/gallery3d/glrenderer/GLIdImpl.java index 7a0232bf0..92aa58ee4 100644 --- a/src/com/android/gallery3d/ui/GLIdImpl.java +++ b/src/com/android/gallery3d/glrenderer/GLIdImpl.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import javax.microedition.khronos.opengles.GL11; import javax.microedition.khronos.opengles.GL11ExtensionPack; diff --git a/src/com/android/gallery3d/ui/GLPaint.java b/src/com/android/gallery3d/glrenderer/GLPaint.java index eb75cc51e..16b220690 100644 --- a/src/com/android/gallery3d/ui/GLPaint.java +++ b/src/com/android/gallery3d/glrenderer/GLPaint.java @@ -14,10 +14,9 @@ * limitations under the License. */ -package com.android.gallery3d.ui; - -import com.android.gallery3d.common.Utils; +package com.android.gallery3d.glrenderer; +import junit.framework.Assert; public class GLPaint { private float mLineWidth = 1f; @@ -32,7 +31,7 @@ public class GLPaint { } public void setLineWidth(float width) { - Utils.assertTrue(width >= 0); + Assert.assertTrue(width >= 0); mLineWidth = width; } diff --git a/src/com/android/gallery3d/ui/MultiLineTexture.java b/src/com/android/gallery3d/glrenderer/MultiLineTexture.java index b0c3c2bbf..82839f107 100644 --- a/src/com/android/gallery3d/ui/MultiLineTexture.java +++ b/src/com/android/gallery3d/glrenderer/MultiLineTexture.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -22,6 +22,7 @@ import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; + // MultiLineTexture is a texture shows the content of a specified String. // // To create a MultiLineTexture, use the newInstance() method and specify diff --git a/src/com/android/gallery3d/ui/NinePatchChunk.java b/src/com/android/gallery3d/glrenderer/NinePatchChunk.java index 61bf22c33..9dc326622 100644 --- a/src/com/android/gallery3d/ui/NinePatchChunk.java +++ b/src/com/android/gallery3d/glrenderer/NinePatchChunk.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Rect; diff --git a/src/com/android/gallery3d/ui/NinePatchTexture.java b/src/com/android/gallery3d/glrenderer/NinePatchTexture.java index f5c614554..d0ddc46c3 100644 --- a/src/com/android/gallery3d/ui/NinePatchTexture.java +++ b/src/com/android/gallery3d/glrenderer/NinePatchTexture.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.content.Context; import android.graphics.Bitmap; diff --git a/src/com/android/gallery3d/ui/RawTexture.java b/src/com/android/gallery3d/glrenderer/RawTexture.java index 53aef9edc..73f2c499a 100644 --- a/src/com/android/gallery3d/ui/RawTexture.java +++ b/src/com/android/gallery3d/glrenderer/RawTexture.java @@ -14,9 +14,9 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; -import android.opengl.GLES20; +import android.util.Log; import javax.microedition.khronos.opengles.GL11; diff --git a/src/com/android/gallery3d/ui/ResourceTexture.java b/src/com/android/gallery3d/glrenderer/ResourceTexture.java index 1fa9d7014..eb8e8a517 100644 --- a/src/com/android/gallery3d/ui/ResourceTexture.java +++ b/src/com/android/gallery3d/glrenderer/ResourceTexture.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; -import com.android.gallery3d.common.Utils; +import junit.framework.Assert; // ResourceTexture is a texture whose Bitmap is decoded from a resource. // By default ResourceTexture is not opaque. @@ -30,7 +30,8 @@ public class ResourceTexture extends UploadedTexture { protected final int mResId; public ResourceTexture(Context context, int resId) { - mContext = Utils.checkNotNull(context); + Assert.assertNotNull(context); + mContext = context; mResId = resId; setOpaque(false); } diff --git a/src/com/android/gallery3d/ui/StringTexture.java b/src/com/android/gallery3d/glrenderer/StringTexture.java index 97995c8a5..56ca29753 100644 --- a/src/com/android/gallery3d/ui/StringTexture.java +++ b/src/com/android/gallery3d/glrenderer/StringTexture.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -29,7 +29,7 @@ import android.util.FloatMath; // // To create a StringTexture, use the newInstance() method and specify // the String, the font size, and the color. -class StringTexture extends CanvasTexture { +public class StringTexture extends CanvasTexture { private final String mText; private final TextPaint mPaint; private final FontMetricsInt mMetrics; diff --git a/src/com/android/gallery3d/ui/Texture.java b/src/com/android/gallery3d/glrenderer/Texture.java index 2c426f994..3dcae4aec 100644 --- a/src/com/android/gallery3d/ui/Texture.java +++ b/src/com/android/gallery3d/glrenderer/Texture.java @@ -14,7 +14,8 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; + // Texture is a rectangular image which can be drawn on GLCanvas. // The isOpaque() function gives a hint about whether the texture is opaque, diff --git a/src/com/android/gallery3d/ui/TextureUploader.java b/src/com/android/gallery3d/glrenderer/TextureUploader.java index 9a8c47fc6..f17ab845c 100644 --- a/src/com/android/gallery3d/ui/TextureUploader.java +++ b/src/com/android/gallery3d/glrenderer/TextureUploader.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; +import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; import java.util.ArrayDeque; diff --git a/src/com/android/gallery3d/ui/TiledTexture.java b/src/com/android/gallery3d/glrenderer/TiledTexture.java index 02bde9f4f..6ca1de088 100644 --- a/src/com/android/gallery3d/ui/TiledTexture.java +++ b/src/com/android/gallery3d/glrenderer/TiledTexture.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; @@ -26,6 +26,7 @@ import android.graphics.PorterDuffXfermode; import android.graphics.RectF; import android.os.SystemClock; +import com.android.gallery3d.ui.GLRoot; import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; import java.util.ArrayDeque; diff --git a/src/com/android/gallery3d/ui/UploadedTexture.java b/src/com/android/gallery3d/glrenderer/UploadedTexture.java index 470ee6a98..ee55736bb 100644 --- a/src/com/android/gallery3d/ui/UploadedTexture.java +++ b/src/com/android/gallery3d/glrenderer/UploadedTexture.java @@ -14,13 +14,13 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.opengl.GLUtils; -import com.android.gallery3d.common.Utils; +import junit.framework.Assert; import java.util.HashMap; @@ -40,7 +40,7 @@ import javax.microedition.khronos.opengles.GL11; // // By default an UploadedTexture is opaque (so it can be drawn faster without // blending). The user or subclass can override it using setOpaque(). -abstract class UploadedTexture extends BasicTexture { +public abstract class UploadedTexture extends BasicTexture { // To prevent keeping allocation the borders, we store those used borders here. // Since the length will be power of two, it won't use too much memory. @@ -144,7 +144,7 @@ abstract class UploadedTexture extends BasicTexture { } private void freeBitmap() { - Utils.assertTrue(mBitmap != null); + Assert.assertTrue(mBitmap != null); onFreeBitmap(mBitmap); mBitmap = null; } @@ -219,7 +219,7 @@ abstract class UploadedTexture extends BasicTexture { int texWidth = getTextureWidth(); int texHeight = getTextureHeight(); - Utils.assertTrue(bWidth <= texWidth && bHeight <= texHeight); + Assert.assertTrue(bWidth <= texWidth && bHeight <= texHeight); // Upload the bitmap to a new texture. mId = GLCanvas.getGLId().generateTexture(); diff --git a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java index 10b710d2d..729439dc3 100644 --- a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java @@ -20,6 +20,11 @@ import android.content.Context; import android.graphics.Rect; import com.android.gallery3d.R; +import com.android.gallery3d.glrenderer.FadeOutTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.NinePatchTexture; +import com.android.gallery3d.glrenderer.ResourceTexture; +import com.android.gallery3d.glrenderer.Texture; public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer { diff --git a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java index 80dfc919f..d5a15b4ac 100644 --- a/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java +++ b/src/com/android/gallery3d/ui/AlbumSetSlidingWindow.java @@ -29,6 +29,10 @@ import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.BitmapTexture; +import com.android.gallery3d.glrenderer.Texture; +import com.android.gallery3d.glrenderer.TextureUploader; +import com.android.gallery3d.glrenderer.TiledTexture; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.FutureListener; import com.android.gallery3d.util.ThreadPool; diff --git a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java index 70d7c273a..5332ef89a 100644 --- a/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AlbumSetSlotRenderer.java @@ -21,6 +21,13 @@ import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.app.AlbumSetDataLoader; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.ColorTexture; +import com.android.gallery3d.glrenderer.FadeInTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.ResourceTexture; +import com.android.gallery3d.glrenderer.Texture; +import com.android.gallery3d.glrenderer.TiledTexture; +import com.android.gallery3d.glrenderer.UploadedTexture; import com.android.gallery3d.ui.AlbumSetSlidingWindow.AlbumSetEntry; public class AlbumSetSlotRenderer extends AbstractSlotRenderer { diff --git a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java index 678c43251..8cd2cf500 100644 --- a/src/com/android/gallery3d/ui/AlbumSlidingWindow.java +++ b/src/com/android/gallery3d/ui/AlbumSlidingWindow.java @@ -27,6 +27,8 @@ import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.Path; import com.android.gallery3d.data.MediaObject.PanoramaSupportCallback; +import com.android.gallery3d.glrenderer.Texture; +import com.android.gallery3d.glrenderer.TiledTexture; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.FutureListener; import com.android.gallery3d.util.JobLimiter; diff --git a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java index ce5b7ac24..dc6c89b0e 100644 --- a/src/com/android/gallery3d/ui/AlbumSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AlbumSlotRenderer.java @@ -20,6 +20,11 @@ import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.app.AlbumDataLoader; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.ColorTexture; +import com.android.gallery3d.glrenderer.FadeInTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.Texture; +import com.android.gallery3d.glrenderer.TiledTexture; public class AlbumSlotRenderer extends AbstractSlotRenderer { @SuppressWarnings("unused") diff --git a/src/com/android/gallery3d/ui/BitmapScreenNail.java b/src/com/android/gallery3d/ui/BitmapScreenNail.java index 741eefbe3..a3d403946 100644 --- a/src/com/android/gallery3d/ui/BitmapScreenNail.java +++ b/src/com/android/gallery3d/ui/BitmapScreenNail.java @@ -19,6 +19,9 @@ package com.android.gallery3d.ui; import android.graphics.Bitmap; import android.graphics.RectF; +import com.android.gallery3d.glrenderer.BitmapTexture; +import com.android.gallery3d.glrenderer.GLCanvas; + public class BitmapScreenNail implements ScreenNail { private final BitmapTexture mBitmapTexture; diff --git a/src/com/android/gallery3d/ui/EdgeEffect.java b/src/com/android/gallery3d/ui/EdgeEffect.java index ed369737b..87ff0c5d3 100644 --- a/src/com/android/gallery3d/ui/EdgeEffect.java +++ b/src/com/android/gallery3d/ui/EdgeEffect.java @@ -23,6 +23,8 @@ import android.view.animation.DecelerateInterpolator; import android.view.animation.Interpolator; import com.android.gallery3d.R; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.ResourceTexture; // This is copied from android.widget.EdgeEffect with some small modifications: // (1) Copy the images (overscroll_{edge|glow}.png) to local resources. diff --git a/src/com/android/gallery3d/ui/EdgeView.java b/src/com/android/gallery3d/ui/EdgeView.java index 4aff0494d..051de18fa 100644 --- a/src/com/android/gallery3d/ui/EdgeView.java +++ b/src/com/android/gallery3d/ui/EdgeView.java @@ -19,6 +19,8 @@ package com.android.gallery3d.ui; import android.content.Context; import android.opengl.Matrix; +import com.android.gallery3d.glrenderer.GLCanvas; + // EdgeView draws EdgeEffect (blue glow) at four sides of the view. public class EdgeView extends GLView { @SuppressWarnings("unused") diff --git a/src/com/android/gallery3d/ui/GLRoot.java b/src/com/android/gallery3d/ui/GLRoot.java index e406b6703..33a82eaf7 100644 --- a/src/com/android/gallery3d/ui/GLRoot.java +++ b/src/com/android/gallery3d/ui/GLRoot.java @@ -20,6 +20,7 @@ import android.content.Context; import android.graphics.Matrix; import com.android.gallery3d.anim.CanvasAnimation; +import com.android.gallery3d.glrenderer.GLCanvas; public interface GLRoot { diff --git a/src/com/android/gallery3d/ui/GLRootView.java b/src/com/android/gallery3d/ui/GLRootView.java index 6b76999b6..755e10733 100644 --- a/src/com/android/gallery3d/ui/GLRootView.java +++ b/src/com/android/gallery3d/ui/GLRootView.java @@ -33,6 +33,9 @@ import com.android.gallery3d.R; import com.android.gallery3d.anim.CanvasAnimation; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.Utils; +import com.android.gallery3d.glrenderer.BasicTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.UploadedTexture; import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.MotionEventHelper; import com.android.gallery3d.util.Profile; diff --git a/src/com/android/gallery3d/ui/GLView.java b/src/com/android/gallery3d/ui/GLView.java index 664012c5a..83de19fe4 100644 --- a/src/com/android/gallery3d/ui/GLView.java +++ b/src/com/android/gallery3d/ui/GLView.java @@ -23,6 +23,7 @@ import android.view.MotionEvent; import com.android.gallery3d.anim.CanvasAnimation; import com.android.gallery3d.anim.StateTransitionAnimation; import com.android.gallery3d.common.Utils; +import com.android.gallery3d.glrenderer.GLCanvas; import java.util.ArrayList; diff --git a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java index f57a312cb..4cf3edb34 100644 --- a/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java +++ b/src/com/android/gallery3d/ui/GalleryEGLConfigChooser.java @@ -18,6 +18,7 @@ package com.android.gallery3d.ui; import android.opengl.GLSurfaceView.EGLConfigChooser; import com.android.gallery3d.common.ApiHelper; +import com.android.gallery3d.glrenderer.GLCanvas; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; diff --git a/src/com/android/gallery3d/ui/Log.java b/src/com/android/gallery3d/ui/Log.java index 32adc98eb..5570763bb 100644 --- a/src/com/android/gallery3d/ui/Log.java +++ b/src/com/android/gallery3d/ui/Log.java @@ -16,6 +16,7 @@ package com.android.gallery3d.ui; +// TODO: Delete this public class Log { public static int v(String tag, String msg) { return android.util.Log.v(tag, msg); diff --git a/src/com/android/gallery3d/ui/ManageCacheDrawer.java b/src/com/android/gallery3d/ui/ManageCacheDrawer.java index e989af27d..d210bd1f1 100644 --- a/src/com/android/gallery3d/ui/ManageCacheDrawer.java +++ b/src/com/android/gallery3d/ui/ManageCacheDrawer.java @@ -23,6 +23,9 @@ import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.data.DataSourceType; import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.ResourceTexture; +import com.android.gallery3d.glrenderer.StringTexture; import com.android.gallery3d.ui.AlbumSetSlidingWindow.AlbumSetEntry; public class ManageCacheDrawer extends AlbumSetSlotRenderer { diff --git a/src/com/android/gallery3d/ui/PhotoFallbackEffect.java b/src/com/android/gallery3d/ui/PhotoFallbackEffect.java index 3ca09ab96..4603285a4 100644 --- a/src/com/android/gallery3d/ui/PhotoFallbackEffect.java +++ b/src/com/android/gallery3d/ui/PhotoFallbackEffect.java @@ -23,6 +23,8 @@ import android.view.animation.Interpolator; import com.android.gallery3d.anim.Animation; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.RawTexture; import com.android.gallery3d.ui.AlbumSlotRenderer.SlotFilter; import java.util.ArrayList; diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 58389e4ae..fd2fffafd 100644 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -35,6 +35,11 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.Path; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.RawTexture; +import com.android.gallery3d.glrenderer.ResourceTexture; +import com.android.gallery3d.glrenderer.StringTexture; +import com.android.gallery3d.glrenderer.Texture; import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.RangeArray; diff --git a/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java index 36e7f4b82..f52aa5ff2 100644 --- a/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java +++ b/src/com/android/gallery3d/ui/PreparePageFadeoutTexture.java @@ -3,6 +3,8 @@ package com.android.gallery3d.ui; import android.os.ConditionVariable; import com.android.gallery3d.app.AbstractGalleryActivity; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.RawTexture; import com.android.gallery3d.ui.GLRoot.OnGLIdleListener; public class PreparePageFadeoutTexture implements OnGLIdleListener { diff --git a/src/com/android/gallery3d/ui/ProgressSpinner.java b/src/com/android/gallery3d/ui/ProgressSpinner.java index 4f9381c76..1b31af278 100644 --- a/src/com/android/gallery3d/ui/ProgressSpinner.java +++ b/src/com/android/gallery3d/ui/ProgressSpinner.java @@ -19,6 +19,8 @@ package com.android.gallery3d.ui; import android.content.Context; import com.android.gallery3d.R; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.ResourceTexture; public class ProgressSpinner { private static float ROTATE_SPEED_OUTER = 1080f / 3500f; diff --git a/src/com/android/gallery3d/ui/ScreenNail.java b/src/com/android/gallery3d/ui/ScreenNail.java index 0a16ab850..965bf0b54 100644 --- a/src/com/android/gallery3d/ui/ScreenNail.java +++ b/src/com/android/gallery3d/ui/ScreenNail.java @@ -17,6 +17,8 @@ package com.android.gallery3d.ui; import android.graphics.RectF; +import com.android.gallery3d.glrenderer.GLCanvas; + public interface ScreenNail { public int getWidth(); public int getHeight(); diff --git a/src/com/android/gallery3d/ui/ScrollBarView.java b/src/com/android/gallery3d/ui/ScrollBarView.java index 82d4800cc..34fbcef7a 100644 --- a/src/com/android/gallery3d/ui/ScrollBarView.java +++ b/src/com/android/gallery3d/ui/ScrollBarView.java @@ -20,6 +20,9 @@ import android.content.Context; import android.graphics.Rect; import android.util.TypedValue; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.NinePatchTexture; + public class ScrollBarView extends GLView { @SuppressWarnings("unused") private static final String TAG = "ScrollBarView"; diff --git a/src/com/android/gallery3d/ui/SlideshowView.java b/src/com/android/gallery3d/ui/SlideshowView.java index 7734eb236..b215c6661 100644 --- a/src/com/android/gallery3d/ui/SlideshowView.java +++ b/src/com/android/gallery3d/ui/SlideshowView.java @@ -21,7 +21,9 @@ import android.graphics.PointF; import com.android.gallery3d.anim.CanvasAnimation; import com.android.gallery3d.anim.FloatAnimation; -import com.android.gallery3d.ui.GLCanvas.Blending; +import com.android.gallery3d.glrenderer.BitmapTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.GLCanvas.Blending; import java.util.Random; diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java index 15a583e5c..bd0ffdc15 100644 --- a/src/com/android/gallery3d/ui/SlotView.java +++ b/src/com/android/gallery3d/ui/SlotView.java @@ -25,6 +25,7 @@ import android.view.animation.DecelerateInterpolator; import com.android.gallery3d.anim.Animation; import com.android.gallery3d.app.AbstractGalleryActivity; import com.android.gallery3d.common.Utils; +import com.android.gallery3d.glrenderer.GLCanvas; public class SlotView extends GLView { @SuppressWarnings("unused") diff --git a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java index ceed71abe..ef8959c9d 100644 --- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java +++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java @@ -21,6 +21,8 @@ import android.graphics.RectF; import android.graphics.SurfaceTexture; import com.android.gallery3d.common.ApiHelper; +import com.android.gallery3d.glrenderer.ExtTexture; +import com.android.gallery3d.glrenderer.GLCanvas; @TargetApi(ApiHelper.VERSION_CODES.HONEYCOMB) public abstract class SurfaceTextureScreenNail implements ScreenNail, diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java index 8f26981fe..955105fff 100644 --- a/src/com/android/gallery3d/ui/TileImageView.java +++ b/src/com/android/gallery3d/ui/TileImageView.java @@ -28,6 +28,8 @@ import com.android.gallery3d.common.LongSparseArray; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.BitmapPool; import com.android.gallery3d.data.DecodeUtils; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.UploadedTexture; import com.android.gallery3d.util.Future; import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.ThreadPool; diff --git a/src/com/android/gallery3d/ui/TiledScreenNail.java b/src/com/android/gallery3d/ui/TiledScreenNail.java index 74665f584..ab24f5b6c 100644 --- a/src/com/android/gallery3d/ui/TiledScreenNail.java +++ b/src/com/android/gallery3d/ui/TiledScreenNail.java @@ -22,6 +22,8 @@ import android.graphics.RectF; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.BitmapPool; import com.android.gallery3d.data.MediaItem; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.TiledTexture; // This is a ScreenNail wraps a Bitmap. There are some extra functions: // diff --git a/src/com/android/gallery3d/ui/UndoBarView.java b/src/com/android/gallery3d/ui/UndoBarView.java index 8c9836deb..42f12ae72 100644 --- a/src/com/android/gallery3d/ui/UndoBarView.java +++ b/src/com/android/gallery3d/ui/UndoBarView.java @@ -21,6 +21,10 @@ import android.view.MotionEvent; import com.android.gallery3d.R; import com.android.gallery3d.common.Utils; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.NinePatchTexture; +import com.android.gallery3d.glrenderer.ResourceTexture; +import com.android.gallery3d.glrenderer.StringTexture; import com.android.gallery3d.util.GalleryUtils; public class UndoBarView extends GLView { diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasMock.java b/tests/src/com/android/gallery3d/glrenderer/GLCanvasMock.java index f8100ddf6..a57c18840 100644 --- a/tests/src/com/android/gallery3d/ui/GLCanvasMock.java +++ b/tests/src/com/android/gallery3d/glrenderer/GLCanvasMock.java @@ -14,7 +14,10 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; + +import com.android.gallery3d.glrenderer.BasicTexture; +import com.android.gallery3d.ui.GLCanvasStub; import javax.microedition.khronos.opengles.GL11; diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasTest.java b/tests/src/com/android/gallery3d/glrenderer/GLCanvasTest.java index ddbddad17..c42f97dce 100644 --- a/tests/src/com/android/gallery3d/ui/GLCanvasTest.java +++ b/tests/src/com/android/gallery3d/glrenderer/GLCanvasTest.java @@ -14,11 +14,15 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.test.suitebuilder.annotation.SmallTest; import android.util.Log; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.GLES11Canvas; +import com.android.gallery3d.glrenderer.GLPaint; + import junit.framework.TestCase; import java.util.Arrays; @@ -39,7 +43,7 @@ public class GLCanvasTest extends TestCase { @SmallTest public void testSetSize() { GL11 glStub = new GLStub(); - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(glStub); canvas.setSize(100, 200); canvas.setSize(1000, 100); @@ -58,7 +62,7 @@ public class GLCanvasTest extends TestCase { private static class ClearBufferTest extends GLMock { void run() { - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(this); assertEquals(0, mGLClearCalled); canvas.clearBuffer(); @@ -81,7 +85,7 @@ public class GLCanvasTest extends TestCase { 0x7F010101, 0xFEFEFDFC, 0x017F8081, 0x027F8081, 0x2ADE4C4D }; - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(this); canvas.setSize(400, 300); // Test one color to make sure blend function is set. @@ -110,7 +114,7 @@ public class GLCanvasTest extends TestCase { @SmallTest public void testSetGetMultiplyAlpha() { GL11 glStub = new GLStub(); - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(glStub); canvas.setAlpha(1f); @@ -150,7 +154,7 @@ public class GLCanvasTest extends TestCase { private static class AlphaTest extends GLMock { void run() { - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(this); canvas.setSize(400, 300); @@ -193,7 +197,7 @@ public class GLCanvasTest extends TestCase { } void run() { - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(this); canvas.setSize(400, 300); canvas.drawLine(2, 7, 1, 8, newColorPaint(0) /* color */); @@ -238,7 +242,7 @@ public class GLCanvasTest extends TestCase { } void run() { - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(this); canvas.setSize(400, 300); canvas.fillRect(2, 7, 1, 8, 0 /* color */); @@ -301,7 +305,7 @@ public class GLCanvasTest extends TestCase { } void run() { - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(this); canvas.setSize(40, 50); int color = 0; diff --git a/tests/src/com/android/gallery3d/ui/GLMock.java b/tests/src/com/android/gallery3d/glrenderer/GLMock.java index c1fe53c62..b242217a2 100644 --- a/tests/src/com/android/gallery3d/ui/GLMock.java +++ b/tests/src/com/android/gallery3d/glrenderer/GLMock.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; + +import com.android.gallery3d.ui.PointerInfo; import java.nio.Buffer; import java.util.HashMap; diff --git a/tests/src/com/android/gallery3d/ui/GLStub.java b/tests/src/com/android/gallery3d/glrenderer/GLStub.java index 2af73f905..4b66040dd 100644 --- a/tests/src/com/android/gallery3d/ui/GLStub.java +++ b/tests/src/com/android/gallery3d/glrenderer/GLStub.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import javax.microedition.khronos.opengles.GL; import javax.microedition.khronos.opengles.GL10; diff --git a/tests/src/com/android/gallery3d/ui/TextureTest.java b/tests/src/com/android/gallery3d/glrenderer/TextureTest.java index 361bf7b84..b13a333e0 100644 --- a/tests/src/com/android/gallery3d/ui/TextureTest.java +++ b/tests/src/com/android/gallery3d/glrenderer/TextureTest.java @@ -14,12 +14,19 @@ * limitations under the License. */ -package com.android.gallery3d.ui; +package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.test.suitebuilder.annotation.SmallTest; +import com.android.gallery3d.glrenderer.BasicTexture; +import com.android.gallery3d.glrenderer.BitmapTexture; +import com.android.gallery3d.glrenderer.ColorTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.GLES11Canvas; +import com.android.gallery3d.glrenderer.UploadedTexture; + import junit.framework.TestCase; import javax.microedition.khronos.opengles.GL11; @@ -62,7 +69,7 @@ public class TextureTest extends TestCase { @SmallTest public void testBasicTexture() { GL11 glStub = new GLStub(); - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(glStub); MyBasicTexture texture = new MyBasicTexture(canvas, 47); @@ -83,7 +90,7 @@ public class TextureTest extends TestCase { assertTrue(texture.isLoaded()); // For a different GL, it's not loaded. - GLCanvas canvas2 = new GLCanvasImpl(); + GLCanvas canvas2 = new GLES11Canvas(); canvas2.initialize(glStub); assertFalse(texture.isLoaded()); @@ -138,7 +145,7 @@ public class TextureTest extends TestCase { @SmallTest public void testUploadedTexture() { GL11 glStub = new GLStub(); - GLCanvas canvas = new GLCanvasImpl(); + GLCanvas canvas = new GLES11Canvas(); canvas.initialize(glStub); MyUploadedTexture texture = new MyUploadedTexture(); diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java index e9932239b..bf4776d28 100644 --- a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java +++ b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java @@ -19,6 +19,11 @@ package com.android.gallery3d.ui; import android.graphics.Bitmap; import android.graphics.RectF; +import com.android.gallery3d.glrenderer.BasicTexture; +import com.android.gallery3d.glrenderer.GLCanvas; +import com.android.gallery3d.glrenderer.GLPaint; +import com.android.gallery3d.glrenderer.RawTexture; + import java.nio.ByteBuffer; import java.nio.FloatBuffer; diff --git a/tests/src/com/android/gallery3d/ui/GLViewMock.java b/tests/src/com/android/gallery3d/ui/GLViewMock.java index 7b941daad..9b7488f05 100644 --- a/tests/src/com/android/gallery3d/ui/GLViewMock.java +++ b/tests/src/com/android/gallery3d/ui/GLViewMock.java @@ -16,6 +16,8 @@ package com.android.gallery3d.ui; +import com.android.gallery3d.glrenderer.GLCanvas; + class GLViewMock extends GLView { // onAttachToRoot int mOnAttachCalled; |