diff options
author | Hyunil <hyunil46.park@samsung.com> | 2017-03-14 11:00:18 +0900 |
---|---|---|
committer | Hyunil Park <hyunil46.park@samsung.com> | 2017-03-14 19:12:27 -0700 |
commit | caf2cbcc146e425b674d1d0df932ed60dddc3366 (patch) | |
tree | 91bbd2fe2298d6beb6e3da8e10e35e57e59dba01 | |
parent | 2a3d3c6ba5c89be1f46c1b186e6cce5e37224fd2 (diff) | |
download | libmm-evas-renderer-tizen_3.0.tar.gz libmm-evas-renderer-tizen_3.0.tar.bz2 libmm-evas-renderer-tizen_3.0.zip |
fix bug about letterbox mode ratiosubmit/tizen_3.0/20170317.034449accepted/tizen/3.0/wearable/20170320.080140accepted/tizen/3.0/tv/20170320.080037accepted/tizen/3.0/mobile/20170320.075352accepted/tizen/3.0/ivi/20170320.080555accepted/tizen/3.0/common/20170320.130544tizen_3.0accepted/tizen_3.0_wearableaccepted/tizen_3.0_tvaccepted/tizen_3.0_mobileaccepted/tizen_3.0_iviaccepted/tizen_3.0_common
Change-Id: I5d31e9ca9e0603cbafdb304e19d4d867102e379d
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
-rw-r--r-- | packaging/libmm-evas-renderer.spec | 2 | ||||
-rw-r--r-- | src/include/mm_evas_renderer.h | 2 | ||||
-rwxr-xr-x | src/mm_evas_renderer.c | 42 |
3 files changed, 25 insertions, 21 deletions
diff --git a/packaging/libmm-evas-renderer.spec b/packaging/libmm-evas-renderer.spec index 3d0a29c..988db1a 100644 --- a/packaging/libmm-evas-renderer.spec +++ b/packaging/libmm-evas-renderer.spec @@ -1,6 +1,6 @@ Name: libmm-evas-renderer Summary: Multimedia Framework Evas Renderer Library -Version: 0.0.15 +Version: 0.0.16 Release: 0 Group: Multimedia/Libraries License: Apache-2.0 diff --git a/src/include/mm_evas_renderer.h b/src/include/mm_evas_renderer.h index 4823789..dce7322 100644 --- a/src/include/mm_evas_renderer.h +++ b/src/include/mm_evas_renderer.h @@ -99,7 +99,7 @@ typedef struct { gboolean visible; rect_info eo_size; rect_info dst_roi; - float ratio; + float ratio; /* need to set original ratio, not swap */ guint rotate_angle; guint display_geometry_method; guint flip; diff --git a/src/mm_evas_renderer.c b/src/mm_evas_renderer.c index fcb4920..9cd4722 100755 --- a/src/mm_evas_renderer.c +++ b/src/mm_evas_renderer.c @@ -848,17 +848,24 @@ static int _mm_evas_renderer_reset(mm_evas_info *evas_info) static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info *result) { MMER_FENTER(); + + gint video_width = 0; + gint video_height = 0; + MMEVAS_RETURN_IF_FAIL(evas_info); MMEVAS_RETURN_IF_FAIL(evas_info->eo); //need to check evas object MMEVAS_RETURN_IF_FAIL(result); result->x = 0; result->y = 0; + video_width = evas_info->w; + video_height = evas_info->h; + /* Only SWAP is needed for result coordination calculation */ if (evas_info->rotate_angle == DEGREE_90 || evas_info->rotate_angle == DEGREE_270) { - SWAP(evas_info->w, evas_info->h); + SWAP(video_width, video_height); #ifdef _INTERNAL_DEBUG_ - LOGD("swapped width %d, height %d", evas_info->w, evas_info->h); + LOGD("swapped width %d, height %d", video_width, video_height); #endif } @@ -866,7 +873,7 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info case DISP_GEO_METHOD_LETTER_BOX: /* set black padding for letter box mode */ LOGD("letter box mode"); - evas_info->ratio = (float) evas_info->w / evas_info->h; + evas_info->ratio = (float) evas_info->w / evas_info->h; /* need to set original video ratio */ result->w = evas_info->eo_size.w; result->h = evas_info->eo_size.h; break; @@ -874,10 +881,10 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info LOGD("origin size mode"); evas_info->ratio = 0; /* set coordinate for each case */ - result->x = (evas_info->eo_size.w - evas_info->w) / 2; - result->y = (evas_info->eo_size.h - evas_info->h) / 2; - result->w = evas_info->w; - result->h = evas_info->h; + result->x = (evas_info->eo_size.w - video_width) / 2; + result->y = (evas_info->eo_size.h - video_height) / 2; + result->w = video_width; + result->h = video_height; break; case DISP_GEO_METHOD_FULL_SCREEN: LOGD("full screen mode"); @@ -889,14 +896,14 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info LOGD("cropped full screen mode"); evas_info->ratio = 0; float eo_ratio = (float)evas_info->eo_size.w / evas_info->eo_size.h; - float video_ratio = (float)evas_info->w / evas_info->h; + float video_ratio = (float)video_width / video_height; /* compare evas object's ratio with video's */ if (eo_ratio > video_ratio) { result->w = evas_info->eo_size.w; - result->h = evas_info->eo_size.w * evas_info->h / evas_info->w; + result->h = evas_info->eo_size.w * video_height / video_width; result->y = -(result->h - evas_info->eo_size.h) / 2; } else { - result->w = evas_info->eo_size.h * evas_info->w / evas_info->h; + result->w = evas_info->eo_size.h * video_width / video_height; result->h = evas_info->eo_size.h; result->x = -(result->w - evas_info->eo_size.w) / 2; } @@ -904,17 +911,17 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info case DISP_GEO_METHOD_ORIGIN_SIZE_OR_LETTER_BOX: LOGD("origin size or letter box mode"); /* if video size is smaller than evas object's, it will be set to origin size mode */ - if ((evas_info->eo_size.w > evas_info->w) && (evas_info->eo_size.h > evas_info->h)) { + if ((evas_info->eo_size.w > video_width) && (evas_info->eo_size.h > video_height)) { LOGD("origin size mode"); evas_info->ratio = 0; /* set coordinate for each case */ - result->x = (evas_info->eo_size.w - evas_info->w) / 2; - result->y = (evas_info->eo_size.h - evas_info->h) / 2; - result->w = evas_info->w; - result->h = evas_info->h; + result->x = (evas_info->eo_size.w - video_width) / 2; + result->y = (evas_info->eo_size.h - video_height) / 2; + result->w = video_width; + result->h = video_height; } else { LOGD("letter box mode"); - evas_info->ratio = (float) evas_info->w / evas_info->h; + evas_info->ratio = (float) evas_info->w / evas_info->h; /* need to set original video ratio */ result->w = evas_info->eo_size.w; result->h = evas_info->eo_size.h; } @@ -935,9 +942,6 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info break; } - if (evas_info->rotate_angle == DEGREE_90 || evas_info->rotate_angle == DEGREE_270) - SWAP(evas_info->w, evas_info->h); - LOGD("geometry result [%d, %d, %d, %d]", result->x, result->y, result->w, result->h); MMER_FLEAVE(); |