Fix incorrect parameters for cropping image 58/243658/2 accepted/tizen/unified/20200910.123850 submit/tizen/20200909.052036
authorjiyong.min <jiyong.min@samsung.com>
Wed, 9 Sep 2020 02:59:31 +0000 (11:59 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Wed, 9 Sep 2020 05:01:58 +0000 (14:01 +0900)
  - Problem:
    rotate_image with odd width/height image return error.

  - Cause:
    Cropping image for odd width/height image has incorrect parameters.

  - Solution:
    The start_x, start_y should be used for sx, sy of cropping image.

Change-Id: I8003dac4392823666bac98fa8a30771f367013e3

imgp/mm_util_imgp.c

index 1109c37..807bd11 100644 (file)
@@ -678,11 +678,11 @@ int mm_util_rotate_image(mm_util_image_h src, mm_util_rotate_type_e angle, mm_ut
                unsigned int start_x = 0;
                unsigned int start_y = 0;
                if (angle == MM_UTIL_ROTATE_90) {
-                       start_x = 0;
+                       start_x = _imgp_info_s->output_stride - _imgp_info_s->dst_width;
                        start_y = 0;
                } else if (angle == MM_UTIL_ROTATE_180) {
-                       start_x = _imgp_info_s->output_stride-_imgp_info_s->dst_width;
-                       start_y = 0;
+                       start_x = _imgp_info_s->output_stride - _imgp_info_s->dst_width;
+                       start_y = _imgp_info_s->output_elevation - _imgp_info_s->dst_height;
                } else if (angle == MM_UTIL_ROTATE_270) {
                        start_x = 0;
                        start_y = _imgp_info_s->output_elevation - _imgp_info_s->dst_height;
@@ -694,7 +694,7 @@ int mm_util_rotate_image(mm_util_image_h src, mm_util_rotate_type_e angle, mm_ut
                        goto ERROR;
                }
 
-               ret = mm_util_crop_image(_rotate_image, 0, 0, start_x, start_y, dst);
+               ret = mm_util_crop_image(_rotate_image, start_x, start_y, _imgp_info_s->dst_width, _imgp_info_s->dst_height, dst);
                mm_image_destroy_image(_rotate_image);
                if (ret != MM_UTIL_ERROR_NONE) {
                        mm_util_error("mm_util_crop_image failed");