blitter dumb questions
1 Attachment(s)
I've written a blitter routine but I have issues with it.
- small objects aren't blitter properly. If width < 16 pixels it doesn't work. How to blit small objects (like 8x8 objects) ? Is it even possible? - shifting seems to work to some extent but with some images the end of the pic is drawn at the start (depending on the offset/shifting) 64: ok 70 & 72: shifted Picture is 80 pixels wide Attachment 65028 On other pictures it's OK. I don't know why on some it's okay and on some it's not. My C code is trying to emulate SDL blit routine (with amiga raw bitplane format instead of the chunky pixels struct) Code:
{ |
Hi jotd, from your code it doesn't seem you set a proper BLTAFWM and BLTALWM mask.
EDIT. And of course you need a one more word to blit if you shift :) |
1 Attachment(s)
thanks. I forgot to set lwm because asm code treats both registers together, in the C code you need 2 different moves. I've changed it
Code:
custom.bltafwm = 0xFFFF; Attachment 65038 |
You can't blit less than 16 bit wide, so your source data width needs to be an even number of bytes. Height is in lines, so 8 lines high is not a problem.
Pointers and modulos are in bytes, but bit 0 is ignored, i.e. they must be even. The shift effect you're experiencing is the data being shifted into the next word to the right, so you need to widen your blit by one word on the right-hand side to avoid it being shifted to the next line, or clip the blit using bltalwm, possibly using a smaller/negative source modulo to avoid having to widen your source data. |
1 Attachment(s)
with the same exact code, one image is okay the other has this buggy effect
80 wide: bad 168 wide: okay Attachment 65039 |
Maybe it looks OK because the last char (tm) has large enough blank area on its right side, and you can't see it on the very left.
Your blit doesn't fully take into account that you are shifting (one extra word needed), you have to adjust all modulos and size. Something like: img_width = 80 => blit_width = 96, moda = (80-96)/8, last_word_mask = 0, modd = 96/8 Unless your image is pre-resized to 96 (blank 16 pix on the right side), in which case moda can be 0 and last_word_mask can be $ffff. |
All times are GMT +2. The time now is 01:29. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.