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
}
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;
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");
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;
}
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;
}
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();