aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/evas/engines/gl_common/evas_gl_font.c
diff options
context:
space:
mode:
authorAli Alzyod <ali198724@gmail.com>2018-12-17 08:28:52 +0000
committerDerek Foreman <derek.foreman.samsung@gmail.com>2019-01-10 13:05:17 -0600
commitf78ef852daf80944b4e399be60e8bec3910b8046 (patch)
tree12d94a9e3bc1f3a4176932629500f1d417396305 /src/modules/evas/engines/gl_common/evas_gl_font.c
parentevas: remove memory leaks from deleted Textblock objects (diff)
downloadefl-f78ef852daf80944b4e399be60e8bec3910b8046.tar.gz
optimize glyph images data copy into 4 byte aligned images
Differential Revision: https://phab.enlightenment.org/D7461
Diffstat (limited to 'src/modules/evas/engines/gl_common/evas_gl_font.c')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_font.c26
1 files changed, 14 insertions, 12 deletions
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 2e2c5263a9..3d5d436448 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_font.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_font.c
@@ -5,7 +5,7 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
{
Evas_Engine_GL_Context *gc = context;
Evas_GL_Texture *tex;
- int w, h, j, nw, fh, x, y;
+ int w, h, j, nw, fh, y;
DATA8 *ndata, *data, *p1, *p2;
if (fg->ext_dat) return fg->ext_dat; // FIXME: one engine at a time can do this :(
@@ -22,19 +22,21 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
// expand to 32bit (4 byte) aligned rows for texture upload
nw = ((w + 3) / 4) * 4;
- ndata = alloca(nw *h);
- if (!ndata) return NULL;
- for (y = 0; y < h; y++)
- {
+ // if image already (4 byte) aligned rows then assign old image data to new data(ndata) to
+ if(nw == w){
+ ndata = data;
+ } else {
+ ndata = alloca(nw *h);
+ if (!ndata) return NULL;
+ // else copy row by row
+ for (y = 0; y < h; y++)
+ {
p1 = data + (j * y);
p2 = ndata + (nw * y);
- for (x = 0; x < w; x++)
- {
- *p2 = *p1;
- p1++;
- p2++;
- }
- }
+ memcpy(p2,p1,w);
+ }
+ }
+
fh = fg->fi->max_h;
tex = evas_gl_common_texture_alpha_new(gc, ndata, w, h, fh);
if (!tex) goto done;