[SDL] Help to increase performance in SDL_ttf marquee program.
David Olofson
david at olofson.net
Wed Mar 31 12:24:38 PDT 2010
On Wednesday 31 March 2010, at 20.55.57, Ricardo Leite
<ricleitepessoal at gmail.com> wrote:
> ANSI C language, Linux Slackware 13.
>
> The FPS on my program is 28 frames per second in:
>
> Linux Slackware 13 - kernel 2.6.29.6
> Language: ANSI C
> Compiller: gcc v 4.3.3
> Lib: SDL version 1.2.13
> CPU Intel atom 1.6Ghz
> 1Gb ram
>
> CPU use is:25%
Wait... Is that a multicore Atom (I have a dual core on my desk, so at least I
know they exist ;-), or does this mean rendering is hardware accelerated?
Of course, retrace sync'ed flips could pull the CPU use below 100%, but unless
you're at one frame per refresh (as in "full frame rate"), you won't be going
much below 100% before you switch to the next "notch" and get a higher frame
rate.
Anyway, one advanced trick you might want to try is partial (or "smart")
updates. Quite tricky stuff indeed, but if you have a fixed framerate and a
fixed scrolling speed, you might get away with turning the 'text' surface into
a "mask" that just contains "scroll step size" wide edges around the letters,
and then transparent pixels. (Transparency will be optimized out by the RLE,
both from memory and blit operations.) You blit as usual, but without clearing
the screen, and what happens is that the left and right edges of the letters
move, while the solid colored areas in between are untouched. This should
reduce the bandwidth requirements to a fraction of what you have now.
--
//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 |
'---------------------------------------------------------------------'
More information about the SDL
mailing list