From 0db6ec1a2d602a48437a48ae47fbca01299fdcea Mon Sep 17 00:00:00 2001 From: George Mount Date: Thu, 1 Nov 2012 10:32:41 -0700 Subject: Separate GL calls into GLCanvas in preparation for adding GLES2. Change-Id: I2756c14294a36af7905766ee650fa08fb95e9477 --- .../src/com/android/gallery3d/ui/GLCanvasStub.java | 70 +++++++++++++++++++++- .../src/com/android/gallery3d/ui/GLCanvasTest.java | 7 --- 2 files changed, 69 insertions(+), 8 deletions(-) (limited to 'tests/src') diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java index 5a08b8599..afa34acf3 100644 --- a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java +++ b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java @@ -16,52 +16,76 @@ package com.android.gallery3d.ui; +import android.graphics.Bitmap; import android.graphics.RectF; +import java.nio.Buffer; + import javax.microedition.khronos.opengles.GL11; -public class GLCanvasStub implements GLCanvas { +public class GLCanvasStub extends GLCanvas { + @Override public void setSize(int width, int height) {} + @Override public void clearBuffer() {} + @Override public void clearBuffer(float[] argb) {} public void setCurrentAnimationTimeMillis(long time) {} public long currentAnimationTimeMillis() { throw new UnsupportedOperationException(); } + @Override public void setAlpha(float alpha) {} + @Override public float getAlpha() { throw new UnsupportedOperationException(); } + @Override public void multiplyAlpha(float alpha) {} + @Override public void translate(float x, float y, float z) {} + @Override public void translate(float x, float y) {} + @Override public void scale(float sx, float sy, float sz) {} + @Override public void rotate(float angle, float x, float y, float z) {} public boolean clipRect(int left, int top, int right, int bottom) { throw new UnsupportedOperationException(); } + @Override public void save() { throw new UnsupportedOperationException(); } + @Override public void save(int saveFlags) { throw new UnsupportedOperationException(); } public void setBlendEnabled(boolean enabled) {} + @Override public void restore() {} + @Override public void drawLine(float x1, float y1, float x2, float y2, GLPaint paint) {} + @Override public void drawRect(float x1, float y1, float x2, float y2, GLPaint paint) {} + @Override public void fillRect(float x, float y, float width, float height, int color) {} + @Override public void drawTexture( BasicTexture texture, int x, int y, int width, int height) {} + @Override public void drawMesh(BasicTexture tex, int x, int y, int xyBuffer, int uvBuffer, int indexBuffer, int indexCount) {} public void drawTexture(BasicTexture texture, int x, int y, int width, int height, float alpha) {} + @Override public void drawTexture(BasicTexture texture, RectF source, RectF target) {} + @Override public void drawTexture(BasicTexture texture, float[] mTextureTransform, int x, int y, int w, int h) {} public void drawMixed(BasicTexture from, BasicTexture to, float ratio, int x, int y, int w, int h) {} + @Override public void drawMixed(BasicTexture from, int to, float ratio, int x, int y, int w, int h) {} public void drawMixed(BasicTexture from, BasicTexture to, @@ -72,17 +96,61 @@ public class GLCanvasStub implements GLCanvas { public GL11 getGLInstance() { throw new UnsupportedOperationException(); } + @Override public boolean unloadTexture(BasicTexture texture) { throw new UnsupportedOperationException(); } + @Override public void deleteBuffer(int bufferId) { throw new UnsupportedOperationException(); } + @Override public void deleteRecycledResources() {} + @Override public void multiplyMatrix(float[] mMatrix, int offset) {} + @Override public void dumpStatisticsAndClear() {} + @Override public void beginRenderTarget(RawTexture texture) {} + @Override public void endRenderTarget() {} + @Override public void drawMixed(BasicTexture from, int toColor, float ratio, RectF src, RectF target) {} + + @Override + public void setTextureParameters(BasicTexture texture) { + } + @Override + public void initializeTextureSize(BasicTexture texture, int format, int type) { + } + @Override + public void initializeTexture(BasicTexture texture, Bitmap bitmap) { + } + @Override + public void texSubImage2D(BasicTexture texture, int xOffset, int yOffset, Bitmap bitmap, + int format, int type) { + } + @Override + public int[] uploadBuffers(Buffer[] buffers) { + return null; + } + @Override + public void setBlending(Blending blending) { + } + @Override + public void enableStencil() { + } + @Override + public void disableStencil() { + } + @Override + public void clearStencilBuffer() { + } + @Override + public void updateStencil(boolean update) { + } + @Override + public void drawOnlyOutsideStencil(boolean onlyOutside) { + } } diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasTest.java b/tests/src/com/android/gallery3d/ui/GLCanvasTest.java index 72ccbfb96..8df7a3dfb 100644 --- a/tests/src/com/android/gallery3d/ui/GLCanvasTest.java +++ b/tests/src/com/android/gallery3d/ui/GLCanvasTest.java @@ -359,13 +359,6 @@ public class GLCanvasTest extends TestCase { } } - @SmallTest - public void testGetGLInstance() { - GL11 glStub = new GLStub(); - GLCanvas canvas = new GLCanvasImpl(glStub); - assertSame(glStub, canvas.getGLInstance()); - } - private static void assertPremultipliedBlending(GLMock mock) { assertTrue(mock.mGLBlendFuncCalled > 0); assertTrue(mock.mGLBlendEnabled); -- cgit v1.2.3