PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

CGapiApplication::CreateSurfaces

I understand reasoning behind CGapiApplication::CreateSurfaces but I wonder if it would not be better to change CGapiSurface to be a ref counted class.
Basically ,internally , this class would be aware of every object of its kind ever created in the current application and consequently would be able to apply orientation changes automatically.
If there is a compelling reason for excluding certain surfaces from the automated management, it would be easy to manage that by introducing an internal flag or something like that .

Perhaps I am missing something here .. but I think that would be a better solution over all.

Walter
Hi Walter,

The reasons for not using ref counting are many. In fact, the PocketFrog SDK previously used ref counting and rotated all surfaces when alignment was changed, but this feature was removed in a later release.

Hmm.. Where to begin.. Like:
(1) In most cases you don't just want to rotate the surface. What you actually want is to re-create it. Examples are GUIs that use dynamic positioning due to the screen size (which changes when rotating).
(2) There are lots of surfaces that does not need to be rotated. Like the back buffer and all temp buffers. When hardware accelerated masked blits are introduced you will most probably use lots of surfaces you don't want to rotate.
(3) ... Can't remember more right now but there were additional reasons.

So. Basically. You have 3 types of surfaces (probably more): dynamically created, temporary surfaces and static surfaces - the simplest variant (sprites and backgrounds). Of these three the only one that would benefit from "auto rotation" is the static surface. So you would have to set this "don't rotate" flag on LOT's of surfaces.

/Johan