Re: [AD] List of sub bitmaps

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


On Thu May 10, 2012, Elias Pschernig wrote:
> On Thu, May 10, 2012 at 7:08 AM, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> > Is there any reason why bitmaps can't have a list of their child bitmaps?
> > My use case is, I need to update a bitmap, changing it's texture when
> > Android tabs away and back. I didn't notice this before but sub bitmaps
> > have their own "extra" member, so even though the bitmap pointer stays
> > the same, the sub bitmaps are out of date because extra->texture doesn't
> > get updated.
> 
> The reason is that Allegro itself never needs it. (The automatic
> texture restoration and bitmap conversion both already work with
> sub-bitmaps.)
> 
> This doesn't mean there is a reason not to add it though. What did you
> think the API should look like? Something like below?
> 
> ALLEGRO_BITMAP *bitmap = al_get_first_sub_bitmap(parent);
> while (bitmap) {
>     update_bitmap(bitmap);
>     bitmap = al_get_next_sub_bitmap(bitmap);
> }
> 
> Also, what exactly do you mean with extra->texture doesn't get
> updated? My impression is you are not supposed to access internals
> like that - so maybe we can change something else which makes this
> whole use case unnecessary? I.e. I'm not really sure what exactly you
> mean with "I need to update a bitmap".

It sounds like if the extra struct isn't updated, then it doesn't properly 
restore sub bitmaps.

> ---------------------------------------------------------------------------
> --- Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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