From 5abaa594de3cf4e4ab1d92766f6756ac784ddb57 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 28 Feb 2022 11:23:52 +0800 Subject: [PATCH] fix captured picture viewed on cameara app issue Signed-off-by: unknown --- .../cameraApp/src/main/cpp/camera_ability_slice.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cameraApp/cameraApp/src/main/cpp/camera_ability_slice.cpp b/cameraApp/cameraApp/src/main/cpp/camera_ability_slice.cpp index 89d556f..22e3351 100755 --- a/cameraApp/cameraApp/src/main/cpp/camera_ability_slice.cpp +++ b/cameraApp/cameraApp/src/main/cpp/camera_ability_slice.cpp @@ -111,13 +111,22 @@ private: scaleWidth = static_cast(SCREEN_WIDTH) / imageWidth; if (imageHeight > SCREEN_HEIGHT) scaleHeight = static_cast(SCREEN_HEIGHT) / imageHeight; +#ifdef KEEP_PICTURE_RECT float scale = (scaleWidth < scaleHeight) ? scaleWidth : scaleHeight; transMap.Scale(Vector2(scale, scale), Vector2(0, 0)); +#else + transMap.Scale(Vector2(scaleWidth, scaleHeight), Vector2(0, 0)); +#endif backgroundView_->SetTransformMap(transMap); backgroundView_->SetTransformAlgorithm(TransformAlgorithm::NEAREST_NEIGHBOR); +#ifdef KEEP_PICTURE_RECT imageWidth = imageWidth * scale; imageHeight = imageHeight * scale; +#else + imageWidth = imageWidth * scaleWidth; + imageHeight = imageHeight * scaleHeight; +#endif } int16_t imagePosX = (SCREEN_WIDTH - imageWidth) / 2; /* 2 half */ int16_t imagePosY = (SCREEN_HEIGHT - imageHeight) / 2; /* 2 half */ -- Gitee