"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Graphics/Bitmap_fonts/glyph_shrink.cpp" between
TeXmacs-1.99.4-src.tar.gz and TeXmacs-1.99.5-src.tar.gz

About: GNU TeXmacs is a what-you-see-is-what-you-get scientific text editor, which was both inspired by TeX and GNU Emacs.

glyph_shrink.cpp  (TeXmacs-1.99.4-src):glyph_shrink.cpp  (TeXmacs-1.99.5-src)
skipping to change at line 182 skipping to change at line 182
int Y2= my_div (y2+yfactor-1, yfactor); int Y2= my_div (y2+yfactor-1, yfactor);
int frac_x= (dx- gl->xoff- X1*xfactor); int frac_x= (dx- gl->xoff- X1*xfactor);
int frac_y= (dy+ gl->yoff- Y1*yfactor); int frac_y= (dy+ gl->yoff- Y1*yfactor);
SI off_x = (((-X1) *xfactor+ dx)*PIXEL + ((tx*PIXEL)>>1))/xfactor; SI off_x = (((-X1) *xfactor+ dx)*PIXEL + ((tx*PIXEL)>>1))/xfactor;
SI off_y = (((Y2-1)*yfactor- dy)*PIXEL - ((ty*PIXEL)>>1))/yfactor; SI off_y = (((Y2-1)*yfactor- dy)*PIXEL - ((ty*PIXEL)>>1))/yfactor;
int i, j, x, y; int i, j, x, y;
int index, indey, entry; int index, indey, entry;
int ww=(X2-X1)*xfactor, hh=(Y2-Y1)*yfactor; int ww=(X2-X1)*xfactor, hh=(Y2-Y1)*yfactor;
STACK_NEW_ARRAY (bitmap, int, ww*hh); int* bitmap= tm_new_array<int> (ww*hh);
//STACK_NEW_ARRAY (bitmap, int, ww*hh);
for (i=0; i<ww*hh; i++) bitmap[i]=0; for (i=0; i<ww*hh; i++) bitmap[i]=0;
for (y=0, index= ww*frac_y+ frac_x; y<gl->height; y++, index-=ww) for (y=0, index= ww*frac_y+ frac_x; y<gl->height; y++, index-=ww)
for (x=0; x<gl->width; x++) for (x=0; x<gl->width; x++)
if (gl->get_1(x,y)) if (gl->get_1(x,y))
for (j=0, indey=ww*ty; j<=ty; j++, indey-=ww) { for (j=0, indey=ww*ty; j<=ty; j++, indey-=ww) {
entry = index+indey+x; entry = index+indey+x;
for (i=0; i<=tx; i++, entry++) for (i=0; i<=tx; i++, entry++)
bitmap[entry]= 1; bitmap[entry]= 1;
} }
skipping to change at line 210 skipping to change at line 211
sum=0; sum=0;
indey= ((Y-Y1)*ww+ (X-X1))*xfactor; indey= ((Y-Y1)*ww+ (X-X1))*xfactor;
for (j=0, index= indey; j<yfactor; j++, index+=ww) for (j=0, index= indey; j<yfactor; j++, index+=ww)
for (i=0; i<xfactor; i++) for (i=0; i<xfactor; i++)
sum += bitmap[index+ i]; sum += bitmap[index+ i];
if (nr >= 64) sum= (64 * sum) / nr; if (nr >= 64) sum= (64 * sum) / nr;
CB->set (X, Y, sum); CB->set (X, Y, sum);
} }
xo= off_x; xo= off_x;
yo= off_y; yo= off_y;
STACK_DELETE_ARRAY (bitmap); tm_delete_array (bitmap);
//STACK_DELETE_ARRAY (bitmap);
// cout << CB << "\n"; // cout << CB << "\n";
return CB; return CB;
} }
glyph glyph
shrink (glyph gl, int xfactor, int yfactor, SI& xo, SI& yo) { shrink (glyph gl, int xfactor, int yfactor, SI& xo, SI& yo) {
if ((gl->width==0) || (gl->height==0)) { if ((gl->width==0) || (gl->height==0)) {
int nr= xfactor*yfactor; int nr= xfactor*yfactor;
int new_depth= gl->depth+ log2i (nr); int new_depth= gl->depth+ log2i (nr);
return glyph (0, 0, 0, 0, new_depth); return glyph (0, 0, 0, 0, new_depth);
} }
int tx= xfactor/3; int tx= ((xfactor/3) * (retina_factor+1)) / 2;
int ty= yfactor/3; int ty= ((yfactor/3) * (retina_factor+1)) / 2;
int dx=0, dy=0; int dx=0, dy=0;
if ((gl->status==0) && (xfactor>1)) dx= get_hor_shift (gl, xfactor, tx); if ((gl->status==0) && (xfactor>1)) dx= get_hor_shift (gl, xfactor, tx);
// if ((gl->status==0) && (yfactor>1)) dy= get_ver_shift (gl, yfactor, ty); // if ((gl->status==0) && (yfactor>1)) dy= get_ver_shift (gl, yfactor, ty);
glyph ret= shrink (gl, xfactor, yfactor, dx, dy, tx, ty, xo, yo); glyph ret= shrink (gl, xfactor, yfactor, dx, dy, tx, ty, xo, yo);
#ifndef QTTEXMACS #ifndef QTTEXMACS
if (ret->status != 0) { if (ret->status != 0) {
if (ret->status&1) ret->adjust_top (); if (ret->status&1) ret->adjust_top ();
if (ret->status&2) ret->adjust_bot (); if (ret->status&2) ret->adjust_bot ();
ret->yoff= yo= 0; ret->yoff= yo= 0;
 End of changes. 3 change blocks. 
4 lines changed or deleted 6 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS