summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/Texture.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-03-03 21:12:40 +0800
committerOwen Lin <owenlin@google.com>2010-03-07 14:30:49 +0800
commit281be5337852cb4b5d24e0a0440c426cb96bbebd (patch)
treeb4218ea13055f7e9302e432554baf1e12695cef1 /src/com/android/camera/ui/Texture.java
parentbe69d39c4ab8fa93a52ed13a72ba2ad582adf583 (diff)
downloadLegacyCamera-281be5337852cb4b5d24e0a0440c426cb96bbebd.zip
LegacyCamera-281be5337852cb4b5d24e0a0440c426cb96bbebd.tar.gz
LegacyCamera-281be5337852cb4b5d24e0a0440c426cb96bbebd.tar.bz2
Add pixel density concept to the code. So, it draw about the same size on
mdpi and hdpi devices. Update the UI assets for mdpi Fix a issue that GLSurfaceView didn't call onPause and onResume in Camera. Refactor. Improve the drawing and animation. Also fix the RawTexture unsupported operation bugs and the NullPointerException in GLRootView. Change-Id: I7aeadcad72d64a665828a6bb4f0f73e685fde632
Diffstat (limited to 'src/com/android/camera/ui/Texture.java')
-rw-r--r--src/com/android/camera/ui/Texture.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/com/android/camera/ui/Texture.java b/src/com/android/camera/ui/Texture.java
index 6d5f8d8..aa116e7 100644
--- a/src/com/android/camera/ui/Texture.java
+++ b/src/com/android/camera/ui/Texture.java
@@ -19,10 +19,10 @@ public abstract class Texture {
public static final int STATE_LOADED = 1;
public static final int STATE_ERROR = -1;
- private GL11 mGL;
+ protected GL11 mGL;
- private int mId;
- private int mState;
+ protected int mId;
+ protected int mState;
protected int mWidth = UNSPECIFIED;
protected int mHeight = UNSPECIFIED;
@@ -119,31 +119,40 @@ public abstract class Texture {
}
public void draw(GLRootView root, int x, int y) {
- draw(root, x, y, getWidth(), getHeight());
+ root.drawTexture(this, x, y, mWidth, mHeight);
}
- public void draw(GLRootView root,
- int x, int y, int width, int height) {
- root.draw2D(x, y, width, height);
+ public void draw(GLRootView root, int x, int y, int w, int h, float alpha) {
+ root.drawTexture(this, x, y, w, h, alpha);
}
- protected boolean bind(GLRootView glRootView, GL11 gl) {
+ protected boolean bind(GLRootView root, GL11 gl) {
if (mState == Texture.STATE_UNLOADED || mGL != gl) {
mState = Texture.STATE_UNLOADED;
try {
uploadToGL(gl);
} catch (GLOutOfMemoryException e) {
- glRootView.handleLowMemory();
+ root.handleLowMemory();
return false;
}
} else {
gl.glBindTexture(GL11.GL_TEXTURE_2D, getId());
}
+ return true;
+ }
+ public void getTextureCoords(float coord[], int offset) {
float w = mTexCoordWidth;
float h = mTexCoordHeight;
- glRootView.setTexCoords(0, 0, w, 0, 0, h, w, h);
- return true;
+
+ coord[offset++] = 0;
+ coord[offset++] = 0;
+ coord[offset++] = w;
+ coord[offset++] = 0;
+ coord[offset++] = 0;
+ coord[offset++] = h;
+ coord[offset++] = w;
+ coord[offset] = h;
}
protected Bitmap generateGLCompatibleBitmap(int width, int height) {