diff options
-rw-r--r-- | jni/mosaic_renderer_jni.cpp | 12 | ||||
-rw-r--r-- | res/layout/pano_capture.xml | 2 | ||||
-rw-r--r-- | res/values-w1024dp/dimens.xml | 3 | ||||
-rw-r--r-- | res/values/dimens.xml | 1 |
4 files changed, 11 insertions, 7 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); diff --git a/res/layout/pano_capture.xml b/res/layout/pano_capture.xml index 7cf6c01..16145fd 100644 --- a/res/layout/pano_capture.xml +++ b/res/layout/pano_capture.xml @@ -36,7 +36,7 @@ <com.android.camera.panorama.MosaicRendererSurfaceView android:id="@+id/pano_renderer" android:layout_gravity="center" - android:layout_width="@dimen/pano_mosaic_surface_width" + android:layout_width="match_parent" android:layout_height="@dimen/pano_mosaic_surface_height" /> <ImageView style="@style/PanoViewHorizontalGrayBar"/> diff --git a/res/values-w1024dp/dimens.xml b/res/values-w1024dp/dimens.xml index 1ca3218..374c14b 100644 --- a/res/values-w1024dp/dimens.xml +++ b/res/values-w1024dp/dimens.xml @@ -28,8 +28,7 @@ <dimen name="share_item_height">90dp</dimen> <dimen name="pano_control_layout_min_width">260dp</dimen> <dimen name="pano_control_start_button_size">180dp</dimen> - <dimen name="pano_mosaic_surface_width">960dp</dimen> - <dimen name="pano_mosaic_surface_height">360dp</dimen> + <dimen name="pano_mosaic_surface_height">480dp</dimen> <dimen name="pano_review_button_width">180dp</dimen> <dimen name="pano_review_button_height">180dp</dimen> <dimen name="pano_capture_too_fast_text_height">160dp</dimen> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index b1e3db4..b9ca511 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -24,7 +24,6 @@ <dimen name="share_item_height">60dp</dimen> <dimen name="pano_control_layout_min_width">76dp</dimen> <dimen name="pano_control_start_button_size">70dp</dimen> - <dimen name="pano_mosaic_surface_width">640dp</dimen> <dimen name="pano_mosaic_surface_height">240dp</dimen> <dimen name="pano_review_button_width">70dp</dimen> <dimen name="pano_review_button_height">70dp</dimen> |