}
}
-static void
+static Eina_Bool
_e_rdp_output_center_rect_get (int src_w, int src_h, int dst_w, int dst_h, Eina_Rectangle *fit)
{
float rw, rh;
if (src_w <= 0 || src_h <= 0 || dst_w <= 0 || dst_h <= 0 || !fit)
- return;
+ return EINA_FALSE;
rw = (float)src_w / dst_w;
rh = (float)src_h / dst_h;
if (fit->x % 2)
fit->x = fit->x - 1;
+
+ return EINA_TRUE;
}
static void
}
_e_rdp_output_image_src_crop_get(hwc_window, &src_crop, &showing_pos, primary_w, primary_h);
- _e_rdp_output_center_rect_get(primary_w, primary_h, pix_w, pix_h, &dst_pos);
+ if (_e_rdp_output_center_rect_get(primary_w, primary_h, pix_w, pix_h, &dst_pos) == EINA_FALSE)
+ {
+ pixman_image_unref(pix_shm_src);
+ return EINA_FALSE;
+ }
_e_rdp_output_image_dst_crop_get(hwc_window, img_w, img_h, primary_w, primary_h, &dst_pos, &showing_pos, &dst_crop, 0);
_e_rdp_output_image_composite(pix_shm_src, pix_surface,
tbm_surface_info_s info;
pixman_image_t *pix_surface_src = NULL;
pixman_format_code_t pix_format = 0;
- int err = 0;
tbm_surface = hwc_window->display.buffer.tsurface;
if (!tbm_surface)
tbm_surface_internal_ref(tbm_surface);
- err = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &info);
- if (err)
- return EINA_FALSE;
+ if (tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &info) != TBM_SURFACE_ERROR_NONE)
+ {
+ tbm_surface_internal_unref(tbm_surface);
+ return EINA_FALSE;
+ }
pix_format = _e_rdp_pixman_format_get(info.format);
if (pix_format == 0)
{
ERR("not supported format");
- tbm_surface_unmap(tbm_surface);
- return EINA_FALSE;
+ goto error;
}
pix_surface_src = pixman_image_create_bits(pix_format, info.width, info.height, (uint32_t *)info.planes[0].ptr, info.planes[0].stride);
if (pix_surface_src == NULL)
{
ERR("create pixman image failed");
- tbm_surface_unmap(tbm_surface);
- return EINA_FALSE;
+ goto error;
}
_e_rdp_output_image_src_crop_get(hwc_window, &src_crop, &showing_pos, primary_w, primary_h);
_e_rdp_output_center_rect_get(primary_w, primary_h, pix_w, pix_h, &dst_pos);
+ if (_e_rdp_output_center_rect_get(primary_w, primary_h, pix_w, pix_h, &dst_pos) == EINA_FALSE)
+ {
+ pixman_image_unref(pix_surface_src);
+ goto error;
+ }
_e_rdp_output_image_dst_crop_get(hwc_window, info.width, info.height, primary_w, primary_h, &dst_pos, &showing_pos, &dst_crop, 0);
_e_rdp_output_image_composite(pix_surface_src, pix_surface,
tbm_surface_internal_unref(tbm_surface);
return EINA_TRUE;
+
+error:
+ tbm_surface_unmap(tbm_surface);
+ tbm_surface_internal_unref(tbm_surface);
+ return EINA_FALSE;
}
static int