2013-06-20 03:53:29 -07:00
|
|
|
#include "evas_common_private.h"
|
2012-07-04 02:39:23 -07:00
|
|
|
#include "evas_private.h"
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2006-09-06 00:33:40 -07:00
|
|
|
EAPI void
|
2002-11-13 21:38:10 -08:00
|
|
|
evas_common_scale_init(void)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
}
|
2012-07-04 02:39:23 -07:00
|
|
|
|
|
|
|
EAPI Eina_Bool
|
2014-08-24 20:49:22 -07:00
|
|
|
evas_common_scale_rgba_in_to_out_clip_prepare(Cutout_Rects **reuse, const RGBA_Image *src EINA_UNUSED,
|
2012-07-04 02:39:23 -07:00
|
|
|
const RGBA_Image *dst,
|
|
|
|
RGBA_Draw_Context *dc,
|
|
|
|
int dst_region_x, int dst_region_y,
|
|
|
|
int dst_region_w, int dst_region_h)
|
|
|
|
{
|
|
|
|
/* handle cutouts here! */
|
|
|
|
if ((dst_region_w <= 0) || (dst_region_h <= 0)) return EINA_FALSE;
|
|
|
|
if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
|
|
|
|
0, 0, dst->cache_entry.w, dst->cache_entry.h)))
|
|
|
|
return EINA_FALSE;
|
|
|
|
/* no cutouts - cut right to the chase */
|
|
|
|
if (!dc->cutout.rects) return EINA_TRUE;
|
|
|
|
|
|
|
|
evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
|
|
|
|
evas_common_draw_context_clip_clip(dc, dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
|
|
|
/* our clip is 0 size.. abort */
|
|
|
|
if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
|
|
|
|
return EINA_FALSE;
|
2014-08-24 20:49:22 -07:00
|
|
|
*reuse = evas_common_draw_context_apply_cutouts(dc, *reuse);
|
2012-07-04 02:39:23 -07:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
EAPI Eina_Bool
|
2012-11-28 14:49:19 -08:00
|
|
|
evas_common_scale_rgba_in_to_out_clip_cb(RGBA_Image *src, RGBA_Image *dst,
|
|
|
|
RGBA_Draw_Context *dc,
|
|
|
|
int src_region_x, int src_region_y,
|
|
|
|
int src_region_w, int src_region_h,
|
|
|
|
int dst_region_x, int dst_region_y,
|
|
|
|
int dst_region_w, int dst_region_h,
|
|
|
|
Evas_Common_Scale_In_To_Out_Clip_Cb cb)
|
|
|
|
{
|
|
|
|
Cutout_Rect *r;
|
|
|
|
int c, cx, cy, cw, ch;
|
|
|
|
int i;
|
2013-01-11 11:57:09 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2012-11-28 14:49:19 -08:00
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
/* handle cutouts here! */
|
|
|
|
if ((dst_region_w <= 0) || (dst_region_h <= 0)) return EINA_FALSE;
|
2012-11-28 14:49:19 -08:00
|
|
|
if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->cache_entry.w, dst->cache_entry.h)))
|
2013-01-11 11:57:09 -08:00
|
|
|
return EINA_FALSE;
|
2012-11-28 14:49:19 -08:00
|
|
|
|
|
|
|
/* no cutouts - cut right to the chase */
|
|
|
|
if (!dc->cutout.rects)
|
|
|
|
{
|
2013-01-11 11:57:09 -08:00
|
|
|
return cb(src, dst, dc,
|
|
|
|
src_region_x, src_region_y, src_region_w, src_region_h,
|
|
|
|
dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
2012-11-28 14:49:19 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* save out clip info */
|
|
|
|
c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
|
|
|
|
evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
|
|
|
|
evas_common_draw_context_clip_clip(dc, dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
|
|
|
|
|
|
|
/* our clip is 0 size.. abort */
|
|
|
|
if ((dc->clip.w <= 0) || (dc->clip.h <= 0))
|
|
|
|
{
|
2016-03-31 19:29:50 -07:00
|
|
|
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
|
|
|
return EINA_FALSE;
|
2012-11-28 14:49:19 -08:00
|
|
|
}
|
|
|
|
|
2016-11-16 16:05:56 -08:00
|
|
|
dc->cache.rects = evas_common_draw_context_apply_cutouts(dc, dc->cache.rects);
|
|
|
|
for (i = 0; i < dc->cache.rects->active; ++i)
|
2012-11-28 14:49:19 -08:00
|
|
|
{
|
2016-11-16 16:05:56 -08:00
|
|
|
r = dc->cache.rects->rects + i;
|
2016-03-31 19:29:50 -07:00
|
|
|
evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
|
2013-01-11 11:57:09 -08:00
|
|
|
ret |= cb(src, dst, dc,
|
|
|
|
src_region_x, src_region_y, src_region_w, src_region_h,
|
|
|
|
dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
2012-11-28 14:49:19 -08:00
|
|
|
}
|
2016-11-16 16:05:56 -08:00
|
|
|
evas_common_draw_context_cache_update(dc);
|
2012-11-28 14:49:19 -08:00
|
|
|
/* restore clip info */
|
|
|
|
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
2013-01-11 11:57:09 -08:00
|
|
|
|
|
|
|
return ret;
|
2012-11-28 14:49:19 -08:00
|
|
|
}
|