summaryrefslogtreecommitdiff
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
parent9201fc5a65368a40234977c3c176a806655afea2 (diff)
optimize glyph images data copy into 4 byte aligned images
Differential Revision: https://phab.enlightenment.org/D7461
Diffstat (limited to '')
-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)
5{ 5{
6 Evas_Engine_GL_Context *gc = context; 6 Evas_Engine_GL_Context *gc = context;
7 Evas_GL_Texture *tex; 7 Evas_GL_Texture *tex;
8 int w, h, j, nw, fh, x, y; 8 int w, h, j, nw, fh, y;
9 DATA8 *ndata, *data, *p1, *p2; 9 DATA8 *ndata, *data, *p1, *p2;
10 10
11 if (fg->ext_dat) return fg->ext_dat; // FIXME: one engine at a time can do this :( 11 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)
22 22
23 // expand to 32bit (4 byte) aligned rows for texture upload 23 // expand to 32bit (4 byte) aligned rows for texture upload
24 nw = ((w + 3) / 4) * 4; 24 nw = ((w + 3) / 4) * 4;
25 ndata = alloca(nw *h); 25 // if image already (4 byte) aligned rows then assign old image data to new data(ndata) to
26 if (!ndata) return NULL; 26 if(nw == w){
27 for (y = 0; y < h; y++) 27 ndata = data;
28 { 28 } else {
29 ndata = alloca(nw *h);
30 if (!ndata) return NULL;
31 // else copy row by row
32 for (y = 0; y < h; y++)
33 {
29 p1 = data + (j * y); 34 p1 = data + (j * y);
30 p2 = ndata + (nw * y); 35 p2 = ndata + (nw * y);
31 for (x = 0; x < w; x++) 36 memcpy(p2,p1,w);
32 { 37 }
33 *p2 = *p1; 38 }
34 p1++; 39
35 p2++;
36 }
37 }
38 fh = fg->fi->max_h; 40 fh = fg->fi->max_h;
39 tex = evas_gl_common_texture_alpha_new(gc, ndata, w, h, fh); 41 tex = evas_gl_common_texture_alpha_new(gc, ndata, w, h, fh);
40 if (!tex) goto done; 42 if (!tex) goto done;