aboutsummaryrefslogtreecommitdiff
path: root/src/libmemdraw/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libmemdraw/draw.c')
-rw-r--r--src/libmemdraw/draw.c67
1 files changed, 33 insertions, 34 deletions
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;
}
}
-