Mail Archives: djgpp/1997/10/30/05:01:24
Alexey Kouzmitch writes:
>Are Allegro BITMAPs (memory ones) linear in nature...
Yes, if they are truly memory bitmaps (obtained by calling
create_bitmap()), they will always be linear. The only cases where
memory may not be contiguous from one line to the next is if you are
using a banked or mode-X screen bitmap, or a sub-bitmap structure. See
the "video memory access" section in the docs for details...
>The reason I'm asking is if it is, then 1 asm addresing mode can be
>used to get to any pixel, and if not, extra calculation is required!!!
Depends what you are doing. If you are coding routines for a fixed size
(eg. a 320x200 destination), it will indeed be slightly faster to
hardcode a few shift values. But if you want to support variable sized
images, the table of line pointers avoids the need for a multiply (you
can just lookup line[y], rather than having to multiply y*w), which is a
significant improvement. For that reason, I actually designed the bitmap
structure using those line tables right from the start, even though
Allegro 1.0 only supported a 320x200 screen mode: this made life
extremely easy when I later came to add the SVGA modes!
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.
- Raw text -