summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/evas/include/evas_private.h1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h2
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c22
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c93
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c25
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c23
6 files changed, 163 insertions, 3 deletions
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 68b1b52a24..bcb1d84ab4 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1391,6 +1391,7 @@ struct _Evas_Func
1391 void (*image_prepare) (void *data, void *image); 1391 void (*image_prepare) (void *data, void *image);
1392 1392
1393 void *(*image_surface_noscale_new) (void *data, int w, int h, int alpha); 1393 void *(*image_surface_noscale_new) (void *data, int w, int h, int alpha);
1394 void (*image_surface_noscale_region_get)(void *data, void *image, int *x, int *y, int *w, int *h);
1394 1395
1395 int (*image_native_init) (void *data, Evas_Native_Surface_Type type); 1396 int (*image_native_init) (void *data, Evas_Native_Surface_Type type);
1396 void (*image_native_shutdown) (void *data, Evas_Native_Surface_Type type); 1397 void (*image_native_shutdown) (void *data, Evas_Native_Surface_Type type);
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 8b56abe7b7..44999916f7 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -651,6 +651,7 @@ void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt);
651Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool disable_atlas); 651Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool disable_atlas);
652Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im); 652Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im);
653Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil); 653Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil);
654Evas_GL_Texture *evas_gl_common_texture_render_noscale_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
654Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); 655Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
655void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im); 656void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im);
656void evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int bytes_count); 657void evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int bytes_count);
@@ -680,6 +681,7 @@ void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hin
680void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint); 681void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint);
681void evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc); 682void evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc);
682Evas_GL_Image *evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil); 683Evas_GL_Image *evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil);
684Evas_GL_Image *evas_gl_common_image_surface_noscale_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha);
683void evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h); 685void evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h);
684void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); 686void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
685void evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level); 687void evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level);
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 99f75be2d2..0d9a5ddb21 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -743,6 +743,28 @@ evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, uns
743 return im; 743 return im;
744} 744}
745 745
746Evas_GL_Image *
747evas_gl_common_image_surface_noscale_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
748{
749 Evas_GL_Image *im;
750
751 if (((int)w > gc->shared->info.max_texture_size) ||
752 ((int)h > gc->shared->info.max_texture_size))
753 return NULL;
754
755 im = calloc(1, sizeof(Evas_GL_Image));
756 if (!im) return NULL;
757 im->references = 1;
758 im->gc = gc;
759 im->cs.space = EVAS_COLORSPACE_ARGB8888;
760 im->alpha = alpha;
761 im->w = w;
762 im->h = h;
763 im->tex = evas_gl_common_texture_render_noscale_new(gc, w, h, alpha);
764 im->tex_only = 1;
765 return im;
766}
767
746void 768void
747evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h) 769evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h)
748{ 770{
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index ff2737f3d5..1d4b7b192e 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -493,6 +493,7 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h,
493 if (th2 < 0) return NULL; 493 if (th2 < 0) return NULL;
494 EINA_LIST_FOREACH(gc->shared->tex.atlas[th2], l, pt) 494 EINA_LIST_FOREACH(gc->shared->tex.atlas[th2], l, pt)
495 { 495 {
496 if (pt->render) continue;
496 if ((*apt = _pool_tex_alloc(pt, w, h, u, v)) != NULL) 497 if ((*apt = _pool_tex_alloc(pt, w, h, u, v)) != NULL)
497 { 498 {
498 gc->shared->tex.atlas[th2] = 499 gc->shared->tex.atlas[th2] =
@@ -674,6 +675,65 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
674} 675}
675 676
676static Evas_GL_Texture_Pool * 677static Evas_GL_Texture_Pool *
678_pool_tex_render_find(Evas_Engine_GL_Context *gc, int w, int h,
679 GLenum intformat, GLenum format, int *u, int *v,
680 Eina_Rectangle **apt, int atlas_w, Eina_Bool disable_atlas)
681{
682 Evas_GL_Texture_Pool *pt = NULL;
683 Eina_List *l;
684 int th2;
685 int pool_h;
686 /*Return texture unit without atlas*/
687 if (disable_atlas)
688 {
689 pt = _pool_tex_render_new(gc, w, h, intformat, format, EINA_FALSE);
690 return pt ? pt : NULL;
691 }
692 if (atlas_w > gc->shared->info.max_texture_size)
693 atlas_w = gc->shared->info.max_texture_size;
694 if ((w > gc->shared->info.tune.atlas.max_w) ||
695 (h > gc->shared->info.tune.atlas.max_h) ||
696 (!gc->shared->info.etc1_subimage && (intformat == etc1_fmt)))
697 {
698 pt = _pool_tex_render_new(gc, w, h, intformat, format, EINA_FALSE);
699 if (!pt) return NULL;
700 gc->shared->tex.whole = eina_list_prepend(gc->shared->tex.whole, pt);
701 pt->fslot = -1;
702 pt->whole = 1;
703 *apt = _pool_tex_alloc(pt, w, h, u, v);
704 return pt;
705 }
706
707 th2 = _tex_format_index(intformat);
708 if (th2 < 0) return NULL;
709 EINA_LIST_FOREACH(gc->shared->tex.atlas[th2], l, pt)
710 {
711 if (!pt->render) continue;
712 if ((*apt = _pool_tex_alloc(pt, w, h, u, v)) != NULL)
713 {
714 gc->shared->tex.atlas[th2] =
715 eina_list_promote_list(gc->shared->tex.atlas[th2], l);
716 return pt;
717 }
718 }
719 pool_h = atlas_w;
720 if ( h > pool_h || w > atlas_w )
721 {
722 atlas_w = gc->shared->info.tune.atlas.max_w;
723 pool_h = gc->shared->info.tune.atlas.max_h;
724 }
725 pt = _pool_tex_render_new(gc, atlas_w, pool_h, intformat, format, EINA_FALSE);
726 if (!pt) return NULL;
727 gc->shared->tex.atlas[th2] =
728 eina_list_prepend(gc->shared->tex.atlas[th2], pt);
729 pt->fslot = th2;
730
731 *apt = _pool_tex_alloc(pt, w, h, u, v);
732
733 return pt;
734}
735
736static Evas_GL_Texture_Pool *
677_pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im) 737_pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im)
678{ 738{
679 Evas_GL_Texture_Pool *pt; 739 Evas_GL_Texture_Pool *pt;
@@ -983,7 +1043,7 @@ pt_unref(Evas_GL_Texture_Pool *pt)
983 pt->references--; 1043 pt->references--;
984 if (pt->references != 0) return; 1044 if (pt->references != 0) return;
985 1045
986 if ((pt->gc) && !((pt->render) || (pt->native))) 1046 if ((pt->gc) && !(pt->native))
987 { 1047 {
988 if (pt->whole) 1048 if (pt->whole)
989 pt->gc->shared->tex.whole = 1049 pt->gc->shared->tex.whole =
@@ -1055,6 +1115,37 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
1055} 1115}
1056 1116
1057Evas_GL_Texture * 1117Evas_GL_Texture *
1118evas_gl_common_texture_render_noscale_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha)
1119{
1120 Evas_GL_Texture *tex;
1121 int u = 0, v = 0;
1122 int lformat;
1123
1124 lformat = _evas_gl_texture_search_format(alpha, gc->shared->info.bgra, EVAS_COLORSPACE_ARGB8888);
1125 if (lformat < 0) return NULL;
1126
1127 tex = evas_gl_common_texture_alloc(gc, w, h, alpha);
1128 if (!tex) return NULL;
1129 tex->pt = _pool_tex_render_find(gc, w, h,
1130 *matching_format[lformat].intformat,
1131 *matching_format[lformat].format,
1132 &u, &v, &tex->apt,
1133 // XXX: should this be another atlas size?
1134 gc->shared->info.tune.atlas.max_alloc_size,
1135 EINA_FALSE);
1136 if (!tex->pt)
1137 {
1138 evas_gl_common_texture_light_free(tex);
1139 return NULL;
1140 }
1141 tex->x = u;
1142 tex->y = v;
1143
1144 tex->pt->references++;
1145 return tex;
1146}
1147
1148Evas_GL_Texture *
1058evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) 1149evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
1059{ 1150{
1060 Evas_GL_Texture *tex; 1151 Evas_GL_Texture *tex;
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index dcd66f79ad..4c5a168253 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -3106,10 +3106,30 @@ eng_image_surface_noscale_new(void *engdata, int w, int h, int alpha)
3106 3106
3107 re->window_use(re->software.ob); 3107 re->window_use(re->software.ob);
3108 gl_context = re->window_gl_context_get(re->software.ob); 3108 gl_context = re->window_gl_context_get(re->software.ob);
3109 // XXX: FIXME: need a special surface new func that can use an atlas 3109 return evas_gl_common_image_surface_noscale_new(gl_context, w, h, alpha);
3110 return evas_gl_common_image_surface_new(gl_context, w, h, alpha);
3111} 3110}
3112 3111
3112static void
3113eng_image_surface_noscale_region_get(void *engdata, void *image, int *x, int *y, int *w, int *h)
3114{
3115 Evas_GL_Image *im = image;
3116
3117 if (im)
3118 {
3119 *x = im->tex->x;
3120 *y = im->tex->y;
3121 *w = im->w;
3122 *h = im->h;
3123 return;
3124 }
3125 else
3126 {
3127 *x = 0;
3128 *y = 0;
3129 *w = 0;
3130 *h = 0;
3131 }
3132}
3113 3133
3114static int 3134static int
3115module_open(Evas_Module *em) 3135module_open(Evas_Module *em)
@@ -3198,6 +3218,7 @@ module_open(Evas_Module *em)
3198 3218
3199 ORD(image_prepare); 3219 ORD(image_prepare);
3200 ORD(image_surface_noscale_new); 3220 ORD(image_surface_noscale_new);
3221 ORD(image_surface_noscale_region_get);
3201 3222
3202 ORD(font_cache_flush); 3223 ORD(font_cache_flush);
3203 ORD(font_cache_set); 3224 ORD(font_cache_set);
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 674c93eac9..69536aecf0 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -1956,6 +1956,28 @@ eng_image_surface_noscale_new(void *engdata, int w, int h, int alpha)
1956} 1956}
1957 1957
1958static void 1958static void
1959eng_image_surface_noscale_region_get(void *engdata, void *image, int *x, int *y, int *w, int *h)
1960{
1961 RGBA_Image *im = image;
1962
1963 if (im)
1964 {
1965 *x = 0;
1966 *y = 0;
1967 *w = im->cache_entry.w;
1968 *h = im->cache_entry.h;
1969 return;
1970 }
1971 else
1972 {
1973 *x = 0;
1974 *y = 0;
1975 *w = 0;
1976 *h = 0;
1977 }
1978}
1979
1980static void
1959_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in, 1981_image_flip_horizontal(DATA32 *pixels_out, const DATA32 *pixels_in,
1960 int iw, int ih) 1982 int iw, int ih)
1961{ 1983{
@@ -4669,6 +4691,7 @@ static Evas_Func func =
4669 eng_image_data_slice_add, 4691 eng_image_data_slice_add,
4670 eng_image_prepare, 4692 eng_image_prepare,
4671 eng_image_surface_noscale_new, 4693 eng_image_surface_noscale_new,
4694 eng_image_surface_noscale_region_get,
4672 eng_image_native_init, 4695 eng_image_native_init,
4673 eng_image_native_shutdown, 4696 eng_image_native_shutdown,
4674 eng_image_native_set, 4697 eng_image_native_set,