>> P.S. Anybody got clean code to do a 1bpp unaligned blit?
KP> There are plenty of examples in the fb code; do you need something more
KP> targeted?
Yep. If you look at my previous patch, you'll find the code that I've
appended to this message. It has two bitmaps, both of which are 1bpp
MSBFirst. The source is
bitmap->buffer of stride bitmap->pitch of size bitmap->{width, rows}
at 0, 0
and the destination
raster of stride bpr of size wd by ht
at dx, dy
Most of the time dx=dy=0; in the remaining cases, dx=0 about half of
the time. The blit is not a performance bottleneck, but the code I'm
using is unbearably ugly at demonstrates my utmost incompetence with
everything even remotely graphics-related. If you've got something
clean and short (even if it's not particularly fast) that you could
share with me, I'm a taker.
Juliusz
if(dx == 0 && dy == 0 && bpr == bitmap->pitch) {
memcpy(raster, bitmap->buffer, bitmap->rows * bitmap->pitch);
} else if(dx == 0) {
for(i = MAX(0, -dy); i < bitmap->rows && i + dy < ht; i++)
memcpy(raster + (i + dy) * bpr,
bitmap->buffer + i * bitmap->pitch,
bitmap->pitch);
} else {
int dx8;
if(dx % 8 == 0)
dx8 = 0;
else if(dx >= 0)
dx8 = dx % 8;
else
dx8 = dx % 8 + 8;
for(i = MAX(0, -dy); i < bitmap->rows && i + dy < ht; i++)
for(j = MAX(0, -dx); j < bitmap->width && j + dx < wd; j++) {
raster[(i + dy) * bpr + (j + dx) / 8] |=
((bitmap->buffer[i * bitmap->pitch + j / 8] &
(0x80 >> (j % 8)))) >>
((j % 8 + dx8 < 8)?dx8:(8 - dx8));
}
}
_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts