Re: [AD] clipping line algorithm |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> We break the rule in rotate.c, the function
> _parallelogram_map_standard().
Hmm... yes, you're right, this is unfortunate.
> OK, after looking up the definition of
> is_linear_bitmap() in include/allegro/inline/gfx.inl, I think I
> understand the problem: any bitmaps that Allegro knows about are either
> linear or planar, so there is only one flag for bmp->id that says which
> of them holds (the flag is called BMP_ID_PLANAR).
This semantics sounds very DOS-ish. Moreover, the "linear" qualifier is used
in a broad acceptation since banked SVGA modes are "linear" for Allegro. It
really means "which can be accessed linearly within each scanline".
I commited the attached patch to clarify the meaning of "linear".
> But an add-on may provide a bitmap type that is not planar (so it would not
> be correct to set the flag) but does not support _putpixel (so it would not
> be correct for is_linear_bitmap() to return true).
Yes, I think this could be the case for AllegroGL.
Bob, does the screen bitmap of AllegroGL support linear access within each
scanline? If no, do you set BMP_ID_PLANAR for it?
> Here's a suggestion to fix this: Introduce a new flag for bmp->id, say
> BMP_ID_LINEAR. Allegro must set this flag if and only if it does not set
> BMP_ID_PLANAR. Add-ons that create non-planar non-linear bitmaps must set
> neither flag. Seems OK?
Unfortunately, I think this would break datafile compatibility, because
bitmaps loaded from old datafiles would not satisfy is_linear_bitmap().
--
Eric Botcazou
Index: docs/src/allegro._tx
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/allegro._tx,v
retrieving revision 1.178
diff -u -r1.178 allegro._tx
--- docs/src/allegro._tx 8 Sep 2003 20:34:20 -0000 1.178
+++ docs/src/allegro._tx 17 Sep 2003 11:20:06 -0000
@@ -3416,15 +3416,19 @@
the pointers are equal, one is a sub-bitmap of the other, or they are
both sub-bitmaps of a common parent.
-@domain.hid @is_linear_bitmap(BITMAP *bmp);
-@domain.hid is_planar_bitmap, is_memory_bitmap
- Returns TRUE if bmp is a linear bitmap, ie. a memory bitmap, mode 13h
- screen, or SVGA screen. Linear bitmaps can be used with the _putpixel(),
- _getpixel(), bmp_write_line(), and bmp_read_line() functions.
-
@@int @is_planar_bitmap(BITMAP *bmp);
@xref is_linear_bitmap, is_memory_bitmap
Returns TRUE if bmp is a planar (mode-X or Xtended mode) screen bitmap.
+
+@@int @is_linear_bitmap(BITMAP *bmp);
+@xref is_planar_bitmap, is_memory_bitmap
+ Returns TRUE if bmp is a linear bitmap, i.e. a bitmap that can be accessed
+ linearly within each scanline (for example a memory bitmap, the DOS VGA
+ or SVGA screen, Windows bitmaps, etc). Linear bitmaps can be used with the
+ _putpixel(), _getpixel(), bmp_write_line(), and bmp_read_line() functions.
+
+ Historically there were only linear and planar bitmaps for Allegro, so
+ is_linear_bitmap is actually an alias for !is_planar_bitmap.
@@int @is_memory_bitmap(BITMAP *bmp);
@xref is_linear_bitmap, is_planar_bitmap