# HG changeset patch # User arpi # Date 1029515743 0 # Node ID ef9f4c1a3345d7038de8e29990469c93f4c32189 # Parent d27dd694e5eaccea9233feb64ee696cb1a20a1ff using precalculated src*om[][] table -> 25% faster. diff -r d27dd694e5ea -r ef9f4c1a3345 TOOLS/subfont-c/subfont.c --- a/TOOLS/subfont-c/subfont.c Fri Aug 16 16:06:02 2002 +0000 +++ b/TOOLS/subfont-c/subfont.c Fri Aug 16 16:35:43 2002 +0000 @@ -503,9 +503,10 @@ unsigned char *t, int width, int height, - int *m, + unsigned char *m, int r, - int mwidth) { + int mwidth, + int msize) { int x, y; #if 1 @@ -525,7 +526,8 @@ const int x2=(x+r>=width ) ? r+width -x : 2*r+1; const int y2=(y+r>=height) ? r+height-y : 2*r+1; register unsigned char *dstp= t + (y1+y-r)* width + x-r; - register int *mp = m + y1 *mwidth; + //register int *mp = m + y1 *mwidth; + register unsigned char *mp= m + msize*src + y1*mwidth; int my; for(my= y1; my>8; - if(dstp[mx] < tmp) dstp[mx]= tmp; +// const int tmp= (src*mp[mx] + 128)>>8; +// if(dstp[mx] < tmp) dstp[mx]= tmp; + if(dstp[mx] < mp[mx]) dstp[mx]= mp[mx]; } dstp+=width; mp+=mwidth; @@ -681,6 +684,7 @@ int const o_r = ceil(thickness); int const g_w = 2*g_r+1; // matrix size int const o_w = 2*o_r+1; // matrix size + int const o_size = o_w * o_w; double const A = log(1.0/base)/(radius*radius*2); int mx, my, i; @@ -688,7 +692,10 @@ unsigned *g = (unsigned*)malloc(g_w * sizeof(unsigned)); unsigned *om = (unsigned*)malloc(o_w*o_w * sizeof(unsigned)); - if (g==NULL || om==NULL) ERROR("malloc failed."); + unsigned char *omt = malloc(o_size*256); + unsigned char *omtp = omt; + + if (g==NULL || om==NULL || omt==NULL) ERROR("malloc failed."); // gaussian curve for (i = 0; i