summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/PopupWindow.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/PopupWindow.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/PopupWindow.java')
-rw-r--r--src/com/android/camera/ui/PopupWindow.java33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/com/android/camera/ui/PopupWindow.java b/src/com/android/camera/ui/PopupWindow.java
index 616b3de..6ebf08c 100644
--- a/src/com/android/camera/ui/PopupWindow.java
+++ b/src/com/android/camera/ui/PopupWindow.java
@@ -17,14 +17,15 @@ public class PopupWindow extends GLView {
protected int mAnchorPosition;
private final RotatePane mRotatePane = new RotatePane();
+ private RawTexture mBackupTexture;
- protected NinePatchTexture mBackground;
+ protected FrameTexture mBackground;
public PopupWindow() {
super.addComponent(mRotatePane);
}
- public void setBackground(NinePatchTexture background) {
+ public void setBackground(FrameTexture background) {
if (background == mBackground) return;
mBackground = background;
if (background != null) {
@@ -89,7 +90,7 @@ public class PopupWindow extends GLView {
}
@Override
- protected void renderBackground(GLRootView rootView, GL11 gl) {
+ protected void renderBackground(GLRootView root, GL11 gl) {
int width = getWidth();
int height = getHeight();
int aWidth = mAnchor.getWidth();
@@ -101,30 +102,32 @@ public class PopupWindow extends GLView {
aYoffset = Math.min(aYoffset, height - p.bottom - aHeight);
if (mAnchor != null) {
- if (mAnchor.bind(rootView, gl)) {
- rootView.draw2D(aXoffset, aYoffset, aWidth, aHeight);
+ if (mAnchor.bind(root, gl)) {
+ mAnchor.draw(root, aXoffset, aYoffset);
}
}
- Texture backup = null;
+ if (mBackupTexture == null || mBackupTexture.getBoundGL() != gl) {
+ mBackupTexture = RawTexture.newInstance(gl);
+ }
+
+ RawTexture backup = mBackupTexture;
try {
- backup = rootView.copyTexture2D(
- aXoffset, aYoffset, aWidth, aHeight);
+ root.copyTexture2D(backup, aXoffset, aYoffset, aWidth, aHeight);
} catch (GLOutOfMemoryException e) {
e.printStackTrace();
}
if (mBackground != null) {
mBackground.setSize(width - aWidth + mAnchorOffset, height);
- if (mBackground.bind(rootView, gl)) {
- rootView.draw2D(
- 0, 0, mBackground.getWidth(), mBackground.getHeight());
+ if (mBackground.bind(root, gl)) {
+ mBackground.draw(root, 0, 0);
}
}
- if (backup.bind(rootView, gl)) {
+ if (backup.bind(root, gl)) {
gl.glBlendFunc(GL11.GL_ONE, GL11.GL_ZERO);
- rootView.draw2D(aXoffset, aYoffset, aWidth, aHeight, 1);
+ backup.draw(root, aXoffset, aYoffset, aWidth, aHeight, 1);
gl.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
}
@@ -148,8 +151,8 @@ public class PopupWindow extends GLView {
set.addAnimation(scale);
set.addAnimation(alpha);
- scale.setDuration(200);
- alpha.setDuration(200);
+ scale.setDuration(150);
+ alpha.setDuration(100);
scale.setInterpolator(new OvershootInterpolator());
startAnimation(set);
}