Blob Blame History Raw
diff -Nur tuxpaint-0.9.28-sdl2/Makefile tuxpaint-0.9.28-3-sdl2/Makefile
--- tuxpaint-0.9.28-sdl2/Makefile	2022-06-04 16:47:11.000000000 +0900
+++ tuxpaint-0.9.28-3-sdl2/Makefile	2022-12-23 20:23:10.274301500 +0900
@@ -291,6 +291,7 @@
 
 # SDL Pango is needed to render complex scripts like Thai and Arabic
 SDL2_PANGO_LIB:=$(call linktest,SDL2_Pango,-lSDL2_Pango,$(SDL_LIBS))
+SDL2_PANGO_CFLAGS:=$(shell $(PKG_CONFIG) --cflags SDL2_Pango)
 NOPANGOFLAG:=$(if $(SDL2_PANGO_LIB),,-DNO_SDLPANGO$(warning -lSDL2_Pango failed, no scripts for you!))
 
 SDL_LIBS+=$(SDL_MIXER_LIB) $(SDL2_PANGO_LIB)
@@ -338,6 +339,7 @@
 	-Waggregate-return \
 	-Wstrict-prototypes -Wmissing-prototypes \
 	$(shell src/test-option.sh -Wstrict-aliasing=2) \
+    $(SDL2_PANGO_CFLAGS) \
 	$(ARCH_CFLAGS)
 
 DEFS:=-DVER_DATE=\"$(VER_DATE)\" -DVER_VERSION=\"$(VER_VERSION)\" \
diff -Nur tuxpaint-0.9.28-sdl2/src/fill.c tuxpaint-0.9.28-3-sdl2/src/fill.c
--- tuxpaint-0.9.28-sdl2/src/fill.c	2022-06-04 16:47:11.000000000 +0900
+++ tuxpaint-0.9.28-3-sdl2/src/fill.c	2022-12-23 20:33:47.800144800 +0900
@@ -559,16 +559,22 @@
 
 void draw_brush_fill_single(SDL_Surface * canvas, int x, int y, Uint32 draw_color, Uint8 * touched) {
   int xx, yy;
+  int pix;
 
   for (yy = -16; yy < 16; yy++)
     {
       for (xx = -16; xx < 16; xx++)
         {
-          if ((xx * xx) + (yy * yy) < (16 * 16) &&
-              touched[((y + yy) * canvas->w) + (x + xx)])
-            {
-              putpixels[canvas->format->BytesPerPixel] (canvas, x + xx, y + yy, draw_color);
-            }
+	  pix = ((y + yy) * canvas->w) + (x + xx);
+	  
+	  if (pix >= 0 && pix < canvas->w * canvas->h)
+	    {
+	      if ((xx * xx) + (yy * yy) < (16 * 16) && touched[pix])
+		{
+		  putpixels[canvas->format->BytesPerPixel] (canvas, x + xx, y + yy,
+							    draw_color);
+		}
+	    }
         }
     }
 }
@@ -659,6 +665,7 @@
 ) {
   Uint32 old_colr, new_colr;
   int xx, yy;
+  int pix;
   float xd, yd, dist, rad, ratio;
   Uint8 draw_r, draw_g, draw_b, old_r, old_g, old_b, new_r, new_g, new_b;
 
@@ -675,31 +682,46 @@
 
   /* Traverse the flood-filled zone */
   for (yy = y_top; yy <= y_bottom; yy++) {
-    for (xx = x_left; xx <= x_right; xx++) {
+    for (xx = x_left; xx <= x_right; xx++)
+    {
       /* Only alter the pixels within the flood itself */
-      if (touched[(yy * canvas->w) + xx]) {
-        /* Determine the distance from the click point */
-        xd = fabs((float) (xx - x));
-        yd = fabs((float) (yy - y));
-        dist = sqrt(xd * xd + yd * yd);
-        if (dist < rad) {
-          ratio = (dist / rad);
-
-          /* Get the old color, and blend it (with a distance-based ratio) with the target color */
-          old_colr = getpixels[canvas->format->BytesPerPixel] (canvas, xx, yy);
-          SDL_GetRGB(old_colr, canvas->format, &old_r, &old_g, &old_b);
-
-          /* Apply fuzziness at any antialiased edges we detected */
-          ratio = (ratio * ((float) touched[yy * canvas->w + xx] / 255.0));
-
-          new_r = (Uint8) (((float) old_r) * ratio + ((float) draw_r * (1.00 - ratio)));
-          new_g = (Uint8) (((float) old_g) * ratio + ((float) draw_g * (1.00 - ratio)));
-          new_b = (Uint8) (((float) old_b) * ratio + ((float) draw_b * (1.00 - ratio)));
+      pix = (yy * canvas->w) + xx;
 
-          new_colr = SDL_MapRGB(canvas->format, new_r, new_g, new_b);
-          putpixels[canvas->format->BytesPerPixel] (canvas, xx, yy, new_colr);
+      if (pix >= 0 && pix < canvas->w * canvas->h)
+	{
+          if (touched[pix])
+          {
+            /* Determine the distance from the click point */
+            xd = fabs((float) (xx - x));
+            yd = fabs((float) (yy - y));
+            dist = sqrt(xd * xd + yd * yd);
+            if (dist < rad)
+	    {
+              ratio = (dist / rad);
+
+              /* Get the old color, and blend it (with a distance-based ratio) with the target color */
+              old_colr =
+                getpixels[canvas->format->BytesPerPixel] (canvas, xx, yy);
+              SDL_GetRGB(old_colr, canvas->format, &old_r, &old_g, &old_b);
+
+              /* Apply fuzziness at any antialiased edges we detected */
+              ratio = (ratio * ((float) touched[pix] / 255.0));
+
+              new_r =
+                (Uint8) (((float) old_r) * ratio +
+                         ((float) draw_r * (1.00 - ratio)));
+              new_g =
+                (Uint8) (((float) old_g) * ratio +
+                         ((float) draw_g * (1.00 - ratio)));
+              new_b =
+                (Uint8) (((float) old_b) * ratio +
+                         ((float) draw_b * (1.00 - ratio)));
+
+              new_colr = SDL_MapRGB(canvas->format, new_r, new_g, new_b);
+              putpixels[canvas->format->BytesPerPixel] (canvas, xx, yy, new_colr);
+            }
+          }
         }
-      }
     }
   }
 }
diff -Nur tuxpaint-0.9.28-sdl2/src/tuxpaint.c tuxpaint-0.9.28-3-sdl2/src/tuxpaint.c
--- tuxpaint-0.9.28-sdl2/src/tuxpaint.c	2022-06-04 16:47:11.000000000 +0900
+++ tuxpaint-0.9.28-3-sdl2/src/tuxpaint.c	2022-12-23 20:26:04.783451000 +0900
@@ -27559,6 +27559,7 @@
 #endif
 
       renderer = SDL_CreateRenderer(window_screen, -1, 0);
+      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
 
       if (native_screensize)
         {
@@ -27574,7 +27575,6 @@
               window_scale_w = 501.f / ww;
               window_scale_h = 481.f / hh;
 
-	      SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
               if (window_scale_w > window_scale_h)
                 {
                   /* Keep things squared */