summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-04-01 09:58:05 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-04-01 09:59:49 +0900
commit740995e089c3318585875ed000490426e22bfc11 (patch)
tree8e30e4cc53266ad78d2fde3a354f2372cc9e83e5
parent32009a0e8c7b9b9c563614be8b832db99cd17112 (diff)
Evas GL generic: Simplify "scaled" images (used for masking)
Invert the meaning of scaled (w,h), so that im->(w,h) corresponds to the final scaled size, and the original size is stored directly in the texture itself. This simplifies code a little bit. Also, lift the limitation on the maximum texture size, as those virtual textures are not limited by GPU texture size.
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h1
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_font.c18
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c37
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_rectangle.c14
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c12
5 files changed, 19 insertions, 63 deletions
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 4556093532..fe111834e6 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -619,7 +619,6 @@ struct _Evas_GL_Image
619 619
620 struct { 620 struct {
621 Evas_GL_Image *origin; 621 Evas_GL_Image *origin;
622 int w, h;
623 Eina_Bool smooth : 1; 622 Eina_Bool smooth : 1;
624 } scaled; 623 } scaled;
625 624
diff --git a/src/modules/evas/engines/gl_common/evas_gl_font.c b/src/modules/evas/engines/gl_common/evas_gl_font.c
index 95ac669f50..f7001fbe64 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_font.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_font.c
@@ -85,19 +85,11 @@ evas_gl_font_texture_draw(void *context, void *surface EINA_UNUSED, void *draw_c
85 if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h) 85 if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
86 { 86 {
87 // canvas coords 87 // canvas coords
88 mx = dc->clip.mask_x; 88 mx = gc->dc->clip.mask_x;
89 my = dc->clip.mask_y; 89 my = gc->dc->clip.mask_y;
90 if (mask->scaled.origin) 90 mw = mask->w;
91 { 91 mh = mask->h;
92 mw = mask->scaled.w; 92 mask_smooth = mask->scaled.smooth;
93 mh = mask->scaled.h;
94 mask_smooth = mask->scaled.smooth;
95 }
96 else
97 {
98 mw = mask->w;
99 mh = mask->h;
100 }
101 } 93 }
102 else mtex = NULL; 94 else mtex = NULL;
103 95
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 24b156bc8c..1541afd881 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -960,24 +960,11 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
960 if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h) 960 if (mtex && mtex->pt && mtex->pt->w && mtex->pt->h)
961 { 961 {
962 // canvas coords 962 // canvas coords
963 mx = dc->clip.mask_x; 963 mx = gc->dc->clip.mask_x;
964 my = dc->clip.mask_y; 964 my = gc->dc->clip.mask_y;
965 if (mask->scaled.origin) 965 mw = mask->w;
966 { 966 mh = mask->h;
967 mw = mask->scaled.w; 967 mask_smooth = mask->scaled.smooth;
968 mh = mask->scaled.h;
969 //scalex = mask->w / (double)mask->scaled.w;
970 //scaley = mask->h / (double)mask->scaled.h;
971 mask_smooth = mask->scaled.smooth;
972 }
973 else
974 {
975 mw = mask->w;
976 mh = mask->h;
977 }
978 //if (c) RECTS_CLIP_TO_RECT(mx, my, mw, mh, cx, cy, cw, ch);
979 //mx = mx - dc->clip.mask_x;
980 //my = my - dc->clip.mask_y;
981 } 968 }
982 else mtex = NULL; 969 else mtex = NULL;
983 970
@@ -1016,17 +1003,9 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1016 // canvas coords 1003 // canvas coords
1017 mx = gc->dc->clip.mask_x; 1004 mx = gc->dc->clip.mask_x;
1018 my = gc->dc->clip.mask_y; 1005 my = gc->dc->clip.mask_y;
1019 if (mask->scaled.origin) 1006 mw = mask->w;
1020 { 1007 mh = mask->h;
1021 mw = mask->scaled.w; 1008 mask_smooth = mask->scaled.smooth;
1022 mh = mask->scaled.h;
1023 mask_smooth = mask->scaled.smooth;
1024 }
1025 else
1026 {
1027 mw = mask->w;
1028 mh = mask->h;
1029 }
1030 } 1009 }
1031 else mtex = NULL; 1010 else mtex = NULL;
1032 1011
diff --git a/src/modules/evas/engines/gl_common/evas_gl_rectangle.c b/src/modules/evas/engines/gl_common/evas_gl_rectangle.c
index c13252aac4..d0042c9264 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_rectangle.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_rectangle.c
@@ -35,17 +35,9 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
35 // canvas coords 35 // canvas coords
36 mx = gc->dc->clip.mask_x; 36 mx = gc->dc->clip.mask_x;
37 my = gc->dc->clip.mask_y; 37 my = gc->dc->clip.mask_y;
38 if (mask->scaled.origin) 38 mw = mask->w;
39 { 39 mh = mask->h;
40 mw = mask->scaled.w; 40 mask_smooth = mask->scaled.smooth;
41 mh = mask->scaled.h;
42 mask_smooth = mask->scaled.smooth;
43 }
44 else
45 {
46 mw = mask->w;
47 mh = mask->h;
48 }
49 } 41 }
50 else mtex = NULL; 42 else mtex = NULL;
51 43
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 627e5c0477..dac9232c5f 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -989,12 +989,8 @@ eng_image_scaled_update(void *data EINA_UNUSED, void *scaled, void *image,
989 if (!src) return NULL; 989 if (!src) return NULL;
990 990
991 gc = src->gc; 991 gc = src->gc;
992 if ((dst_w > gc->shared->info.max_texture_size) ||
993 (dst_h > gc->shared->info.max_texture_size))
994 return NULL;
995
996 if (dst && (dst->scaled.origin == src) && 992 if (dst && (dst->scaled.origin == src) &&
997 (dst->scaled.w == dst_w) && (dst->scaled.h == dst_h)) 993 (dst->w == dst_w) && (dst->h == dst_h))
998 return dst; 994 return dst;
999 995
1000 if (dst) 996 if (dst)
@@ -1020,16 +1016,14 @@ eng_image_scaled_update(void *data EINA_UNUSED, void *scaled, void *image,
1020 dst->gc = gc; 1016 dst->gc = gc;
1021 dst->cs.space = src->cs.space; 1017 dst->cs.space = src->cs.space;
1022 dst->alpha = alpha; 1018 dst->alpha = alpha;
1023 dst->w = src->w; 1019 dst->w = dst_w;
1024 dst->h = src->h; 1020 dst->h = dst_h;
1025 dst->tex = src->tex; 1021 dst->tex = src->tex;
1026 dst->tex->references++; 1022 dst->tex->references++;
1027 dst->tex_only = 1; 1023 dst->tex_only = 1;
1028 1024
1029 if (!reffed) src->references++; 1025 if (!reffed) src->references++;
1030 dst->scaled.origin = src; 1026 dst->scaled.origin = src;
1031 dst->scaled.w = dst_w;
1032 dst->scaled.h = dst_h;
1033 dst->scaled.smooth = smooth; 1027 dst->scaled.smooth = smooth;
1034 1028
1035 return dst; 1029 return dst;