This bug may be related to bug 1841123.
As I wrote in the developer mailing list, I noticed that when in 15 bpp mode, the grass and calligraphy magic tools did not work at all.
This bug is caused by plugin api struct that passes getpixel/putpixel function pointer with the color depth of the display canvas, but if this depth is different from the depth of the images used by the plugins (grass_brush and the like) then the bug appears.
I solved this bug with a dirty hack in grass.c:
then in do_grass use getpixel32:
SDL_GetRGBA(getpixel32(img_grass, xx + src.x, yy + src.y),img_grass->format, &r, &g, &b, &a);
magic makefile must be changed to:
@echo "Building Grass magic tool"
@$(CC) $(CFLAGS) -shared -o $@ $< $(PLUGIN_LIBS) ../obj/pixels.o
The best solution IMHO would be to write a getpixel/putpixel generic function that calls the right getpixelXX function depending on the color depth of the surface that must be processed.
Log in to post a comment.