delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/30/05:01:24

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro BITMAPS
Date: Tue, 28 Oct 1997 19:42:57 +0000
Organization: None
Distribution: world
Message-ID: <ThoXsJABBkV0Ewh9@talula.demon.co.uk>
References: <01bce0ff$d4698a20$fb7806d1 AT arexey DOT gis DOT net>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019