#include <string.h>
#include "pixman-private.h"
#include "pixman-combine32.h"
-#define FbFullMask(n) ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1))
-
-#undef READ
-#undef WRITE
-#define READ(img,x) (*(x))
-#define WRITE(img,ptr,v) ((*(ptr)) = (v))
+#define FbFullMask(n) \
+ ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1))
static force_inline uint32_t
fbOver (uint32_t src, uint32_t dest)
w = width;
while (w--)
{
- m = READ(pMask, mask++);
+ m = *mask++;
if (m)
{
- s = READ(pSrc, src) | 0xff000000;
+ s = *src | 0xff000000;
if (m == 0xff)
- WRITE(pDst, dst, s);
+ *dst = s;
else
{
d = fbIn (s, m);
- WRITE(pDst, dst, fbOver (d, READ(pDst, dst)));
+ *dst = fbOver (d, *dst);
}
}
src++;
while (w--)
{
- m = READ(pMask, mask++);
+ m = *mask++;
if (m == 0xff)
{
if (srca == 0xff)
- WRITE(pDst, dst, src & dstMask);
+ *dst = src & dstMask;
else
- WRITE(pDst, dst, fbOver (src, READ(pDst, dst)) & dstMask);
+ *dst = fbOver (src, *dst) & dstMask;
}
else if (m)
{
d = fbIn (src, m);
- WRITE(pDst, dst, fbOver (d, READ(pDst, dst)) & dstMask);
+ *dst = fbOver (d, *dst) & dstMask;
}
dst++;
}
while (w--)
{
- ma = READ(pMask, mask++);
+ ma = *mask++;
if (ma == 0xffffffff)
{
if (srca == 0xff)
- WRITE(pDst, dst, src & dstMask);
+ *dst = src & dstMask;
else
- WRITE(pDst, dst, fbOver (src, READ(pDst, dst)) & dstMask);
+ *dst = fbOver (src, *dst) & dstMask;
}
else if (ma)
{
- d = READ(pDst, dst);
+ d = *dst;
#define FbInOverC(src,srca,msk,dst,i,result) { \
uint16_t __a = FbGet8(msk,i); \
uint32_t __t, __ta; \
FbInOverC (src, srca, ma, d, 8, n);
FbInOverC (src, srca, ma, d, 16, o);
FbInOverC (src, srca, ma, d, 24, p);
- WRITE(pDst, dst, m|n|o|p);
+ *dst = m|n|o|p;
}
dst++;
}
while (w--)
{
- m = READ(pMask, mask++);
+ m = *mask++;
if (m == 0xff)
{
if (srca == 0xff)
while (w--)
{
- m = READ(pMask, mask++);
+ m = *mask++;
if (m == 0xff)
{
if (srca == 0xff)
d = src;
else
{
- d = READ(pDst, dst);
+ d = *dst;
d = fbOver24 (src, cvt0565to0888(d));
}
- WRITE(pDst, dst, cvt8888to0565(d));
+ *dst = cvt8888to0565(d);
}
else if (m)
{
- d = READ(pDst, dst);
+ d = *dst;
d = fbOver24 (fbIn(src,m), cvt0565to0888(d));
- WRITE(pDst, dst, cvt8888to0565(d));
+ *dst = cvt8888to0565(d);
}
dst++;
}
while (w--)
{
- ma = READ(pMask, mask++);
+ ma = *mask++;
if (ma == 0xffffffff)
{
if (srca == 0xff)
{
- WRITE(pDst, dst, src16);
+ *dst = src16;
}
else
{
- d = READ(pDst, dst);
+ d = *dst;
d = fbOver24 (src, cvt0565to0888(d));
- WRITE(pDst, dst, cvt8888to0565(d));
+ *dst = cvt8888to0565(d);
}
}
else if (ma)
{
- d = READ(pDst, dst);
+ d = *dst;
d = cvt0565to0888(d);
FbInOverC (src, srca, ma, d, 0, m);
FbInOverC (src, srca, ma, d, 8, n);
FbInOverC (src, srca, ma, d, 16, o);
d = m|n|o;
- WRITE(pDst, dst, cvt8888to0565(d));
+ *dst = cvt8888to0565(d);
}
dst++;
}
while (w--)
{
- s = READ(pSrc, src++);
+ s = *src++;
a = s >> 24;
if (a == 0xff)
- WRITE(pDst, dst, s & dstMask);
+ *dst = s & dstMask;
else if (s)
- WRITE(pDst, dst, fbOver (s, READ(pDst, dst)) & dstMask);
+ *dst = fbOver (s, *dst) & dstMask;
dst++;
}
}
while (w--)
{
- s = READ(pSrc, src++);
+ s = *src++;
a = s >> 24;
if (a)
{
while (w--)
{
- s = READ(pSrc, src++);
+ s = *src++;
a = s >> 24;
if (s)
{
d = s;
else
{
- d = READ(pDst, dst);
+ d = *dst;
d = fbOver24 (s, cvt0565to0888(d));
}
- WRITE(pDst, dst, cvt8888to0565(d));
+ *dst = cvt8888to0565(d);
}
dst++;
}
while (w--)
{
- s = READ(pSrc, src++);
- WRITE(pDst, dst, cvt8888to0565(s));
+ s = *src++;
+ *dst = cvt8888to0565(s);
dst++;
}
}
while (w--)
{
- s = READ(pSrc, src++);
+ s = *src++;
if (s)
{
if (s != 0xff)
{
- d = READ(pDst, dst);
+ d = *dst;
t = d + s;
s = t | (0 - (t >> 8));
}
- WRITE(pDst, dst, s);
+ *dst = s;
}
dst++;
}
while (w--)
{
- s = READ(pSrc, src++);
+ s = *src++;
if (s)
{
if (s != 0xffffffff)
{
- d = READ(pDst, dst);
+ d = *dst;
if (d)
{
m = FbAdd(s,d,0,t);
s = m|n|o|p;
}
}
- WRITE(pDst, dst, s);
+ *dst = s;
}
dst++;
}
uint32_t m, d;
uint32_t r;
- a = READ(pMask, mask++);
- d = READ(pDst, dst);
+ a = *mask++;
+ d = *dst;
m = FbInU (sa, 0, a, tmp);
r = FbAdd (m, d, 0, tmp);
- WRITE(pDst, dst++, r);
+ *dst++ = r;
}
}
}
if (inside_bounds) {
//XXX: we should move this multiplication out of the loop
- result = READ(pSrc, src + y * srcStride + x);
+ result = *(src + y * srcStride + x);
} else {
result = 0;
}
- WRITE(pDst, dst + i, result);
+ *(dst + i) = result;
/* adjust the x location by a unit vector in the x direction:
* this is equivalent to transforming x+1 of the destination point to source space */