diff options
-rwxr-xr-x[-rw-r--r--] | jni/feature_mos/src/mosaic_renderer/Renderer.cpp | 10 | ||||
-rwxr-xr-x[-rw-r--r--] | jni/feature_mos/src/mosaic_renderer/Renderer.h | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp | 2 | ||||
-rw-r--r-- | jni/mosaic_renderer_jni.cpp | 83 | ||||
-rw-r--r-- | res/layout-land/pano_preview_progress.xml | 135 | ||||
-rw-r--r-- | res/layout-port/pano_preview_progress.xml | 136 | ||||
-rw-r--r-- | res/layout/pano_module_capture.xml | 104 | ||||
-rw-r--r-- | src/com/android/camera/MosaicPreviewRenderer.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/MosaicRenderer.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaUI.java | 8 |
12 files changed, 326 insertions, 179 deletions
diff --git a/jni/feature_mos/src/mosaic_renderer/Renderer.cpp b/jni/feature_mos/src/mosaic_renderer/Renderer.cpp index 8d0632402..b9938eb6b 100644..100755 --- a/jni/feature_mos/src/mosaic_renderer/Renderer.cpp +++ b/jni/feature_mos/src/mosaic_renderer/Renderer.cpp @@ -111,8 +111,8 @@ GLuint Renderer::createProgram(const char* pVertexSource, const char* pFragmentS } // Set this renderer to use the default frame-buffer (screen) and -// set the viewport size to be the given x, y, width and height (pixels). -bool Renderer::SetupGraphics(int x, int y, int width, int height) +// set the viewport size to be the given width and height (pixels). +bool Renderer::SetupGraphics(int width, int height) { bool succeeded = false; do { @@ -131,10 +131,8 @@ bool Renderer::SetupGraphics(int x, int y, int width, int height) mFrameBuffer = NULL; mSurfaceWidth = width; mSurfaceHeight = height; - mSurfaceXOffset = x; - mSurfaceYOffset = y; - glViewport(mSurfaceXOffset, mSurfaceYOffset, mSurfaceWidth, mSurfaceHeight); + glViewport(0, 0, mSurfaceWidth, mSurfaceHeight); if (!checkGlError("glViewport")) break; succeeded = true; } while (false); @@ -178,7 +176,7 @@ bool Renderer::Clear(float r, float g, float b, float a) bool succeeded = false; do { bool rt = (mFrameBuffer == NULL)? - SetupGraphics(mSurfaceXOffset, mSurfaceYOffset, mSurfaceWidth, mSurfaceHeight) : + SetupGraphics(mSurfaceWidth, mSurfaceHeight) : SetupGraphics(mFrameBuffer); if(!rt) diff --git a/jni/feature_mos/src/mosaic_renderer/Renderer.h b/jni/feature_mos/src/mosaic_renderer/Renderer.h index ffb9cbd25..a43e8028e 100644..100755 --- a/jni/feature_mos/src/mosaic_renderer/Renderer.h +++ b/jni/feature_mos/src/mosaic_renderer/Renderer.h @@ -18,7 +18,7 @@ class Renderer { virtual bool InitializeGLProgram() = 0; bool SetupGraphics(FrameBuffer* buffer); - bool SetupGraphics(int x, int y, int width, int height); + bool SetupGraphics(int width, int height); bool Clear(float r, float g, float b, float a); @@ -59,8 +59,6 @@ class Renderer { int mSurfaceWidth; // Width of target surface. int mSurfaceHeight; // Height of target surface. - int mSurfaceXOffset; // X Offset target surface. - int mSurfaceYOffset; // Y Offset of target surface. FrameBuffer *mFrameBuffer; }; diff --git a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp index 4725463f2..88aac3626 100644..100755 --- a/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp +++ b/jni/feature_mos/src/mosaic_renderer/SurfaceTextureRenderer.cpp @@ -119,7 +119,7 @@ bool SurfaceTextureRenderer::DrawTexture(GLfloat *affine) bool succeeded = false; do { bool rt = (mFrameBuffer == NULL)? - SetupGraphics(mSurfaceXOffset, mSurfaceYOffset, mSurfaceWidth, mSurfaceHeight) : + SetupGraphics(mSurfaceWidth, mSurfaceHeight) : SetupGraphics(mFrameBuffer); if(!rt) diff --git a/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp b/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp index c030ce25e..af6779a3f 100644..100755 --- a/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp +++ b/jni/feature_mos/src/mosaic_renderer/WarpRenderer.cpp @@ -110,7 +110,7 @@ bool WarpRenderer::DrawTexture(GLfloat *affine) bool succeeded = false; do { bool rt = (mFrameBuffer == NULL)? - SetupGraphics(mSurfaceXOffset, mSurfaceYOffset, mSurfaceWidth, mSurfaceHeight) : + SetupGraphics(mSurfaceWidth, mSurfaceHeight) : SetupGraphics(mFrameBuffer); if(!rt) diff --git a/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp b/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp index b30e6f7b6..f7dcf6f61 100644..100755 --- a/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp +++ b/jni/feature_mos/src/mosaic_renderer/YVURenderer.cpp @@ -79,7 +79,7 @@ bool YVURenderer::DrawTexture() bool succeeded = false; do { bool rt = (mFrameBuffer == NULL)? - SetupGraphics(mSurfaceXOffset, mSurfaceYOffset, mSurfaceWidth, mSurfaceHeight) : + SetupGraphics(mSurfaceWidth, mSurfaceHeight) : SetupGraphics(mFrameBuffer); if(!rt) diff --git a/jni/mosaic_renderer_jni.cpp b/jni/mosaic_renderer_jni.cpp index f35599375..36f8064c7 100644 --- a/jni/mosaic_renderer_jni.cpp +++ b/jni/mosaic_renderer_jni.cpp @@ -27,7 +27,6 @@ #include "mosaic_renderer/SurfaceTextureRenderer.h" #include "mosaic_renderer/YVURenderer.h" - #include "mosaic/Log.h" #define LOG_TAG "MosaicRenderer" @@ -37,7 +36,6 @@ GLuint gSurfaceTextureID[1]; bool gWarpImage = true; -bool gPreviewBackgroundImage = true; // Low-Res input image frame in YUVA format for preview rendering and processing // and high-res YUVA input image for processing. @@ -89,9 +87,6 @@ FrameBuffer gBuffer[2]; // Shader to warp and render the preview FBO to the screen WarpRenderer gPreview; -// Shader to render the fullscreen preview background FBO to the screen -WarpRenderer gPreviewBackground; - // Index of the gBuffer FBO gWarper1 is going to write into int gCurrentFBOIndex = 0; @@ -145,12 +140,6 @@ double g_dAffinetransPan[16]; GLfloat g_dTranslationToFBOCenterGL[16]; double g_dTranslationToFBOCenter[16]; - - - - - - // GL 4x4 Identity transformation GLfloat g_dAffinetransIdentGL[] = { 1., 0., 0., 0., @@ -326,8 +315,8 @@ void UpdateWarpTransformation(float *trs) // Alignment is done based on low-res data. // To render the preview mosaic, the translation of the high-res mosaic is estimated to // H2L_FACTOR x low-res-based tranlation. - //gThisH1t[2] *= H2L_FACTOR; - //gThisH1t[5] *= H2L_FACTOR; + gThisH1t[2] *= H2L_FACTOR; + gThisH1t[5] *= H2L_FACTOR; db_Identity3x3(T); T[2] = -gCenterOffsetX; @@ -379,7 +368,6 @@ void UpdateWarpTransformation(float *trs) db_Identity3x3(H); H[2] = gPanOffset; - // Hp = inv(Km) * H * Km db_Identity3x3(Htemp1); db_Multiply3x3_3x3(Htemp1, H, gKm); @@ -409,13 +397,13 @@ void AllocateTextureMemory(int widthHR, int heightHR, int widthLR, int heightLR) gPreviewImageHeight[HR], 4); sem_post(&gPreviewImage_semaphore); - gPreviewFBOWidth = PREVIEW_FBO_WIDTH_SCALE * gPreviewImageWidth[LR]; - gPreviewFBOHeight = PREVIEW_FBO_HEIGHT_SCALE * gPreviewImageHeight[LR]; + gPreviewFBOWidth = PREVIEW_FBO_WIDTH_SCALE * gPreviewImageWidth[HR]; + gPreviewFBOHeight = PREVIEW_FBO_HEIGHT_SCALE * gPreviewImageHeight[HR]; // The origin is such that the current frame will sit with its center // at the center of the previewFBO - gCenterOffsetX = (gPreviewFBOWidth / 2 - gPreviewImageWidth[LR] / 2); - gCenterOffsetY = (gPreviewFBOHeight / 2 - gPreviewImageHeight[LR] / 2); + gCenterOffsetX = (gPreviewFBOWidth / 2 - gPreviewImageWidth[HR] / 2); + gCenterOffsetY = (gPreviewFBOHeight / 2 - gPreviewImageHeight[HR] / 2); gPanOffset = 0.0f; @@ -424,8 +412,8 @@ void AllocateTextureMemory(int widthHR, int heightHR, int widthLR, int heightLR) gPanViewfinder = true; - int w = gPreviewImageWidth[LR]; - int h = gPreviewImageHeight[LR]; + int w = gPreviewImageWidth[HR]; + int h = gPreviewImageHeight[HR]; int wm = gPreviewFBOWidth; int hm = gPreviewFBOHeight; @@ -505,8 +493,6 @@ extern "C" JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_setWarping( JNIEnv * env, jobject obj, jboolean flag); - JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_setPreviewBackground( - JNIEnv * env, jobject obj, jboolean flag); }; @@ -538,7 +524,6 @@ JNIEXPORT jint JNICALL Java_com_android_camera_MosaicRenderer_init( gBufferInput[HR].InitializeGLContext(); gBufferInputYVU[LR].InitializeGLContext(); gBufferInputYVU[HR].InitializeGLContext(); - gPreviewBackground.InitializeGLProgram(); glBindFramebuffer(GL_FRAMEBUFFER, 0); @@ -563,16 +548,13 @@ void calculateUILayoutScaling(int width, int height, bool isLandscape) { // // Scale the preview FBO'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) gPreviewFBOWidth / gPreviewFBOHeight) / ((float) width / height) * PREVIEW_FBO_HEIGHT_SCALE; - } else { // ___ // __________ | | ______ @@ -591,10 +573,8 @@ void calculateUILayoutScaling(int width, int height, bool isLandscape) { // Note that OpenGL scales a texture to view's width and height automatically. // The "height / width" inverts the scaling, so as to maintain the aspect ratio // of the current frame. - gUILayoutScalingX = ((float) gPreviewFBOHeight / gPreviewFBOWidth) / ((float) width / height) * PREVIEW_FBO_WIDTH_SCALE; - } } @@ -602,7 +582,7 @@ JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_reset( JNIEnv * env, jobject obj, jint width, jint height, jboolean isLandscapeOrientation) { gIsLandscapeOrientation = isLandscapeOrientation; - calculateUILayoutScaling(gPreviewFBOWidth, gPreviewFBOHeight, gIsLandscapeOrientation); + calculateUILayoutScaling(width, height, gIsLandscapeOrientation); gBuffer[0].Init(gPreviewFBOWidth, gPreviewFBOHeight, GL_RGBA); gBuffer[1].Init(gPreviewFBOWidth, gPreviewFBOHeight, GL_RGBA); @@ -656,23 +636,20 @@ JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_reset( gWarper1.SetInputTextureName(gBuffer[1 - gCurrentFBOIndex].GetTextureName()); gWarper1.SetInputTextureType(GL_TEXTURE_2D); - // gBufferInput[LR] --> gWarper2 --> gBuffer[gCurrentFBOIndex] + // gBufferInput[HR] --> gWarper2 --> gBuffer[gCurrentFBOIndex] gWarper2.SetupGraphics(&gBuffer[gCurrentFBOIndex]); // gWarp2's destination buffer is the same to gWarp1's. No need to clear it // again. - gWarper2.SetViewportMatrix(gPreviewImageWidth[LR], - gPreviewImageHeight[LR], gBuffer[gCurrentFBOIndex].GetWidth(), + gWarper2.SetViewportMatrix(gPreviewImageWidth[HR], + gPreviewImageHeight[HR], gBuffer[gCurrentFBOIndex].GetWidth(), gBuffer[gCurrentFBOIndex].GetHeight()); gWarper2.SetScalingMatrix(1.0f, 1.0f); - gWarper2.SetInputTextureName(gBufferInput[LR].GetTextureName()); + gWarper2.SetInputTextureName(gBufferInput[HR].GetTextureName()); gWarper2.SetInputTextureType(GL_TEXTURE_2D); - int xoffset = (width/2 - gPreviewFBOWidth/2); - int yoffset = (height/2 - gPreviewFBOHeight/2); - // gBuffer[gCurrentFBOIndex] --> gPreview --> Screen - gPreview.SetupGraphics(xoffset,yoffset,gPreviewFBOWidth, gPreviewFBOHeight); + gPreview.SetupGraphics(width, height); gPreview.SetViewportMatrix(1, 1, 1, 1); // Scale the previewFBO so that the viewfinder window fills the layout height @@ -680,13 +657,6 @@ JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_reset( gPreview.SetScalingMatrix(gUILayoutScalingX, -1.0f * gUILayoutScalingY); gPreview.SetInputTextureName(gBuffer[gCurrentFBOIndex].GetTextureName()); gPreview.SetInputTextureType(GL_TEXTURE_2D); - - // gBufferInput[HR] --> gPreviewBackground --> screen - gPreviewBackground.SetupGraphics(0,0,width, height); - gPreviewBackground.SetViewportMatrix(1,1,1,1); - gPreviewBackground.SetScalingMatrix(1.0f, -1.0f); - gPreviewBackground.SetInputTextureName(gBufferInput[HR].GetTextureName()); - gPreviewBackground.SetInputTextureType(GL_TEXTURE_2D); } JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_preprocess( @@ -761,18 +731,15 @@ JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_step( { if(!gWarpImage) // ViewFinder { - if (gIsLandscapeOrientation) { - gPreviewBackground.DrawTexture(g_dAffinetransIdentGL); - } else { - gPreviewBackground.DrawTexture(g_dAffinetransRotation90GL); - } - } - else if(gPreviewBackgroundImage) - { + gWarper2.SetupGraphics(&gBuffer[gCurrentFBOIndex]); + gPreview.SetInputTextureName(gBuffer[gCurrentFBOIndex].GetTextureName()); + + gWarper2.DrawTexture(g_dTranslationToFBOCenterGL); + if (gIsLandscapeOrientation) { - gPreviewBackground.DrawTexture(g_dAffinetransIdentGL); + gPreview.DrawTexture(g_dAffinetransIdentGL); } else { - gPreviewBackground.DrawTexture(g_dAffinetransRotation90GL); + gPreview.DrawTexture(g_dAffinetransRotation90GL); } } else @@ -807,7 +774,7 @@ JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_setWarping( gWarper1.Clear(0.0, 0.0, 0.0, 1.0); // Clear the screen to black. gPreview.Clear(0.0, 0.0, 0.0, 1.0); - gPreviewBackground.Clear(0.0, 0.0, 0.0, 1.0); + gLastTx = 0.0f; gPanOffset = 0.0f; gPanViewfinder = true; @@ -835,9 +802,3 @@ JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_updateMatrix( g_dTranslationToFBOCenterGL[i] = g_dTranslationToFBOCenter[i]; } } - -JNIEXPORT void JNICALL Java_com_android_camera_MosaicRenderer_setPreviewBackground( - JNIEnv * env, jobject obj, jboolean flag) -{ - gPreviewBackgroundImage = (bool)flag; -} diff --git a/res/layout-land/pano_preview_progress.xml b/res/layout-land/pano_preview_progress.xml index 772b8529e..c6c131741 100644 --- a/res/layout-land/pano_preview_progress.xml +++ b/res/layout-land/pano_preview_progress.xml @@ -14,37 +14,106 @@ limitations under the License. --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/panorama_preview_progress" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_gravity="bottom|center_horizontal"> - - <com.android.camera.PanoProgressBar - android:id="@+id/pano_pan_progress_bar" - android:visibility="gone" - android:src="@drawable/ic_pan_progression" - android:layout_centerInParent="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - - <ImageView - android:id="@+id/pano_pan_left_indicator" - android:src="@drawable/pano_direction_left_indicator" - android:visibility="gone" - android:layout_marginRight="5dp" - android:layout_toLeftOf="@id/pano_pan_progress_bar" - android:layout_centerVertical="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - - <ImageView - android:id="@+id/pano_pan_right_indicator" - android:src="@drawable/pano_direction_right_indicator" - android:visibility="gone" - android:layout_marginLeft="5dp" - android:layout_toRightOf="@id/pano_pan_progress_bar" - android:layout_centerVertical="true" +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/panorama_capture_layout" + android:layout_height="match_parent" + android:layout_width="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <!-- The top bar with capture indication --> + <FrameLayout + style="@style/PanoViewHorizontalBar" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <TextView + android:id="@+id/pano_capture_indicator" + android:text="@string/pano_capture_indication" + android:textAppearance="?android:textAppearanceMedium" + android:layout_gravity="center" + android:visibility="gone" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </FrameLayout> + + <FrameLayout + android:layout_gravity="center" + android:id="@+id/pano_preview_layout" + android:layout_weight="@integer/SRI_pano_layout_weight" + android:layout_width="match_parent" + android:layout_height="0dp"> + + <TextureView + android:id="@+id/pano_preview_textureview" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <View + android:id="@+id/pano_preview_area_border" + android:visibility="gone" + android:background="@drawable/ic_pan_border_fast" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </FrameLayout> + + <!-- The bottom bar with progress bar and direction indicators --> + <FrameLayout + style="@style/PanoViewHorizontalBar" + android:paddingTop="20dp" + android:gravity="top" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <com.android.camera.PanoProgressBar + android:id="@+id/pano_pan_progress_bar" + android:visibility="gone" + android:src="@drawable/ic_pan_progression" + android:layout_centerInParent="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <ImageView + android:id="@+id/pano_pan_left_indicator" + android:src="@drawable/pano_direction_left_indicator" + android:visibility="gone" + android:layout_marginRight="5dp" + android:layout_toLeftOf="@id/pano_pan_progress_bar" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <ImageView + android:id="@+id/pano_pan_right_indicator" + android:src="@drawable/pano_direction_right_indicator" + android:visibility="gone" + android:layout_marginLeft="5dp" + android:layout_toRightOf="@id/pano_pan_progress_bar" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </RelativeLayout> + </FrameLayout> + + + </LinearLayout> + + <!-- The hint for "Too fast" text view --> + <TextView + android:id="@+id/pano_capture_too_fast_textview" + android:text="@string/pano_too_fast_prompt" + android:textAppearance="?android:textAppearanceMedium" android:layout_width="wrap_content" - android:layout_height="wrap_content" /> -</RelativeLayout> + android:layout_height="wrap_content" + android:layout_gravity="center" + android:visibility="gone" /> +</FrameLayout> diff --git a/res/layout-port/pano_preview_progress.xml b/res/layout-port/pano_preview_progress.xml index 426ef0ba7..c6c131741 100644 --- a/res/layout-port/pano_preview_progress.xml +++ b/res/layout-port/pano_preview_progress.xml @@ -14,38 +14,106 @@ limitations under the License. --> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/panorama_preview_progress" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:layout_gravity="bottom|center_horizontal" - android:layout_marginBottom="100dp"> - - <com.android.camera.PanoProgressBar - android:id="@+id/pano_pan_progress_bar" - android:visibility="gone" - android:src="@drawable/ic_pan_progression" - android:layout_centerInParent="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - - <ImageView - android:id="@+id/pano_pan_left_indicator" - android:src="@drawable/pano_direction_left_indicator" - android:visibility="gone" - android:layout_marginRight="5dp" - android:layout_toLeftOf="@id/pano_pan_progress_bar" - android:layout_centerVertical="true" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - - <ImageView - android:id="@+id/pano_pan_right_indicator" - android:src="@drawable/pano_direction_right_indicator" - android:visibility="gone" - android:layout_marginLeft="5dp" - android:layout_toRightOf="@id/pano_pan_progress_bar" - android:layout_centerVertical="true" +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/panorama_capture_layout" + android:layout_height="match_parent" + android:layout_width="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <!-- The top bar with capture indication --> + <FrameLayout + style="@style/PanoViewHorizontalBar" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <TextView + android:id="@+id/pano_capture_indicator" + android:text="@string/pano_capture_indication" + android:textAppearance="?android:textAppearanceMedium" + android:layout_gravity="center" + android:visibility="gone" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </FrameLayout> + + <FrameLayout + android:layout_gravity="center" + android:id="@+id/pano_preview_layout" + android:layout_weight="@integer/SRI_pano_layout_weight" + android:layout_width="match_parent" + android:layout_height="0dp"> + + <TextureView + android:id="@+id/pano_preview_textureview" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <View + android:id="@+id/pano_preview_area_border" + android:visibility="gone" + android:background="@drawable/ic_pan_border_fast" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </FrameLayout> + + <!-- The bottom bar with progress bar and direction indicators --> + <FrameLayout + style="@style/PanoViewHorizontalBar" + android:paddingTop="20dp" + android:gravity="top" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <com.android.camera.PanoProgressBar + android:id="@+id/pano_pan_progress_bar" + android:visibility="gone" + android:src="@drawable/ic_pan_progression" + android:layout_centerInParent="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <ImageView + android:id="@+id/pano_pan_left_indicator" + android:src="@drawable/pano_direction_left_indicator" + android:visibility="gone" + android:layout_marginRight="5dp" + android:layout_toLeftOf="@id/pano_pan_progress_bar" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <ImageView + android:id="@+id/pano_pan_right_indicator" + android:src="@drawable/pano_direction_right_indicator" + android:visibility="gone" + android:layout_marginLeft="5dp" + android:layout_toRightOf="@id/pano_pan_progress_bar" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </RelativeLayout> + </FrameLayout> + + + </LinearLayout> + + <!-- The hint for "Too fast" text view --> + <TextView + android:id="@+id/pano_capture_too_fast_textview" + android:text="@string/pano_too_fast_prompt" + android:textAppearance="?android:textAppearanceMedium" android:layout_width="wrap_content" - android:layout_height="wrap_content" /> -</RelativeLayout> + android:layout_height="wrap_content" + android:layout_gravity="center" + android:visibility="gone" /> +</FrameLayout> diff --git a/res/layout/pano_module_capture.xml b/res/layout/pano_module_capture.xml index d842ea12c..c6c131741 100644 --- a/res/layout/pano_module_capture.xml +++ b/res/layout/pano_module_capture.xml @@ -19,36 +19,94 @@ android:layout_height="match_parent" android:layout_width="match_parent"> - <FrameLayout - android:layout_gravity="center" - android:id="@+id/pano_preview_layout" - android:layout_weight="@integer/SRI_pano_layout_weight" + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical"> - <TextureView - android:id="@+id/pano_preview_textureview" + <!-- The top bar with capture indication --> + <FrameLayout + style="@style/PanoViewHorizontalBar" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="0dp" + android:layout_weight="1"> + + <TextView + android:id="@+id/pano_capture_indicator" + android:text="@string/pano_capture_indication" + android:textAppearance="?android:textAppearanceMedium" + android:layout_gravity="center" + android:visibility="gone" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </FrameLayout> - <View - android:id="@+id/pano_preview_area_border" - android:visibility="gone" - android:background="@drawable/ic_pan_border_fast" + <FrameLayout + android:layout_gravity="center" + android:id="@+id/pano_preview_layout" + android:layout_weight="@integer/SRI_pano_layout_weight" android:layout_width="match_parent" - android:layout_height="match_parent" /> - </FrameLayout> + android:layout_height="0dp"> - <include layout="@layout/pano_preview_progress" /> + <TextureView + android:id="@+id/pano_preview_textureview" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + + <View + android:id="@+id/pano_preview_area_border" + android:visibility="gone" + android:background="@drawable/ic_pan_border_fast" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </FrameLayout> + + <!-- The bottom bar with progress bar and direction indicators --> + <FrameLayout + style="@style/PanoViewHorizontalBar" + android:paddingTop="20dp" + android:gravity="top" + android:layout_width="match_parent" + android:layout_height="0dp" + android:layout_weight="1"> + + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <com.android.camera.PanoProgressBar + android:id="@+id/pano_pan_progress_bar" + android:visibility="gone" + android:src="@drawable/ic_pan_progression" + android:layout_centerInParent="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <ImageView + android:id="@+id/pano_pan_left_indicator" + android:src="@drawable/pano_direction_left_indicator" + android:visibility="gone" + android:layout_marginRight="5dp" + android:layout_toLeftOf="@id/pano_pan_progress_bar" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + + <ImageView + android:id="@+id/pano_pan_right_indicator" + android:src="@drawable/pano_direction_right_indicator" + android:visibility="gone" + android:layout_marginLeft="5dp" + android:layout_toRightOf="@id/pano_pan_progress_bar" + android:layout_centerVertical="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> + </RelativeLayout> + </FrameLayout> + + + </LinearLayout> - <TextView - android:id="@+id/pano_capture_indicator" - android:text="@string/pano_capture_indication" - android:textAppearance="?android:textAppearanceMedium" - android:layout_gravity="top|center_horizontal" - android:visibility="gone" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> <!-- The hint for "Too fast" text view --> <TextView android:id="@+id/pano_capture_too_fast_textview" diff --git a/src/com/android/camera/MosaicPreviewRenderer.java b/src/com/android/camera/MosaicPreviewRenderer.java index 77c260eb5..42da4d9e7 100644 --- a/src/com/android/camera/MosaicPreviewRenderer.java +++ b/src/com/android/camera/MosaicPreviewRenderer.java @@ -83,13 +83,10 @@ public class MosaicPreviewRenderer { mInputSurfaceTexture.updateTexImage(); mInputSurfaceTexture.getTransformMatrix(mTransformMatrix); - // Call setPreviewBackground to render high-res RGB textures to full screen. - MosaicRenderer.setPreviewBackground(true); - MosaicRenderer.preprocess(mTransformMatrix); - MosaicRenderer.step(); - MosaicRenderer.setPreviewBackground(false); - MosaicRenderer.setWarping(true); + // Call preprocess to render it to low-res and high-res RGB textures. + MosaicRenderer.preprocess(mTransformMatrix); + // Now, transfer the textures from GPU to CPU memory for processing MosaicRenderer.transferGPUtoCPU(); MosaicRenderer.updateMatrix(); MosaicRenderer.step(); diff --git a/src/com/android/camera/MosaicRenderer.java b/src/com/android/camera/MosaicRenderer.java index daf94abe6..92d9cb7b6 100644 --- a/src/com/android/camera/MosaicRenderer.java +++ b/src/com/android/camera/MosaicRenderer.java @@ -86,14 +86,4 @@ public class MosaicRenderer * @param flag boolean flag to set the warping to true or false. */ public static native void setWarping(boolean flag); - /** - * This function allows toggling between drawing the background full - * screen preview image data to screen and drawing the warped smaller - * preview on top of it. To render the full screen background preview, - * we set the falsg to true and to render the warped image on top of this - * we set the flag to false and flag in setWarping to true. - * - * @param flag boolean flag to set the warping to true or false. - */ - public static native void setPreviewBackground(boolean flag); } diff --git a/src/com/android/camera/WideAnglePanoramaUI.java b/src/com/android/camera/WideAnglePanoramaUI.java index 3b1c4b17f..14cacfb9b 100644 --- a/src/com/android/camera/WideAnglePanoramaUI.java +++ b/src/com/android/camera/WideAnglePanoramaUI.java @@ -441,6 +441,14 @@ public class WideAnglePanoramaUI implements private void setViews(Resources appRes) { int weight = appRes.getInteger(R.integer.SRI_pano_layout_weight); + LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mPreviewLayout.getLayoutParams(); + lp.weight = weight; + mPreviewLayout.setLayoutParams(lp); + + lp = (LinearLayout.LayoutParams) mReview.getLayoutParams(); + lp.weight = weight; + mPreviewLayout.setLayoutParams(lp); + mSavingProgressBar = (PanoProgressBar) mRootView.findViewById(R.id.pano_saving_progress_bar); mSavingProgressBar.setIndicatorWidth(0); mSavingProgressBar.setMaxProgress(100); |