summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-10-16 17:20:14 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-10-16 22:56:38 +0900
commit7d7f548afcfcb0a69fe1694b7c68f36cecc74d89 (patch)
tree478b7990e8b732dbafc4681c8cfd228719b25650
parented0e8b8df1b751e0c9f46e5f2a3fdfa1364a8659 (diff)
downloadefl-7d7f548afcfcb0a69fe1694b7c68f36cecc74d89.tar.gz
evas - gl - dont allocate image and/or texture until needed on native unset
-rw-r--r--src/modules/evas/engines/gl_cocoa/evas_engine.c7
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c15
-rw-r--r--src/modules/evas/engines/gl_sdl/evas_engine.c5
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c6
-rw-r--r--src/modules/evas/engines/wayland_egl/evas_engine.c6
6 files changed, 38 insertions, 2 deletions
diff --git a/src/modules/evas/engines/gl_cocoa/evas_engine.c b/src/modules/evas/engines/gl_cocoa/evas_engine.c
index 83c2968cc3..702e751fc2 100644
--- a/src/modules/evas/engines/gl_cocoa/evas_engine.c
+++ b/src/modules/evas/engines/gl_cocoa/evas_engine.c
@@ -453,6 +453,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
if (!im->im->image.data)
evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
im_new = evas_gl_common_image_new_from_copied_data
(im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
im->im->image.data,
@@ -523,6 +524,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
/* FIXME: can move to gl_common */
if (im->cs.space == cspace) return;
eng_window_use(re->win);
+ evas_gl_common_image_alloc_ensure(im);
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
switch (cspace)
{
@@ -676,7 +678,8 @@ eng_image_size_set(void *data, void *image, int w, int h)
w &= ~0x1;
break;
}
-
+
+ evas_gl_common_image_alloc_ensure(im_old);
if ((im_old->im) &&
((int)im_old->im->cache_entry.w == w) &&
((int)im_old->im->cache_entry.h == h))
@@ -744,6 +747,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
}
eng_window_use(re->win);
error = evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
@@ -795,6 +799,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
im = image;
if (im->native.data) return image;
eng_window_use(re->win);
+ evas_gl_common_image_alloc_ensure(im);
if ((im->tex) && (im->tex->pt) && (im->tex->pt->dyn.data))
{
if (im->tex->pt->dyn.data == image_data)
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index def64253fb..df0166452e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -715,6 +715,7 @@ void evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8
Evas_GL_Texture *evas_gl_common_texture_nv12tiled_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigned int w, unsigned int h);
void evas_gl_common_texture_nv12tiled_update(Evas_GL_Texture *tex, DATA8 **row, unsigned int w, unsigned int h);
+void evas_gl_common_image_alloc_ensure(Evas_GL_Image *im);
void evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc);
void evas_gl_common_image_ref(Evas_GL_Image *im);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 769b65acaa..23177904fb 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -1,6 +1,14 @@
#include "evas_gl_private.h"
void
+evas_gl_common_image_alloc_ensure(Evas_GL_Image *im)
+{
+ if (!im->im) return;
+ im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry,
+ im->w, im->h);
+}
+
+void
evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc)
{
Eina_List *l;
@@ -332,6 +340,7 @@ evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha)
if (im->alpha == alpha) return im;
im->alpha = alpha;
if (!im->im) return im;
+ evas_gl_common_image_alloc_ensure(im);
evas_cache_image_load_data(&im->im->cache_entry);
im->im->cache_entry.flags.alpha = alpha ? 1 : 0;
@@ -395,14 +404,15 @@ evas_gl_common_image_native_disable(Evas_GL_Image *im)
im->tex = NULL;
}
im->tex_only = 0;
-
im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->im->cache_entry.flags.alpha = im->alpha;
im->cs.space = EVAS_COLORSPACE_ARGB8888;
evas_cache_image_colorspace(&im->im->cache_entry, im->cs.space);
+/*
im->im = (RGBA_Image *)evas_cache_image_size_set(&im->im->cache_entry, im->w, im->h);
if (!im->tex)
im->tex = evas_gl_common_texture_new(im->gc, im->im);
+ */
}
void
@@ -538,6 +548,7 @@ evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, un
}
if (im->im)
{
+ evas_gl_common_image_alloc_ensure(im);
im->im = (RGBA_Image *)evas_cache_image_dirty(&im->im->cache_entry, x, y, w, h);
}
im->dirty = 1;
@@ -549,6 +560,7 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
Image_Entry *ie;
if (!im->im) return;
ie = (Image_Entry *)(im->im);
+ evas_gl_common_image_alloc_ensure(im);
/*
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
@@ -716,6 +728,7 @@ evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
cx, cy, cw, ch);
if ((nw < 1) || (nh < 1)) return;
+ if (!im->tex) return;
if ((nx == dx) && (ny == dy) && (nw == dw) && (nh == dh))
{
if (yuv)
diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c
index 5c5df60eea..6e89f21ca2 100644
--- a/src/modules/evas/engines/gl_sdl/evas_engine.c
+++ b/src/modules/evas/engines/gl_sdl/evas_engine.c
@@ -365,6 +365,7 @@ eng_image_alpha_set(void *data EINA_UNUSED, void *image, int has_alpha)
if (!im->im->image.data)
evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
im_new = evas_gl_common_image_new_from_copied_data(im->gc, im->im->cache_entry.w, im->im->cache_entry.h, im->im->image.data,
eng_image_alpha_get(data, image),
eng_image_colorspace_get(data, image));
@@ -414,6 +415,7 @@ eng_image_colorspace_set(void *data EINA_UNUSED, void *image, int cspace)
if (im->native.data) return;
/* FIXME: can move to gl_common */
if (im->cs.space == cspace) return;
+ evas_gl_common_image_alloc_ensure(im);
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
switch (cspace)
{
@@ -566,6 +568,7 @@ eng_image_size_set(void *data, void *image, int w, int h)
break;
}
+ evas_gl_common_image_alloc_ensure(im_old);
if ((im_old->im) &&
((int)im_old->im->cache_entry.w == w) &&
((int)im_old->im->cache_entry.h == h))
@@ -621,6 +624,7 @@ eng_image_data_get(void *data EINA_UNUSED, void *image, int to_write, DATA32 **i
return im;
}
error = evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
@@ -670,6 +674,7 @@ eng_image_data_put(void *data EINA_UNUSED, void *image, DATA32 *image_data)
if (!image) return NULL;
im = image;
if (im->native.data) return image;
+ evas_gl_common_image_alloc_ensure(im);
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c b/src/modules/evas/engines/gl_x11/evas_engine.c
index cda7fe7e6f..f1a41e5a3a 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -1817,6 +1817,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
if (!im->im->image.data)
evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
im_new = evas_gl_common_image_new_from_copied_data
(im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
im->im->image.data,
@@ -1888,6 +1889,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
/* FIXME: can move to gl_common */
if (im->cs.space == cspace) return;
eng_window_use(re->win);
+ evas_gl_common_image_alloc_ensure(im);
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
switch (cspace)
{
@@ -2633,6 +2635,7 @@ eng_image_size_set(void *data, void *image, int w, int h)
break;
}
+ evas_gl_common_image_alloc_ensure(im_old);
if ((im_old->im) &&
((int)im_old->im->cache_entry.w == w) &&
((int)im_old->im->cache_entry.h == h))
@@ -2743,6 +2746,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
}
error = evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
@@ -2797,6 +2801,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
im = image;
if (im->native.data) return image;
eng_window_use(re->win);
+ evas_gl_common_image_alloc_ensure(im);
if ((im->tex) && (im->tex->pt)
&& (im->tex->pt->dyn.data)
&& (im->cs.space == EVAS_COLORSPACE_ARGB8888))
@@ -3357,6 +3362,7 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
return EINA_FALSE;
}
+ evas_gl_common_image_alloc_ensure(im);
src_w = im->im->cache_entry.w;
src_h = im->im->cache_entry.h;
if ((src_w == 0) || (src_h == 0))
diff --git a/src/modules/evas/engines/wayland_egl/evas_engine.c b/src/modules/evas/engines/wayland_egl/evas_engine.c
index 28f72b08de..a370825b2f 100644
--- a/src/modules/evas/engines/wayland_egl/evas_engine.c
+++ b/src/modules/evas/engines/wayland_egl/evas_engine.c
@@ -1681,6 +1681,7 @@ eng_image_size_set(void *data, void *image, int w, int h)
break;
}
+ evas_gl_common_image_alloc_ensure(im);
if ((im_old->im) &&
((int)im_old->im->cache_entry.w == w) &&
((int)im_old->im->cache_entry.h == h))
@@ -1778,6 +1779,7 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
}
error = evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
@@ -1832,6 +1834,7 @@ eng_image_data_put(void *data, void *image, DATA32 *image_data)
if (!(im = image)) return NULL;
if (im->native.data) return image;
eng_window_use(re->win);
+ evas_gl_common_image_alloc_ensure(im);
if ((im->tex) && (im->tex->pt)
&& (im->tex->pt->dyn.data)
&& (im->cs.space == EVAS_COLORSPACE_ARGB8888))
@@ -1959,6 +1962,7 @@ eng_image_alpha_set(void *data, void *image, int has_alpha)
if (!im->im->image.data)
evas_cache_image_load_data(&im->im->cache_entry);
+ evas_gl_common_image_alloc_ensure(im);
im_new = evas_gl_common_image_new_from_copied_data
(im->gc, im->im->cache_entry.w, im->im->cache_entry.h,
im->im->image.data,
@@ -2071,6 +2075,7 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
/* FIXME: can move to gl_common */
if (im->cs.space == cspace) return;
eng_window_use(re->win);
+ evas_gl_common_image_alloc_ensure(im);
evas_cache_image_colorspace(&im->im->cache_entry, cspace);
switch (cspace)
{
@@ -2516,6 +2521,7 @@ eng_pixel_alpha_get(void *image, int x, int y, DATA8 *alpha, int src_region_x, i
return EINA_FALSE;
}
+ evas_gl_common_image_alloc_ensure(im);
src_w = im->im->cache_entry.w;
src_h = im->im->cache_entry.h;
if ((src_w == 0) || (src_h == 0))