On Tue, 2005-01-11 at 03:23, Bill Kendrick wrote:

> BUT... it was fun to write!  And hopefully not too messy of an implementation.
> :)

You might use a macro, either this:

#define getpixel(s,x,y) \
  (getpixel_fns[(s)->format->BytesPerPixel]((s),(x),(y)))

Or this:

#define DECL_PUTPIXEL(s) \
  void (*putpixel)(SDL_Surface *, int, int, Uint32) = \
putpixels[(s)->format->BytesPerPixel])

Maybe it would be less painful to just have a plain function
pointer, ensuring that all surfaces are in the screen format.
Add an assert() for BytesPerPixel being wrong, and you'll
see that very little is in any other format. Alternately,
leave the screen using a function pointer and have everything
else just use the 32-bit version.


_______________________________________________
Tuxpaint-dev mailing list
[email protected]
http://tux4kids.net/mailman/listinfo/tuxpaint-dev

Reply via email to