Re: [AD] clipping line algorithm |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Sven Sandberg wrote:
[snip]
I think we should, for the following reasons:
- Backwards compatibility. bmp_read* and bmp_write* have been around
forever, and it would be a pity to break programs using them.
I agree.
- Speed. Since we don't implement all possible functionality in
Allegro, some of it has to be in add-ons, in user's programs, or in
generic modules somewhere inbetween the two. Those would benefit from
the additional speed of direct access rather than going through the vtable.
I disagree. bmp_* is fine to use on your normal Allegro bitmap. However,
when it comes to odd bitmap types (modex, OpenGL, ...) bmp_* fails
miserably in the speed department.
If not, then it doesn't matter, because all the Allegro API functions
should route to some bitmap's vtable.
This is not how it works at the moment: polygon(),
[scene_]polygon3d[_f](), draw_gouraud_sprite(), floodfill(), arc(),
spline(), rect() and others are all outside the vtable (see
include/allegro/gfx.h). Are you suggesting to move all such functions to
the vtable?
Yes, but that's a discussion for another thread.
Good! So how should this be implemented? I gave two suggestions, both
based on flags in BITMAP->id, and you suggest a BITMAP->caps bitfield
with the same functionality. Pros and cons in my opinion:
- BITMAP->id seems like the easiest-to-implement solution. That's how
it is currently done.
- BITMAP->caps seems a bit more extendible in case we stumble on
anything else that a bitmap needs to be queried for. BITMAP->id also has
the drawback that the lowest bits (those not used by a flag) are used as
an integer, to identify sub-bitmaps.
We should move all the flags from BITMAP->id to BITMAP->flags
(attributes of the bitmap) and BITMAP->caps (what can be done with it).
I don't think we'll be breaking source compatibility, appart perhaps for
some add-ons.
We should get rid of the flags-in-id thing. It's bug-prone and very
limiting. flags and caps could even be placed into the vtable, so we
don't even need more memory for them.
--
- Robert Jr Ohannessian
http://bob.allegronetwork.com/