Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

Use SDL_HWSURFACE (or at least, use the same flag everywhere) #50

Closed
ghost opened this issue Aug 7, 2012 · 3 comments
Closed

Use SDL_HWSURFACE (or at least, use the same flag everywhere) #50

ghost opened this issue Aug 7, 2012 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 7, 2012

The OSX's port of solarus currently doesn't use Hardware Surface when blitting.

Moreover, there is some SDL_HWSURFACE and SDL_SWSURFACE flags hardcoded.
Is it better (and possible) to use the same flag everywhere by adding a definition in Common.h ?

If yes, maybe you can use SDL_SWSURFACE everywhere : most of players use fullscreen or stretched display, so there is pixel access at each frame.
Unless I'm wrong, accessing pixel with SDL and SDL_HWSURFACE option force to use processor for calculations, and then send the surface to graphic card again, so using this flag only make sense with the "normal" display.

To finish, there is a quote from SDL_SetVideoMode documentation :
"Many platforms can only provide a hardware surface when using SDL_FULLSCREEN"

@ghost
Copy link
Author

ghost commented Aug 18, 2012

At your opinion, what is the best way to provide VideoManager::surface_flags access inside Color and Surface class ?

I thought make them friend class or just add a getter, but I don't like both.
Include VideoManager just to read a constant value is not really ideal...

Can we define this flag directly in Common.h, or you don't want to handle lib-specific stuff in this file ?

@christopho
Copy link
Collaborator

If I understand correctly, Color and Surface should use SDL_SWSURFACE in all cases and for any OS.
Commit acb4242 should solve this issue. Color and Surface always use SDL_SWSURFACE now (no matter the OS).

And VideoManager sets its own flags depending on the SOLARUS_SCREEN_SOFTWARE_SURFACE preprocessor constant: surface flags is SDL_HWSURFACE | SDL_DOUBLEBUF or SDL_SWSURFACE.

Is this okay for you?

@ghost
Copy link
Author

ghost commented Aug 18, 2012

Yep :)

The big thing I wanted to point is mainly to use SDL_SWSURFACE on surfaces which are locked even once during loop turn.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant