Re: [AD] power-of-two textures?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2008-02-11, Elias Pschernig <elias@xxxxxxxxxx> wrote:
> Change it to:
> 
> ALLEGRO_LOCKED_REGION *
> al_lock_bitmap_region(
> 	ALLEGRO_BITMAP *bitmap,
> 	int x,
> 	int y,
> 	int width,
> 	int height,
> 	int flags)
> void al_unlock_bitmap(ALLEGRO_LOCKED_REGION *region)
> 
> Then add a ->next pointer to ALLEGRO_LOCKED_REGION which contains
> additional regions in case the area overlapped several sub bitmaps. The
> API change is necessary so they can be allocated and freed again.
> 
> Since al_lock_bitmap_region is a very low level operation (you have to
> know the exact pixel format) I think this ->next pointer should not be a
> big problem.

It sounds pretty hard to use.  Perhaps it would be slightly easier if it
returned the subregions in a 2d array:

    struct ALLEGRO_LOCKED_REGION {
	int format;
	int subregions_x;
	int subregions_y;
	ALLEGRO_LOCKED_SUBREGION subregions[subregions_y][subregions_x];
    };

    struct ALLEGRO_LOCKED_SUBREGION {
	int top_left_x;
	int top_left_y;
	int width;
	int height;
	int pitch;
	void *data;
    };

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/