From 85dedb803016feea39a78efc4bfc07b4f436cc6c Mon Sep 17 00:00:00 2001 From: Wei-Ta Chen Date: Fri, 9 Sep 2011 13:47:33 -0700 Subject: 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 --- jni/mosaic_renderer_jni.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'jni') diff --git a/jni/mosaic_renderer_jni.cpp b/jni/mosaic_renderer_jni.cpp index e741befd..b0d6b449 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); -- cgit v1.2.3