Setting ratio value for changing ROI behavior 23/118523/1
authorHyunil <hyunil46.park@samsung.com>
Mon, 13 Mar 2017 02:19:01 +0000 (11:19 +0900)
committerHyunil Park <hyunil46.park@samsung.com>
Mon, 13 Mar 2017 03:53:02 +0000 (20:53 -0700)
Change-Id: Ibfe29a52b3dcec3a316f20a243fb38f44a459b2e
Signed-off-by: Hyunil <hyunil46.park@samsung.com>
packaging/libmm-evas-renderer.spec
src/include/mm_evas_renderer.h
src/mm_evas_renderer.c

index 97cb2b32876a2f1502f0731d56598c3d58285cc9..3d0a29c7079ce143b5f4e47d43613d1b57b0b4a9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-evas-renderer
 Summary:    Multimedia Framework Evas Renderer Library
-Version:    0.0.14
+Version:    0.0.15
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 83b1f26f7b0ab9aca1a1628c0e203763a5945e49..482378955587fadd94c6a775d0826ccb01935ded 100644 (file)
@@ -99,7 +99,7 @@ typedef struct {
        gboolean visible;
        rect_info eo_size;
        rect_info dst_roi;
-       gboolean use_ratio;
+       float ratio;
        guint rotate_angle;
        guint display_geometry_method;
        guint flip;
index 154cde1c3a081b4175fadc618cad357839c81b1d..fcb4920453a43efe1d294b89483b5dff8603bc99 100755 (executable)
@@ -307,11 +307,8 @@ static void _evas_pipe_cb(void *data, void *buffer, update_info info)
                evas_object_image_native_surface_set(evas_info->eo, NULL);
                evas_info->update_needed = FALSE;
        }
+       surf.data.tbm.ratio = evas_info->ratio;
 
-       if (evas_info->use_ratio) {
-               surf.data.tbm.ratio = (float) evas_info->w / evas_info->h;
-               LOGD("set ratio");
-       }
        evas_object_size_hint_align_set(evas_info->eo, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(evas_info->eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        if (evas_info->w > 0 && evas_info->h > 0)
@@ -561,11 +558,8 @@ static int _flush_packets(mm_evas_info *evas_info)
                        LOGE("no information about geometry (%d, %d)", result.w, result.h);
                        return MM_ERROR_EVASRENDER_INVALID_ARGUMENT;
                }
+               surf.data.tbm.ratio = evas_info->ratio;
 
-               if (evas_info->use_ratio) {
-                       surf.data.tbm.ratio = (float) evas_info->w / evas_info->h;
-                       LOGD("set ratio");
-               }
                evas_object_size_hint_align_set(evas_info->eo, EVAS_HINT_FILL, EVAS_HINT_FILL);
                evas_object_size_hint_weight_set(evas_info->eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
                if (evas_info->w > 0 && evas_info->h > 0)
@@ -872,13 +866,13 @@ 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->use_ratio = TRUE;
+               evas_info->ratio = (float) evas_info->w / evas_info->h;
                result->w = evas_info->eo_size.w;
                result->h = evas_info->eo_size.h;
                break;
        case DISP_GEO_METHOD_ORIGIN_SIZE:
                LOGD("origin size mode");
-               evas_info->use_ratio = FALSE;
+               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;
@@ -887,13 +881,13 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info
                break;
        case DISP_GEO_METHOD_FULL_SCREEN:
                LOGD("full screen mode");
-               evas_info->use_ratio = FALSE;
+               evas_info->ratio = 0;
                result->w = evas_info->eo_size.w;
                result->h = evas_info->eo_size.h;
                break;
        case DISP_GEO_METHOD_CROPPED_FULL_SCREEN:
                LOGD("cropped full screen mode");
-               evas_info->use_ratio = FALSE;
+               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;
                /* compare evas object's ratio with video's */
@@ -912,7 +906,7 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info
                /* 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)) {
                        LOGD("origin size mode");
-                       evas_info->use_ratio = FALSE;
+                       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;
@@ -920,14 +914,15 @@ static void _mm_evas_renderer_update_geometry(mm_evas_info *evas_info, rect_info
                        result->h = evas_info->h;
                } else {
                        LOGD("letter box mode");
-                       evas_info->use_ratio = TRUE;
+                       evas_info->ratio = (float) evas_info->w / evas_info->h;
                        result->w = evas_info->eo_size.w;
                        result->h = evas_info->eo_size.h;
                }
                break;
        case DISP_GEO_METHOD_CUSTOM_ROI:
                LOGD("custom roi mode");
-               evas_info->use_ratio = TRUE;
+               /* roi need to set -1 */
+               evas_info->ratio = -1;
                result->x = evas_info->dst_roi.x;
                result->y = evas_info->dst_roi.y;
                result->w = evas_info->dst_roi.w;
@@ -967,10 +962,8 @@ static int _mm_evas_renderer_apply_geometry(mm_evas_info *evas_info)
 
                _mm_evas_renderer_update_geometry(evas_info, &result);
 
-               if (evas_info->use_ratio) {
-                       surf->data.tbm.ratio = (float) evas_info->w / evas_info->h;
-                       LOGD("set ratio");
-               }
+               surf->data.tbm.ratio = evas_info->ratio;
+
                if (result.x || result.y)
                        LOGD("coordinate x, y (%d, %d) for locating video to center", result.x, result.y);
 
@@ -1547,7 +1540,6 @@ int mm_evas_renderer_set_flip(MMHandleType handle, int flip)
                evas_info->update_needed = TRUE;
                evas_info->flip = value;
        }
-
        ret = _mm_evas_pipe_write(evas_info, UPDATE_TBM_SURF);
 
        MMER_FLEAVE();