Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
152 user(s) are online (124 user(s) are browsing Forums)

Members: 1
Guests: 151

Maijestro, more...

Headlines

 
  Register To Post  

Layers.library and OS4.1 compositing mode
Quite a regular
Quite a regular


See User information
Is there anything that one should know about things to avoid to do with Layers.library when OS 4.1 compositing mode is on ?
Now I'm new to Layers.library, I just want to be sure that following is legal :
- creating a compatible bitmap using p96AllocBitMap() from window->RPort->BitMap
- creating a NewLayerInfo()
- creating a behind layer calling CreateBehindLayer() and passing it the previously created bitmap and layer info,
- then extracting the rastport from this layer info
- using this rastport to do the graphics things (mainly BltBitMapRastPort())
- then extracting the layer from the rastport,
- using this extracted layer in InstallClipRegion( , NULL )
- deleting the layer using DeleteLayer()
- extracting the bitmap from the rastport and p96FreeBitMap()'ing it

Especially it's not clear what happens to the layer's rastport after the layer has passed through DeleteLayer() (as I'm trying to retrieve its bitmap after DeleteLayer())

Back to a quiet home... At last
Go to top
Re: Layers.library and OS4.1 compositing mode
Not too shy to talk
Not too shy to talk


See User information
@abalaban

DeleteLayer will free all memory allocated by Create#?Layer, so your RastPort will be gone and you must not access it any more.

The question is why you would need to extract the bitmap from the rastport although you already know it because you allocated it yourself ?

The same applies to extracting the layer from the rastport when you extracted the rastport from the layer just before. A little too much "extracting" for my taste.

And why do you InstallClipRegion(NULL) if you never did InstallClipRegion(anything) ?

Bye,
Thomas

Go to top
Re: Layers.library and OS4.1 compositing mode
Quite a regular
Quite a regular


See User information
@thomas

First this is not my code I'm trying to understand why it might crash...

Quote:
DeleteLayer will free all memory allocated by Create#?Layer, so your RastPort will be gone and you must not access it any more.


I feared this, can it be possible that such sort of things were possible with previous AOS memory allocator while it's not anymore in current AOS4's one ?

Quote:
The question is why you would need to extract the bitmap from the rastport although you already know it because you allocated it yourself ?


Because it's a port and the previous porter choosed to use the rastport as being the "handle" abstracted and carried along everywhere in the API. As such it is created in one function (the four first items), used in many other (symbolized by the fifth) , and deleted in another one (described by the four last items).

Quote:
The same applies to extracting the layer from the rastport when you extracted the rastport from the layer just before. A little too much "extracting" for my taste.


Same answer.

Quote:
And why do you InstallClipRegion(NULL) if you never did InstallClipRegion(anything) ?


Because I do but in another function. Anyway what nasty thing can it cause even if not clip were installed ?

Back to a quiet home... At last
Go to top
Re: Layers.library and OS4.1 compositing mode
Not too shy to talk
Not too shy to talk


See User information
@abalaban

Quote:
can it be possible that such sort of things were possible with previous AOS memory allocator while it's not anymore in current AOS4's one ?


At least in 3.x freed memory stayed in place until it was reused and could still be accessed, although it is illegal.



Quote:
and deleted in another one (described by the four last items).


Ok, but you could extract the pointers before you delete the layer.

APTR layer rp->Layer;
APTR bitmap rp->BitMap;
DeleteLayer (layer);
FreeBitMap (bitmap);




Quote:
Anyway what nasty thing can it cause even if not clip were installed ?


If the previous clip region was NULL, too, the InstallClipRegion(NULL) does not change anything, so it cannot do nasty things.

Bye,
Thomas

Go to top
Re: Layers.library and OS4.1 compositing mode
Quite a regular
Quite a regular


See User information
@thomas

Quote:
Ok, but you could extract the pointers before you delete the layer.

APTR layer rp->Layer;
APTR bitmap rp->BitMap;
DeleteLayer (layer);
FreeBitMap (bitmap);


Yes that's what I started to do but I wanted to knwo if with compositing mode on there can be restriction to what things we can access (i.e. layer->rastport, rastport->layer, rastport->bitmap, etc.) or things we must take care of (for example non constant bitmap for a given rastport, or such sort of things)

Thanks for your answer.

Back to a quiet home... At last
Go to top
Re: Layers.library and OS4.1 compositing mode
Just popping in
Just popping in


See User information
@abalaban

Also, remember that it's a bit dangerous to play with layers on an Intuition screen (except from the locking functions and a few others) because you may confuse Intuition input handler.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project