summaryrefslogtreecommitdiffstats
path: root/jni
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2011-09-09 13:47:33 -0700
committerWei-Ta Chen <weita@google.com>2011-09-09 15:22:41 -0700
commit85dedb803016feea39a78efc4bfc07b4f436cc6c (patch)
treea87d3f20c4d1fc98562ca143c7f3d7599ee0c332 /jni
parentdbba504f8003afdb9cbe1c25239611c1111c5efe (diff)
downloadLegacyCamera-85dedb803016feea39a78efc4bfc07b4f436cc6c.zip
LegacyCamera-85dedb803016feea39a78efc4bfc07b4f436cc6c.tar.gz
LegacyCamera-85dedb803016feea39a78efc4bfc07b4f436cc6c.tar.bz2
Make the preview mosaic leave a margin.
To follow the UI spec, the preview mosaic shouldn't grow to the boundary of control bar when we pan the device. Also, the height of the preview track on Xoom is increased to better match the spec. Change-Id: Ic1184b00b3b9efd6232c51fa666ba7a0862c1a98
Diffstat (limited to 'jni')
-rw-r--r--jni/mosaic_renderer_jni.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/jni/mosaic_renderer_jni.cpp b/jni/mosaic_renderer_jni.cpp
index e741bef..b0d6b44 100644
--- a/jni/mosaic_renderer_jni.cpp
+++ b/jni/mosaic_renderer_jni.cpp
@@ -445,11 +445,17 @@ JNIEXPORT jint JNICALL Java_com_android_camera_panorama_MosaicRenderer_init(
JNIEXPORT void JNICALL Java_com_android_camera_panorama_MosaicRenderer_reset(
JNIEnv * env, jobject obj, jint width, jint height)
{
- gUILayoutScalingX = (PREVIEW_FBO_WIDTH_SCALE / PREVIEW_FBO_HEIGHT_SCALE) *
- (gPreviewImageWidth[LR] / gPreviewImageHeight[LR]) / (width / height) *
- PREVIEW_FBO_HEIGHT_SCALE;
+ // Scale the current frame's height to the height of view and
+ // maintain the aspect ratio of the current frame on the screen.
gUILayoutScalingY = PREVIEW_FBO_HEIGHT_SCALE;
+ // Note that OpenGL scales a texture to view's width and height automatically.
+ // The "width / height" inverts the scaling, so as to maintain the aspect ratio
+ // of the current frame.
+ gUILayoutScalingX = ((float) (PREVIEW_FBO_WIDTH_SCALE * gPreviewImageWidth[LR])
+ / (PREVIEW_FBO_HEIGHT_SCALE * gPreviewImageHeight[LR]) * PREVIEW_FBO_HEIGHT_SCALE)
+ / ((float) width / height);
+
gBuffer[0].Init(gPreviewFBOWidth, gPreviewFBOHeight, GL_RGBA);
gBuffer[1].Init(gPreviewFBOWidth, gPreviewFBOHeight, GL_RGBA);