* Fixed bug when zooming stamps in video depth other than 32bpp.

(Float to int casting; also removes compiler errors.)

* getpixel/putpixel function passed to Magic tools now pays attention
  to the incoming surface, rather than always using the canvas surface,
  to determine bitdepth.  (Fixes bug where some Magic tools, e.g., Grass,
  didn't work right on video depths other than 32bpp.)
This commit is contained in:
William Kendrick 2008-03-05 03:26:55 +00:00
parent f34d8301ff
commit 7b651c97b2
2 changed files with 25 additions and 5 deletions

View file

@ -52,6 +52,12 @@ $Id$
Pere Pujal i Carabantes <pere@fornol.no-ip.org>
* Fixed bug when zooming stamps in video depth other than 32bpp.
(Float to int casting; also removes compiler errors.)
* getpixel/putpixel function passed to Magic tools now pays attention
to the incoming surface, rather than always using the canvas surface,
to determine bitdepth. (Fixes bug where some Magic tools, e.g., Grass,
didn't work right on video depths other than 32bpp.)
2008.February.25 (0.9.19)

View file

@ -32,9 +32,9 @@
/* Color depth for Tux Paint to run in, and store canvases in: */
//#if defined(NOKIA_770)
# define VIDEO_BPP 15
//#endif
#if defined(NOKIA_770)
# define VIDEO_BPP 16
#endif
#if defined(OLPC_XO)
# define VIDEO_BPP 15
@ -574,6 +574,9 @@ static grid_dims gd_colors; // was 17x1
static int WINDOW_WIDTH, WINDOW_HEIGHT;
void magic_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel);
Uint32 magic_getpixel(SDL_Surface * surface, int x, int y);
static void setup_normal_screen_layout(void)
{
@ -16719,8 +16722,8 @@ void load_magic_plugins(void)
magic_api_struct[plc]->sRGB_to_linear = magic_sRGB_to_linear;
magic_api_struct[plc]->linear_to_sRGB = magic_linear_to_sRGB;
magic_api_struct[plc]->in_circle = in_circle_rad;
magic_api_struct[plc]->getpixel = getpixels[canvas->format->BytesPerPixel];
magic_api_struct[plc]->putpixel = putpixels[canvas->format->BytesPerPixel];
magic_api_struct[plc]->getpixel = magic_getpixel;
magic_api_struct[plc]->putpixel = magic_putpixel;
magic_api_struct[plc]->line = magic_line_func;
magic_api_struct[plc]->playsound = magic_playsound;
magic_api_struct[plc]->stopsound = magic_stopsound;
@ -18676,3 +18679,14 @@ int do_color_picker(void)
return(chose);
}
void magic_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
{
putpixels[surface->format->BytesPerPixel](surface, x, y, pixel);
}
Uint32 magic_getpixel(SDL_Surface * surface, int x, int y)
{
return(getpixels[surface->format->BytesPerPixel](surface, x, y));
}