return EINA_TRUE;
}
-static void
-_e_video_hwc_geometry_cal_to_input(int output_w, int output_h, int input_w, int input_h,
- uint32_t trasnform, int ox, int oy, int *ix, int *iy)
-{
- float ratio_w, ratio_h;
-
- switch(trasnform)
- {
- case WL_OUTPUT_TRANSFORM_NORMAL:
- default:
- *ix = ox, *iy = oy;
- break;
- case WL_OUTPUT_TRANSFORM_270:
- *ix = oy, *iy = output_w - ox;
- break;
- case WL_OUTPUT_TRANSFORM_180:
- *ix = output_w - ox, *iy = output_h - oy;
- break;
- case WL_OUTPUT_TRANSFORM_90:
- *ix = output_h - oy, *iy = ox;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED:
- *ix = output_w - ox, *iy = oy;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED_270:
- *ix = oy, *iy = ox;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED_180:
- *ix = ox, *iy = output_h - oy;
- break;
- case WL_OUTPUT_TRANSFORM_FLIPPED_90:
- *ix = output_h - oy, *iy = output_w - ox;
- break;
- }
- if (trasnform & 0x1)
- {
- ratio_w = (float)input_w / output_h;
- ratio_h = (float)input_h / output_w;
- }
- else
- {
- ratio_w = (float)input_w / output_w;
- ratio_h = (float)input_h / output_h;
- }
- *ix *= ratio_w;
- *iy *= ratio_h;
-}
-
-static void
-_e_video_hwc_geometry_cal_to_input_rect(E_Video_Hwc_Geometry *geo, Eina_Rectangle *srect, Eina_Rectangle *drect)
-{
- int xf1, yf1, xf2, yf2;
-
- /* first transform box coordinates if the scaler is set */
-
- xf1 = srect->x;
- yf1 = srect->y;
- xf2 = srect->x + srect->w;
- yf2 = srect->y + srect->h;
-
- _e_video_hwc_geometry_cal_to_input(geo->output_r.w, geo->output_r.h,
- geo->input_r.w, geo->input_r.h,
- geo->transform, xf1, yf1, &xf1, &yf1);
- _e_video_hwc_geometry_cal_to_input(geo->output_r.w, geo->output_r.h,
- geo->input_r.w, geo->input_r.h,
- geo->transform, xf2, yf2, &xf2, &yf2);
-
- drect->x = MIN(xf1, xf2);
- drect->y = MIN(yf1, yf2);
- drect->w = MAX(xf1, xf2) - drect->x;
- drect->h = MAX(yf1, yf2) - drect->y;
-}
-
static Eina_Bool
_e_video_hwc_geometry_get(E_Client *ec, E_Video_Hwc_Geometry *out)
{
- E_Zone *zone;
- E_Client *topmost;
- Eina_Rectangle screen = {0,};
- Eina_Rectangle output_r = {0,}, input_r = {0,};
+ Eina_Rectangle input_r = {0,};
/* get geometry information with buffer scale, transform and viewport. */
if (!_e_video_hwc_geometry_viewport_apply(ec, out))
_e_video_hwc_geometry_map_apply(ec, out);
- topmost = e_comp_wl_topmost_parent_get(ec);
- EINA_SAFETY_ON_NULL_RETURN_VAL(topmost, EINA_FALSE);
-
- zone = e_comp_zone_xy_get(topmost->x, topmost->y);
- EINA_SAFETY_ON_NULL_RETURN_VAL(zone, EINA_FALSE);
-
- screen.w = zone->w;
- screen.h = zone->h;
-
e_comp_wl_video_buffer_size_get(ec, &input_r.w, &input_r.h);
// when topmost is not mapped, input size can be abnormal.
// in this case, it will be render by topmost showing.
return EINA_FALSE;
}
- if (out->output_r.x >= 0 && out->output_r.y >= 0 &&
- (out->output_r.x + out->output_r.w) <= screen.w &&
- (out->output_r.y + out->output_r.h) <= screen.h)
- return EINA_TRUE;
-
- /* TODO: need to improve */
-
- output_r = out->output_r;
- if (!eina_rectangle_intersection(&output_r, &screen))
- {
- VER("output_r(%d,%d %dx%d) screen(%d,%d %dx%d) => intersect(%d,%d %dx%d)",
- ec, EINA_RECTANGLE_ARGS(&out->output_r),
- EINA_RECTANGLE_ARGS(&screen), EINA_RECTANGLE_ARGS(&output_r));
- return EINA_TRUE;
- }
-
- output_r.x -= out->output_r.x;
- output_r.y -= out->output_r.y;
-
- if (output_r.w <= 0 || output_r.h <= 0)
- {
- VER("output area is empty", ec);
- return EINA_FALSE;
- }
-
- VDB("output(%d,%d %dx%d) input(%d,%d %dx%d)",
- ec, EINA_RECTANGLE_ARGS(&output_r), EINA_RECTANGLE_ARGS(&input_r));
-
- _e_video_hwc_geometry_cal_to_input_rect(out, &output_r, &input_r);
-
- VDB("output(%d,%d %dx%d) input(%d,%d %dx%d)",
- ec, EINA_RECTANGLE_ARGS(&output_r), EINA_RECTANGLE_ARGS(&input_r));
-
- output_r.x += out->output_r.x;
- output_r.y += out->output_r.y;
-
- input_r.x += out->input_r.x;
- input_r.y += out->input_r.y;
-
- output_r.x = output_r.x & ~1;
- output_r.w = (output_r.w + 1) & ~1;
-
- input_r.x = input_r.x & ~1;
- input_r.w = (input_r.w + 1) & ~1;
-
- out->output_r = output_r;
- out->input_r = input_r;
-
- _e_video_hwc_geometry_tdm_config_update(ec, out);
-
return EINA_TRUE;
}