summaryrefslogtreecommitdiff
path: root/src/modules/evas/engines/gl_common
diff options
context:
space:
mode:
Diffstat (limited to '')
-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.c61
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c1
3 files changed, 63 insertions, 0 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 ef91f7b9d6..38474bbe35 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -688,6 +688,7 @@ void evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x,
688void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); 688void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
689void 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); 689void 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);
690void evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth); 690void evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
691Evas_GL_Image *evas_gl_common_image_surface_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im);
691 692
692void *evas_gl_font_texture_new(void *gc, RGBA_Font_Glyph *fg); 693void *evas_gl_font_texture_new(void *gc, RGBA_Font_Glyph *fg);
693void evas_gl_font_texture_free(void *); 694void evas_gl_font_texture_free(void *);
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 3b02db1406..de907be540 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -248,6 +248,8 @@ evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *
248 } 248 }
249 */ 249 */
250 250
251 if (error) *error = EVAS_LOAD_ERROR_NONE;
252
251 // FIXME: keep unreffed shared images around 253 // FIXME: keep unreffed shared images around
252 EINA_LIST_FOREACH(gc->shared->images, l, im) 254 EINA_LIST_FOREACH(gc->shared->images, l, im)
253 { 255 {
@@ -1039,6 +1041,65 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
1039 } 1041 }
1040} 1042}
1041 1043
1044Evas_GL_Image *
1045evas_gl_common_image_surface_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
1046{
1047 Evas_GL_Image *glim = NULL;
1048 Eina_Bool alpha;
1049 int w, h;
1050
1051 if (!gc || !im || !im->im || !im->im->image.data)
1052 goto fail;
1053
1054 if (im->im->cache_entry.space == EFL_GFX_COLORSPACE_ARGB8888)
1055 alpha = EINA_FALSE;
1056 else if (im->im->cache_entry.space == EFL_GFX_COLORSPACE_GRY8)
1057 alpha = EINA_TRUE;
1058 else goto fail;
1059
1060 w = im->im->cache_entry.w;
1061 h = im->im->cache_entry.h;
1062 glim = evas_gl_common_image_surface_new(gc, w, h, EINA_TRUE, EINA_FALSE);
1063 if (!glim) goto fail;
1064
1065 if (alpha)
1066 {
1067 RGBA_Image *image;
1068 uint32_t *rgba;
1069 uint8_t *gry8;
1070 int k;
1071
1072 image = evas_common_image_new(w, h, EINA_TRUE);
1073 if (!image) goto fail;
1074
1075 rgba = image->image.data;
1076 gry8 = im->im->image.data8;
1077 for (k = 0; k < (w * h); k++)
1078 {
1079 const int c = *gry8++;
1080 *rgba++ = ARGB_JOIN(c, c, c, c);
1081 }
1082
1083 glim->im = image;
1084 }
1085 else
1086 {
1087 evas_cache_image_ref(&im->im->cache_entry);
1088 glim->im = im->im;
1089 }
1090
1091 glim->dirty = EINA_TRUE;
1092 evas_gl_common_image_update(gc, glim);
1093 evas_gl_common_image_free(im);
1094
1095 return glim;
1096
1097fail:
1098 ERR("Failed to update surface pixels!");
1099 if (glim) evas_gl_common_image_free(glim);
1100 return NULL;
1101}
1102
1042void 1103void
1043evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, 1104evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1044 int npoints, RGBA_Map_Point *p, int smooth, int level EINA_UNUSED) 1105 int npoints, RGBA_Map_Point *p, int smooth, int level EINA_UNUSED)
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 f4d747e331..77c55f593b 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -82,6 +82,7 @@ static const struct {
82 { MATCH_FALSE, MATCH_FALSE, EVAS_COLORSPACE_ARGB8888, &rgb_ifmt, &rgb_fmt }, 82 { MATCH_FALSE, MATCH_FALSE, EVAS_COLORSPACE_ARGB8888, &rgb_ifmt, &rgb_fmt },
83#endif 83#endif
84 { MATCH_FALSE, MATCH_ANY, EVAS_COLORSPACE_GRY8, &lum_fmt, &lum_ifmt }, 84 { MATCH_FALSE, MATCH_ANY, EVAS_COLORSPACE_GRY8, &lum_fmt, &lum_ifmt },
85 { MATCH_TRUE, MATCH_ANY, EVAS_COLORSPACE_GRY8, &alpha_fmt, &alpha_ifmt },
85 { MATCH_TRUE, MATCH_ANY, EVAS_COLORSPACE_AGRY88, &lum_alpha_fmt, &lum_alpha_ifmt }, 86 { MATCH_TRUE, MATCH_ANY, EVAS_COLORSPACE_AGRY88, &lum_alpha_fmt, &lum_alpha_ifmt },
86 // ETC1/2 support 87 // ETC1/2 support
87 { MATCH_FALSE, MATCH_ANY, EVAS_COLORSPACE_ETC1, &etc1_fmt, &etc1_fmt }, 88 { MATCH_FALSE, MATCH_ANY, EVAS_COLORSPACE_ETC1, &etc1_fmt, &etc1_fmt },