forked from enlightenment/efl
evas/async_render: use image scalecache
SVN revision: 82890
This commit is contained in:
parent
73667b025c
commit
09f342fdeb
|
@ -55,6 +55,15 @@ EAPI void
|
|||
int src_region_w, int src_region_h,
|
||||
int dst_region_x, int dst_region_y,
|
||||
int dst_region_w, int dst_region_h);
|
||||
EAPI Eina_Bool
|
||||
evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
|
||||
RGBA_Draw_Context *dc, int smooth,
|
||||
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_sample,
|
||||
Evas_Common_Scale_In_To_Out_Clip_Cb cb_smooth);
|
||||
|
||||
|
||||
EAPI int evas_common_load_rgba_image_module_from_file (Image_Entry *im);
|
||||
|
|
|
@ -495,19 +495,22 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
|
|||
//static int noscales = 0;
|
||||
#endif
|
||||
|
||||
EAPI void
|
||||
evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
||||
RGBA_Draw_Context *dc, int smooth,
|
||||
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)
|
||||
EAPI Eina_Bool
|
||||
evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
|
||||
RGBA_Draw_Context *dc, int smooth,
|
||||
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_sample,
|
||||
Evas_Common_Scale_In_To_Out_Clip_Cb cb_smooth)
|
||||
{
|
||||
#ifdef SCALECACHE
|
||||
RGBA_Image *im = (RGBA_Image *)ie;
|
||||
Scaleitem *sci;
|
||||
int didpop = 0;
|
||||
int dounload = 0;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
/*
|
||||
static int i = 0;
|
||||
|
||||
|
@ -520,7 +523,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
}
|
||||
*/
|
||||
if ((dst_region_w == 0) || (dst_region_h == 0) ||
|
||||
(src_region_w == 0) || (src_region_h == 0)) return;
|
||||
(src_region_w == 0) || (src_region_h == 0)) return EINA_FALSE;
|
||||
LKL(im->cache.lock);
|
||||
if ((src_region_w == dst_region_w) && (src_region_h == dst_region_h))
|
||||
{
|
||||
|
@ -539,13 +542,13 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
LKU(im->cache.lock);
|
||||
if (im->image.data)
|
||||
{
|
||||
evas_common_scale_rgba_in_to_out_clip_sample(im, 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);
|
||||
return cb_sample(im, 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);
|
||||
}
|
||||
return;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
LKL(cache_lock);
|
||||
sci = _sci_find(im, dc, smooth,
|
||||
|
@ -570,24 +573,24 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
if (im->image.data)
|
||||
{
|
||||
if (smooth)
|
||||
evas_common_scale_rgba_in_to_out_clip_smooth(im, 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);
|
||||
return cb_smooth(im, 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);
|
||||
else
|
||||
evas_common_scale_rgba_in_to_out_clip_sample(im, 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);
|
||||
return cb_sample(im, 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);
|
||||
}
|
||||
return;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
if (sci->populate_me)
|
||||
{
|
||||
int size, osize, used;
|
||||
|
||||
|
||||
size = dst_region_w * dst_region_h;
|
||||
if (((((dst_region_w > 640) || (dst_region_h > 640)) &&
|
||||
(size > (480 * 480))) ||
|
||||
|
@ -596,7 +599,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
{
|
||||
Eina_List *l;
|
||||
Scaleitem *sci2;
|
||||
|
||||
|
||||
dounload = 1;
|
||||
osize = sci->parent_im->cache_entry.w * sci->parent_im->cache_entry.h;
|
||||
used = 0;
|
||||
|
@ -611,7 +614,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
osize -= used;
|
||||
if (osize < 0) osize = 0;
|
||||
size -= osize;
|
||||
sci->size_adjust = size * 4;
|
||||
sci->size_adjust = size * 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -632,7 +635,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
if (sci->im)
|
||||
{
|
||||
static RGBA_Draw_Context *ct = NULL;
|
||||
|
||||
|
||||
LKL(cache_lock);
|
||||
im->cache.orig_usage++;
|
||||
im->cache.usage_count = use_counter;
|
||||
|
@ -658,29 +661,27 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
if (im->image.data)
|
||||
{
|
||||
if (smooth)
|
||||
evas_common_scale_rgba_in_to_out_clip_smooth
|
||||
(im, sci->im, ct,
|
||||
src_region_x, src_region_y,
|
||||
src_region_w, src_region_h,
|
||||
0, 0,
|
||||
dst_region_w, dst_region_h);
|
||||
ret = cb_smooth(im, sci->im, ct,
|
||||
src_region_x, src_region_y,
|
||||
src_region_w, src_region_h,
|
||||
0, 0,
|
||||
dst_region_w, dst_region_h);
|
||||
else
|
||||
evas_common_scale_rgba_in_to_out_clip_sample
|
||||
(im, sci->im, ct,
|
||||
src_region_x, src_region_y,
|
||||
src_region_w, src_region_h,
|
||||
0, 0,
|
||||
dst_region_w, dst_region_h);
|
||||
ret = cb_sample(im, sci->im, ct,
|
||||
src_region_x, src_region_y,
|
||||
src_region_w, src_region_h,
|
||||
0, 0,
|
||||
dst_region_w, dst_region_h);
|
||||
sci->populate_me = 0;
|
||||
#if 0 // visual debug of cached images
|
||||
#if 0 // visual debug of cached images
|
||||
{
|
||||
int xx, yy;
|
||||
DATA32 *pp;
|
||||
|
||||
|
||||
pp = sci->im->image.data;
|
||||
for (yy = 0; yy < dst_region_h; yy++)
|
||||
{
|
||||
|
||||
|
||||
for (xx = 0; xx < dst_region_w; xx++)
|
||||
{
|
||||
if (yy & 0x1)
|
||||
|
@ -688,14 +689,14 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
if (xx & 0x1) *pp = 0x882288ff;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if (!(xx & 0x1)) *pp = 0x882288ff;
|
||||
}
|
||||
}
|
||||
pp++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
if (dounload)
|
||||
{
|
||||
|
@ -706,8 +707,8 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
{
|
||||
cache_size += sci->dst_w * sci->dst_h * 4;
|
||||
}
|
||||
// INF(" + %i @ flop: %i (%ix%i)",
|
||||
// sci->dst_w * sci->dst_h * 4, sci->flop,
|
||||
// INF(" + %i @ flop: %i (%ix%i)",
|
||||
// sci->dst_w * sci->dst_h * 4, sci->flop,
|
||||
// sci->dst_w, sci->dst_h);
|
||||
cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci);
|
||||
_cache_prune(sci, 0);
|
||||
|
@ -730,39 +731,38 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
}
|
||||
// INF("use cached!");
|
||||
LKU(im->cache.lock);
|
||||
evas_common_scale_rgba_in_to_out_clip_sample
|
||||
(sci->im, dst, dc,
|
||||
0, 0,
|
||||
dst_region_w, dst_region_h,
|
||||
dst_region_x, dst_region_y,
|
||||
dst_region_w, dst_region_h);
|
||||
ret |= cb_sample(sci->im, dst, dc,
|
||||
0, 0,
|
||||
dst_region_w, dst_region_h,
|
||||
dst_region_x, dst_region_y,
|
||||
dst_region_w, dst_region_h);
|
||||
// hits++;
|
||||
// INF("check %p %i < %i",
|
||||
// INF("check %p %i < %i",
|
||||
// im,
|
||||
// (int)im->cache.orig_usage,
|
||||
// (int)im->cache.orig_usage,
|
||||
// (int)im->cache.newest_usage);
|
||||
/* while framequeuing is applied,
|
||||
* original image data is loaded by the main thread
|
||||
* original image data is loaded by the main thread
|
||||
* just before enqueuing the rendering op into the pipe.
|
||||
* so unloading the original image data here
|
||||
* so unloading the original image data here
|
||||
* causes only speed-down side-effect and no memory usage gain;
|
||||
* it will be loaded again for the very next rendering for this image.
|
||||
*/
|
||||
if (ie->scale_hint != EVAS_IMAGE_SCALE_HINT_DYNAMIC)
|
||||
{
|
||||
if ((dounload) ||
|
||||
((im->cache_entry.flags.loaded) &&
|
||||
((!im->cs.no_free)
|
||||
#ifdef EVAS_CSERVE
|
||||
if ((dounload) ||
|
||||
((im->cache_entry.flags.loaded) &&
|
||||
((!im->cs.no_free)
|
||||
#ifdef EVAS_CSERVE
|
||||
|| (ie->data1)
|
||||
#endif
|
||||
#endif
|
||||
#ifdef EVAS_CSERVE2
|
||||
|| (ie->data1)
|
||||
#endif
|
||||
) &&
|
||||
(im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)))
|
||||
{
|
||||
if ((dounload) || (im->cache.orig_usage <
|
||||
if ((dounload) || (im->cache.orig_usage <
|
||||
(im->cache.newest_usage / 20)))
|
||||
{
|
||||
//FIXME: imagedataunload - inform owners
|
||||
|
@ -793,21 +793,26 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
if (im->image.data)
|
||||
{
|
||||
if (smooth)
|
||||
evas_common_scale_rgba_in_to_out_clip_smooth(im, 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);
|
||||
ret |= cb_smooth(im, 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);
|
||||
else
|
||||
evas_common_scale_rgba_in_to_out_clip_sample(im, 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);
|
||||
ret |= cb_sample(im, 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);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
return ret;
|
||||
|
||||
#else
|
||||
|
||||
RGBA_Image *im = (RGBA_Image *)ie;
|
||||
|
||||
if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
|
||||
{
|
||||
#ifdef EVAS_CSERVE2
|
||||
|
@ -821,17 +826,36 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
|||
if (im->image.data)
|
||||
{
|
||||
if (smooth)
|
||||
evas_common_scale_rgba_in_to_out_clip_smooth(im, 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);
|
||||
return cb_smooth(im, 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);
|
||||
else
|
||||
evas_common_scale_rgba_in_to_out_clip_sample(im, 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);
|
||||
return cb_sample(im, 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);
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
EAPI void
|
||||
evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
|
||||
RGBA_Draw_Context *dc, int smooth,
|
||||
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_rgba_image_scalecache_do_cbs(
|
||||
ie, dst, dc, smooth,
|
||||
src_region_x, src_region_y, src_region_w, src_region_h,
|
||||
dst_region_x, dst_region_y, dst_region_w, dst_region_h,
|
||||
evas_common_scale_rgba_in_to_out_clip_sample,
|
||||
evas_common_scale_rgba_in_to_out_clip_smooth);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ typedef Eina_Bool (*Evas_Common_Scale_In_To_Out_Clip_Cb)(RGBA_Image *src, RGBA_I
|
|||
EAPI void evas_common_scale_init (void);
|
||||
|
||||
EAPI Eina_Bool 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);
|
||||
EAPI void evas_common_scale_rgba_in_to_out_clip_smooth (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);
|
||||
EAPI void evas_common_scale_rgba_in_to_out_clip_sample (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);
|
||||
EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_smooth (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);
|
||||
EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_sample (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);
|
||||
|
||||
EAPI void evas_common_rgba_image_scalecache_dump(void);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
static Eina_Bool scale_rgba_in_to_out_clip_sample_internal(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);
|
||||
|
||||
EAPI void
|
||||
EAPI Eina_Bool
|
||||
evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
|
||||
RGBA_Draw_Context *dc,
|
||||
int src_region_x, int src_region_y,
|
||||
|
@ -11,7 +11,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
|
|||
int dst_region_x, int dst_region_y,
|
||||
int dst_region_w, int dst_region_h)
|
||||
{
|
||||
evas_common_scale_rgba_in_to_out_clip_cb
|
||||
return evas_common_scale_rgba_in_to_out_clip_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,
|
||||
|
|
|
@ -180,7 +180,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth_c(RGBA_Image *src, RGBA_Image *dst,
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EAPI Eina_Bool
|
||||
evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
|
||||
RGBA_Draw_Context *dc,
|
||||
int src_region_x, int src_region_y,
|
||||
|
@ -199,12 +199,12 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
|
|||
#endif
|
||||
cb = evas_common_scale_rgba_in_to_out_clip_smooth_c;
|
||||
|
||||
evas_common_scale_rgba_in_to_out_clip_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,
|
||||
cb);
|
||||
return evas_common_scale_rgba_in_to_out_clip_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,
|
||||
cb);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
|
@ -1187,13 +1187,13 @@ _draw_thread_image_draw(void *data)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_image_draw_thread_cmd(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, int smooth)
|
||||
_image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
|
||||
{
|
||||
Evas_Thread_Command_Image *cr;
|
||||
int clip_x, clip_y, clip_w, clip_h;
|
||||
|
||||
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,
|
||||
if ((dst_w <= 0) || (dst_h <= 0)) return EINA_FALSE;
|
||||
if (!(RECTS_INTERSECT(dst_x, dst_y, dst_w, dst_h,
|
||||
0, 0, dst->cache_entry.w, dst->cache_entry.h))) return EINA_FALSE;
|
||||
|
||||
cr = eina_mempool_malloc(_mp_command_image, sizeof (Evas_Thread_Command_Image));
|
||||
|
@ -1201,8 +1201,8 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
|
|||
|
||||
cr->image = src;
|
||||
cr->surface = dst;
|
||||
EINA_RECTANGLE_SET(&cr->src, src_region_x, src_region_y, src_region_w, src_region_h);
|
||||
EINA_RECTANGLE_SET(&cr->dst, dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
||||
EINA_RECTANGLE_SET(&cr->src, src_x, src_y, src_w, src_h);
|
||||
EINA_RECTANGLE_SET(&cr->dst, dst_x, dst_y, dst_w, dst_h);
|
||||
|
||||
if (dc->clip.use)
|
||||
{
|
||||
|
@ -1231,23 +1231,39 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_image_draw_thread_cmd_smooth(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)
|
||||
_image_draw_thread_cmd_smooth(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
return _image_draw_thread_cmd
|
||||
(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,
|
||||
1);
|
||||
return _image_draw_thread_cmd(src, dst, dc,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
1);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_image_draw_thread_cmd_sample(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)
|
||||
_image_draw_thread_cmd_sample(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
return _image_draw_thread_cmd
|
||||
(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,
|
||||
0);
|
||||
return _image_draw_thread_cmd(src, dst, dc,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
0);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_image_thr_cb_smooth(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
return evas_common_scale_rgba_in_to_out_clip_cb(src, dst, dc,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
_image_draw_thread_cmd_smooth);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_image_thr_cb_sample(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
return evas_common_scale_rgba_in_to_out_clip_cb(src, dst, dc,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
_image_draw_thread_cmd_sample);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -1272,20 +1288,16 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
|
|||
if (!im->cache_entry.flags.loaded) return EINA_FALSE;
|
||||
}
|
||||
|
||||
evas_common_image_colorspace_normalize(im);
|
||||
evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h);
|
||||
|
||||
if (smooth)
|
||||
return evas_common_scale_rgba_in_to_out_clip_cb
|
||||
(image, surface, context,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
_image_draw_thread_cmd_smooth);
|
||||
else
|
||||
return evas_common_scale_rgba_in_to_out_clip_cb
|
||||
(image, surface, context,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
_image_draw_thread_cmd_sample);
|
||||
return evas_common_rgba_image_scalecache_do_cbs(image, surface,
|
||||
context, smooth,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h,
|
||||
_image_thr_cb_sample,
|
||||
_image_thr_cb_smooth);
|
||||
}
|
||||
#ifdef BUILD_PIPE_RENDER
|
||||
else if ((cpunum > 1))
|
||||
|
@ -1294,11 +1306,11 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
|
|||
if (evas_cserve2_use_get())
|
||||
evas_cache2_image_load_data(&im->cache_entry);
|
||||
#endif
|
||||
evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
|
||||
evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
|
||||
surface, context, smooth,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h);
|
||||
|
||||
|
||||
evas_common_pipe_image_draw(im, surface, context, smooth,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h);
|
||||
|
@ -1359,13 +1371,13 @@ image_loaded:
|
|||
}
|
||||
|
||||
static void
|
||||
_map_image_draw(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, int smooth)
|
||||
_map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
|
||||
{
|
||||
int clip_x, clip_y, clip_w, clip_h;
|
||||
DATA32 mul_col;
|
||||
|
||||
if ((dst_region_w <= 0) || (dst_region_h <= 0)) return;
|
||||
if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h,
|
||||
if ((dst_w <= 0) || (dst_h <= 0)) return;
|
||||
if (!(RECTS_INTERSECT(dst_x, dst_y, dst_w, dst_h,
|
||||
0, 0, dst->cache_entry.w, dst->cache_entry.h))) return;
|
||||
|
||||
if (dc->clip.use)
|
||||
|
@ -1385,38 +1397,34 @@ _map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src
|
|||
mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
|
||||
|
||||
if (smooth)
|
||||
evas_common_scale_rgba_smooth_draw
|
||||
(src, dst,
|
||||
clip_x, clip_y, clip_w, clip_h,
|
||||
mul_col, dc->render_op,
|
||||
src_region_x, src_region_y, src_region_w, src_region_h,
|
||||
dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
||||
evas_common_scale_rgba_smooth_draw(src, dst,
|
||||
clip_x, clip_y, clip_w, clip_h,
|
||||
mul_col, dc->render_op,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h);
|
||||
else
|
||||
evas_common_scale_rgba_sample_draw
|
||||
(src, dst,
|
||||
clip_x, clip_y, clip_w, clip_h,
|
||||
mul_col, dc->render_op,
|
||||
src_region_x, src_region_y, src_region_w, src_region_h,
|
||||
dst_region_x, dst_region_y, dst_region_w, dst_region_h);
|
||||
evas_common_scale_rgba_sample_draw(src, dst,
|
||||
clip_x, clip_y, clip_w, clip_h,
|
||||
mul_col, dc->render_op,
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_map_image_sample_draw(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)
|
||||
_map_image_sample_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
_map_image_draw(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,
|
||||
0);
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h, 0);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_map_image_smooth_draw(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)
|
||||
_map_image_smooth_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
|
||||
{
|
||||
_map_image_draw(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,
|
||||
1);
|
||||
src_x, src_y, src_w, src_h,
|
||||
dst_x, dst_y, dst_w, dst_h, 1);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1484,7 +1492,7 @@ _draw_thread_map_draw(void *data)
|
|||
while ((m->count > 4) && (m->count - offset >= 3));
|
||||
|
||||
free_out:
|
||||
free(m); // FIXME: allocating and destroying map do have perf impact... ref counting would be better
|
||||
free(m);
|
||||
eina_mempool_free(_mp_command_map, map);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue