[SDL] Help to increase performance in SDL_ttf marquee program.
ricleitepessoal at gmail.com
Wed Mar 31 11:43:50 PDT 2010
I will test this.
2010/3/31 David Olofson <david at olofson.net>
> On Wednesday 31 March 2010, at 19.37.06, Ricardo Leite
> <ricleitepessoal at gmail.com> wrote:
> > Friends,
> > My program that displays text messages is very slow and inefficient.
> > Please, help me with tips and tricks.
> First of all, what hardware, operating system and video subsystem are you
> using? The "correct" setup and methods for maximum performance depends a
> on that.
> For example, certain X servers (like XFree86 and X.org) have a fixed pixel
> format for the desktop, and that applies to all windows - often even in
> fullscreen mode. (XFree86 and X.org don't really have fullscreen modes, but
> rather zoom in on a "locked" window on the standard desktop.) So, if you
> a 16 or 32 bpp desktop, asking SDL for an 8 bpp display will result in you
> getting a software surface that is converted from 8 bpp to the desktop
> *on the fly*. Not very efficient...
> What you should probably do here is just ask for "0 bpp", that is, whatever
> the default is. Then you should use SDL_DisplayFormat() and
> SDL_DisplayFormatAlpha() to convert your source surfaces ('text' in your
> to formats suitable for fast blitting to whatever display surface you have
> hand. That is, you don't really have to care about the pixel format as long
> you're not doing pixel level software rendering.
> Also, very few video subsystems support windows with hardware surfaces
> requires specific hardware support to be practically useful in a desktop
> environment), and some don't even support it in fullscreen mode. Nothing
> have to worry about most of the time, but keep in mind that SDL_Flip() may
> actually be a full-screen shadow-to-display copy, rather than the classic
> (very low cost) flip of DMA pointers. This may be of great importance if
> application usually only changes a small area of the screen at a time.
> One thing that may be an absolute performance killer is alpha blending.
> really rather expensive in software - and even more so if your surface is
> "straight" as opposed to RLE accelerated! (See SDL_SetAlpha() and
> Try to use opaque surfaces first, then colorkeyed RLE accelerated, and if
> really need to, RLE accelerated RGBA surfaces. (You may increase the
> "contrast" on the alpha channel to eliminate pixels that are nearly opaque
> nearly transparent. It's the pixels that are actually blended that are
> expensive when you're using RLE! The opaque ones are just copied whereas
> transparent ones are skipped entirely.)
> Finally, SDL_FillRect() may not be all that much faster than
> SDL_BlitSurface(), so don't rely on it being fast just because it seems
> trivial... Unless you actually have a background image or something, it may
> better to make the 'text' surface opaque, so you don't have to clear the
> screen before blitting.
> //David Olofson - Developer, Artist, Open Source Advocate
> .--- Games, examples, libraries, scripting, sound, music, graphics ---.
> | http://olofson.net http://kobodeluxe.com http://audiality.org |
> | http://eel.olofson.net http://zeespace.net http://reologica.se |
> SDL mailing list
> SDL at lists.libsdl.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SDL