Re: [AD] clipping line algorithm |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Robert Jr Ohannessian wrote:
My basic question is: should we allow the user to bypass the vtable?
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.
- 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.
And I don't think it is difficult to support.
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? In any case, that's a different discussion, I'll reply on
the discussion on how to improve the current API for low-level variants
of getpixel/putpixel.
[snip]
particular situation where it is really significantly bad? As long as
we have a version that uses the vtable, and BITMAP->id is able to
indicate when the optimized version can be used instead, I think we
should be fine?
I like the idea, if only because people could check the ID before using
bmp_read/write on a bitmap.
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.
But I really don't mind which way we implement it, as long as it does
the job.
Sven