opensource

SDL_gfx

2009-10-11: SDL_gfx (-y) zoom bug fix
This patch was created against version SDL_gfx-2.0.20 - download patch.


While trying out the SDL_gfx project, I was running battery of tests to checkout the features. A very good project. There's even parts that have accellerated MMX assember code for some good old fashion speed ups.

As awesome as the project was, there was a teeny tiny bug while testing the some basic zoom x-axis and y-axis functionality.

Zoom Table
zoomXzoomY
11
-11
1-1
-1-1

It was when zoomY is negative, SDL_gfx crashed.
Looking it through the debugger, it stopped at:

SDL_gfx-2.0.20 :: SDL_rotozoom.c :: line 230

The line:

	if (flipy) csp += (src->pitch*(src->h-1));

needed to be changed to:

	if (flipy) csp += ((src->pitch/sizeof(tColorRGBA))*(src->h-1));

The negative y zoom calculations were using the sizeof( struct tColorRGBA ) offsets instead of basic address offsets -- i.e. (char*).

The bug fix was submitted to project maintainer Andreas Schiffler.


Copyright © 2009 by Nick Shin. All Rights Reserved.
These pages are designed by ESTSS.