diff options
Diffstat (limited to 'src/libmemdraw')
-rw-r--r-- | src/libmemdraw/alloc-stub.c | 1 | ||||
-rw-r--r-- | src/libmemdraw/alloc.c | 2 | ||||
-rw-r--r-- | src/libmemdraw/arctest.c | 3 | ||||
-rw-r--r-- | src/libmemdraw/draw-stub.c | 3 | ||||
-rw-r--r-- | src/libmemdraw/draw.c | 67 | ||||
-rw-r--r-- | src/libmemdraw/drawtest.c | 14 | ||||
-rw-r--r-- | src/libmemdraw/ellipse.c | 20 | ||||
-rw-r--r-- | src/libmemdraw/fill-stub.c | 1 | ||||
-rw-r--r-- | src/libmemdraw/hwdraw.c | 1 | ||||
-rw-r--r-- | src/libmemdraw/iprint.c | 1 | ||||
-rw-r--r-- | src/libmemdraw/load-stub.c | 1 |
11 files changed, 53 insertions, 61 deletions
diff --git a/src/libmemdraw/alloc-stub.c b/src/libmemdraw/alloc-stub.c index 2c92f6fe..ea4d1198 100644 --- a/src/libmemdraw/alloc-stub.c +++ b/src/libmemdraw/alloc-stub.c @@ -14,4 +14,3 @@ freememimage(Memimage *m) { _freememimage(m); } - diff --git a/src/libmemdraw/alloc.c b/src/libmemdraw/alloc.c index fa23b5e0..af7f6d43 100644 --- a/src/libmemdraw/alloc.c +++ b/src/libmemdraw/alloc.c @@ -47,7 +47,7 @@ allocmemimaged(Rectangle r, u32int chan, Memdata *md, void *X) i->X = X; i->data = md; i->zero = sizeof(u32int)*l*r.min.y; - + if(r.min.x >= 0) i->zero += (r.min.x*d)/8; else diff --git a/src/libmemdraw/arctest.c b/src/libmemdraw/arctest.c index b3a8c211..ad7fc326 100644 --- a/src/libmemdraw/arctest.c +++ b/src/libmemdraw/arctest.c @@ -47,7 +47,7 @@ rdb(void) int iprint(char *fmt, ...) { - int n; + int n; va_list va; char buf[1024]; @@ -58,4 +58,3 @@ iprint(char *fmt, ...) write(1,buf,n); return 1; } - diff --git a/src/libmemdraw/draw-stub.c b/src/libmemdraw/draw-stub.c index 08e46a1c..be411011 100644 --- a/src/libmemdraw/draw-stub.c +++ b/src/libmemdraw/draw-stub.c @@ -7,7 +7,7 @@ void memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, Memimage *mask, Point mp, int op) { Memdrawparam *par; - + if((par = _memimagedrawsetup(dst, r, src, sp, mask, mp, op)) == nil) return; _memimagedraw(par); @@ -24,4 +24,3 @@ pixelbits(Memimage *m, Point p) { return _pixelbits(m, p); } - diff --git a/src/libmemdraw/draw.c b/src/libmemdraw/draw.c index 4b988586..4075023e 100644 --- a/src/libmemdraw/draw.c +++ b/src/libmemdraw/draw.c @@ -65,7 +65,7 @@ memimageinit(void) mktables(); _memmkcmap(); - fmtinstall('R', Rfmt); + fmtinstall('R', Rfmt); fmtinstall('P', Pfmt); fmtinstall('b', __ifmt); @@ -166,7 +166,7 @@ void _memimagedraw(Memdrawparam *par) { /* - * Now that we've clipped the parameters down to be consistent, we + * Now that we've clipped the parameters down to be consistent, we * simply try sub-drawing routines in order until we find one that was able * to handle us. If the sub-drawing routine returns zero, it means it was * unable to satisfy the request, so we do not return. @@ -215,7 +215,7 @@ DBG print("alphadraw handled\n"); #undef DBG /* - * Clip the destination rectangle further based on the properties of the + * Clip the destination rectangle further based on the properties of the * source and mask rectangles. Once the destination rectangle is properly * clipped, adjust the source and mask rectangles to be the same size. * Then if source or mask is replicated, move its clipped rectangle @@ -343,7 +343,7 @@ static int replmul[1+8] = { a _ _ X _ _ X _ _ X _ _ X _ _ X _, a _ _ _ X _ _ _ X _ _ _ X _ _ _ X, a _ _ _ _ X _ _ _ _ X _ _ _ _ X _, - a _ _ _ _ _ X _ _ _ _ _ X _ _ _ _, + a _ _ _ _ _ X _ _ _ _ _ X _ _ _ _, a _ _ _ _ _ _ X _ _ _ _ _ _ X _ _, a _ _ _ _ _ _ _ X _ _ _ _ _ _ _ X, }; @@ -355,7 +355,7 @@ static void mktables(void) { int i, j, mask, sh, small; - + if(tablesbuilt) return; @@ -421,7 +421,7 @@ enum { /* giant rathole to customize functions with */ struct Param { Readfn *replcall; - Readfn *greymaskcall; + Readfn *greymaskcall; Readfn *convreadcall; Writefn *convwritecall; @@ -468,7 +468,7 @@ static Writefn* writefn(Memimage*); static Calcfn* boolcopyfn(Memimage*, Memimage*); static Readfn* convfn(Memimage*, Param*, Memimage*, Param*); -static Calcfn *alphacalc[Ncomp] = +static Calcfn *alphacalc[Ncomp] = { alphacalc0, /* Clear */ alphacalc14, /* DoutS */ @@ -570,14 +570,14 @@ dumpbuf(char *s, Buffer b, int n) { int i; uchar *p; - + print("%s", s); for(i=0; i<n; i++){ print(" "); if(p=b.grey){ print(" k%.2uX", *p); b.grey += b.delta; - }else{ + }else{ if(p=b.red){ print(" r%.2uX", *p); b.red += b.delta; @@ -607,7 +607,7 @@ dumpbuf(char *s, Buffer b, int n) * If the destination image is grey and the source is not, it is converted using the NTSC * formula. * - * Once we have all the channels, we call either rgbcalc or greycalc, depending on + * Once we have all the channels, we call either rgbcalc or greycalc, depending on * whether the destination image is color. This is allowed to overwrite the dst buffer (perhaps * the actual data, perhaps a copy) with its result. It should only overwrite the dst buffer * with the same format (i.e. red bytes with red bytes, etc.) A new buffer is returned from @@ -637,7 +637,7 @@ alphadraw(Memdrawparam *par) ndrawbuf = 0; src = par->src; - mask = par->mask; + mask = par->mask; dst = par->dst; sr = par->sr; mr = par->mr; @@ -646,7 +646,7 @@ alphadraw(Memdrawparam *par) isgrey = dst->flags&Fgrey; /* - * Buffering when src and dst are the same bitmap is sufficient but not + * Buffering when src and dst are the same bitmap is sufficient but not * necessary. There are stronger conditions we could use. We could * check to see if the rectangles intersect, and if simply moving in the * correct y direction can avoid the need to buffer. @@ -807,7 +807,7 @@ static int chanmatch(Buffer *bdst, Buffer *bsrc) { uchar *drgb, *srgb; - + /* * first, r, g, b must be in the same place * in the rgba word. @@ -818,7 +818,7 @@ chanmatch(Buffer *bdst, Buffer *bsrc) || bdst->blu - drgb != bsrc->blu - srgb || bdst->grn - drgb != bsrc->grn - srgb) return 0; - + /* * that implies alpha is in the same place, * if it is there at all (it might be == &ones). @@ -827,7 +827,7 @@ chanmatch(Buffer *bdst, Buffer *bsrc) */ if(bdst->alpha == &ones) return 1; - + /* * if the destination is not ones but the src is, * then the simultaneous calculation will use @@ -835,7 +835,7 @@ chanmatch(Buffer *bdst, Buffer *bsrc) */ if(bsrc->alpha == &ones) return 0; - + /* * otherwise, alphas are in the same place. */ @@ -1526,7 +1526,7 @@ writecmap(Param *p, uchar *w, Buffer src) int i, dx, delta; cmap = p->img->cmap->rgb2cmap; - + delta = src.delta; red= src.red; grn = src.grn; @@ -1615,7 +1615,7 @@ readbyte(Param *p, uchar *buf, int y) if(r == end) r = begin; } - + b.alpha = copyalpha ? buf : &ones; b.rgba = (u32int*)buf; if(alphaonly){ @@ -1868,7 +1868,7 @@ genconv(Param *p, uchar *buf, int y) b.blu = b.grn = b.grey = b.alpha = nil; b.rgba = (u32int*)buf; b.delta = 0; - + return b; } @@ -2050,12 +2050,12 @@ _imgtorgba(Memimage *img, u32int val) case CMap: p = img->cmap->cmap2rgb+3*ov; r = *p++; - g = *p++; + g = *p++; b = *p; break; } } - return (r<<24)|(g<<16)|(b<<8)|a; + return (r<<24)|(g<<16)|(b<<8)|a; } u32int @@ -2148,14 +2148,14 @@ DBG print("sdval %lud, depth %d\n", v, dst->depth); dx -= (ppb-np); nb = 8 - np * dst->depth; /* no. bits used on right side of word */ lm = (1<<nb)-1; -DBG print("np %d x %d nb %d lm %ux ppb %d m %ux\n", np, par->r.min.x, nb, lm, ppb, m); +DBG print("np %d x %d nb %d lm %ux ppb %d m %ux\n", np, par->r.min.x, nb, lm, ppb, m); /* right edge */ np = par->r.max.x&m; /* no. pixels used on left side of word */ dx -= np; nb = 8 - np * dst->depth; /* no. bits unused on right side of word */ rm = ~((1<<nb)-1); -DBG print("np %d x %d nb %d rm %ux ppb %d m %ux\n", np, par->r.max.x, nb, rm, ppb, m); +DBG print("np %d x %d nb %d rm %ux ppb %d m %ux\n", np, par->r.max.x, nb, rm, ppb, m); DBG print("dx %d Dx %d\n", dx, Dx(par->r)); /* lm, rm are masks that are 1 where we should touch the bits */ @@ -2230,7 +2230,7 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", * the source is not replicated, memmove suffices. */ m = Simplemask|Fullmask; - if((par->state&(m|Replsrc))==m && src->depth >= 8 + if((par->state&(m|Replsrc))==m && src->depth >= 8 && src->chan == dst->chan && !(src->flags&Falpha) && (op == S || op == SoverD)){ uchar *sp, *dp; long swid, dwid, nb; @@ -2262,8 +2262,8 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", * they're all bit aligned, we can just use bit operators. This happens * when we're manipulating boolean masks, e.g. in the arc code. */ - if((par->state&(Simplemask|Simplesrc|Replmask|Replsrc))==0 - && dst->chan==GREY1 && src->chan==GREY1 && par->mask->chan==GREY1 + if((par->state&(Simplemask|Simplesrc|Replmask|Replsrc))==0 + && dst->chan==GREY1 && src->chan==GREY1 && par->mask->chan==GREY1 && (par->r.min.x&7)==(par->sr.min.x&7) && (par->r.min.x&7)==(par->mr.min.x&7)){ uchar *sp, *dp, *mp; uchar lm, rm; @@ -2352,7 +2352,7 @@ DBG print("dp=%p; dx=%d; for(y=0; y<%d; y++, dp+=%d)\nmemsets(dp, v, dx);\n", } return 1; } - return 0; + return 0; } #undef DBG @@ -2382,7 +2382,7 @@ chardraw(Memdrawparam *par) } gcc_black_box; if(0) if(drawdebug) iprint("chardraw? mf %lux md %d sf %lux dxs %d dys %d dd %d ddat %p sdat %p\n", - par->mask->flags, par->mask->depth, par->src->flags, + par->mask->flags, par->mask->depth, par->src->flags, Dx(par->src->r), Dy(par->src->r), par->dst->depth, par->dst->data, par->src->data); mask = par->mask; @@ -2417,7 +2417,7 @@ DBG print("bsh %d\n", bsh); * for loop counts from bsh to bsh+dx * * we want the bottom bits to be the amount - * to shift the pixels down, so for n≡0 (mod 8) we want + * to shift the pixels down, so for n≡0 (mod 8) we want * bottom bits 7. for n≡1, 6, etc. * the bits come from -n-1. */ @@ -2496,8 +2496,8 @@ DBG iprint("bits %lux sh %d...", bits, i); } } -DBG print("\n"); - return 1; +DBG print("\n"); + return 1; } #undef DBG @@ -2518,13 +2518,13 @@ membyteval(Memimage *src) bpp = src->depth; uc <<= (src->r.min.x&(7/src->depth))*src->depth; uc &= ~(0xFF>>bpp); - * pixel value is now in high part of byte. repeat throughout byte + * pixel value is now in high part of byte. repeat throughout byte val = uc; for(i=bpp; i<8; i<<=1) val |= val>>i; return val; } - * + * */ void @@ -2555,4 +2555,3 @@ _memfillcolor(Memimage *i, u32int val) break; } } - diff --git a/src/libmemdraw/drawtest.c b/src/libmemdraw/drawtest.c index 07cda45d..fb883d4e 100644 --- a/src/libmemdraw/drawtest.c +++ b/src/libmemdraw/drawtest.c @@ -57,7 +57,7 @@ rdb(void) int iprint(char *fmt, ...) { - int n; + int n; va_list va; char buf[1024]; @@ -362,7 +362,7 @@ fill(Memimage *img, uchar *ucbits) } img->data->bdata = data; } - + } /* @@ -391,7 +391,7 @@ verifyonemask(void) drawonepixel(dst, dp, src, sp, mask, mp); memmove(mask->data->bdata, maskbits, mask->width*sizeof(u32int)*Yrange); memmove(savedstbits, dst->data->bdata, dst->width*sizeof(u32int)*Yrange); - + memmove(dst->data->bdata, dstbits, dst->width*sizeof(u32int)*Yrange); memimagedraw(dst, Rect(dp.x, dp.y, dp.x+1, dp.y+1), src, sp, mask, mp, SoverD); memmove(mask->data->bdata, maskbits, mask->width*sizeof(u32int)*Yrange); @@ -606,7 +606,7 @@ replicate(Memimage *i, Memimage *tmp) else r.max.y = r.min.y+3 + nrand(Yrange-(r.min.y+3)); } - assert(r.min.x >= 0); + assert(r.min.x >= 0); assert(r.max.x <= Xrange); assert(r.min.y >= 0); assert(r.max.y <= Yrange); @@ -871,7 +871,7 @@ getmask(Memimage *img, Point pt) #define DBG if(0) /* * Write a pixel to img at point pt. - * + * * We do this by reading a 32-bit little endian * value from p and then writing it back * after tweaking the appropriate bits. Because @@ -896,7 +896,7 @@ DBG print("v %.8lux...", v); /* * Sub-byte greyscale pixels. We need to skip the leftmost pt.x%npack pixels, * which is equivalent to skipping the rightmost npack - pt.x%npack - 1 pixels. - */ + */ npack = 8/bpp; sh = bpp*(npack - pt.x%npack - 1); bits = RGB2K(r,g,b); @@ -959,7 +959,7 @@ DBG print("v %.8lux\n", v); p[0] = v; p[1] = v>>8; p[2] = v>>16; - p[3] = v>>24; + p[3] = v>>24; } #undef DBG diff --git a/src/libmemdraw/ellipse.c b/src/libmemdraw/ellipse.c index 7dc45cd6..a467c248 100644 --- a/src/libmemdraw/ellipse.c +++ b/src/libmemdraw/ellipse.c @@ -83,24 +83,24 @@ step(State *s) while(s->x < s->a) { if(s->ee+s->b2x <= s->c1 || /* e(x+1,y-1/2) <= 0 */ s->ee+s->a2y <= s->c2) { /* e(x+1/2,y) <= 0 (rare) */ - s->dxe += s->d2xe; - s->ee += s->dxe; + s->dxe += s->d2xe; + s->ee += s->dxe; s->b2x += s->b2; - s->x++; + s->x++; continue; } - s->dye += s->d2ye; - s->ee += s->dye; + s->dye += s->d2ye; + s->ee += s->dye; s->a2y -= s->a2; if(s->ee-s->a2y <= s->c2) { /* e(x+1/2,y-1) <= 0 */ - s->dxe += s->d2xe; - s->ee += s->dxe; + s->dxe += s->d2xe; + s->ee += s->dxe; s->b2x += s->b2; return s->x++; } break; } - return s->x; + return s->x; } void @@ -132,7 +132,7 @@ memellipse(Memimage *dst, Point c, int a, int b, int t, Memimage *src, Point sp, if(t < 0) { inb = -1; newstate(&out, a, y = b); - } else { + } else { inb = b - t; newstate(&out, a+t, y = b+t); } @@ -229,7 +229,7 @@ epoint(int x, int y, Param *p) memdraw(p->dst, r, p->src, addpt(p->sp, r.min), p->disc, p->disc->r.min, p->op); } -/* +/* * a brushed horizontal or vertical line similarly specified */ static diff --git a/src/libmemdraw/fill-stub.c b/src/libmemdraw/fill-stub.c index d75459f1..37d2635b 100644 --- a/src/libmemdraw/fill-stub.c +++ b/src/libmemdraw/fill-stub.c @@ -8,4 +8,3 @@ memfillcolor(Memimage *m, u32int val) { _memfillcolor(m, val); } - diff --git a/src/libmemdraw/hwdraw.c b/src/libmemdraw/hwdraw.c index 3f36250f..59f63be2 100644 --- a/src/libmemdraw/hwdraw.c +++ b/src/libmemdraw/hwdraw.c @@ -9,4 +9,3 @@ hwdraw(Memdrawparam *p) USED(p); return 0; /* could not satisfy request */ } - diff --git a/src/libmemdraw/iprint.c b/src/libmemdraw/iprint.c index 923b6b44..5243970b 100644 --- a/src/libmemdraw/iprint.c +++ b/src/libmemdraw/iprint.c @@ -9,4 +9,3 @@ iprint(char *fmt,...) USED(fmt); return -1; } - diff --git a/src/libmemdraw/load-stub.c b/src/libmemdraw/load-stub.c index b0d5fcee..7cca3a6f 100644 --- a/src/libmemdraw/load-stub.c +++ b/src/libmemdraw/load-stub.c @@ -8,4 +8,3 @@ loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) { return _loadmemimage(i, r, data, ndata); } - |