Commit graph

2620 commits

Author SHA1 Message Date
Pere Pujal i Carabantes
6007479b0e Merge 'Limit check to avoid crash in flood Fill' form 'master' into sdl2.0 2021-11-21 11:36:48 +01:00
Bill Kendrick
81fff34795 Limit check to avoid crash in flood Fill
Reported by Shin-ichi, repaired by Pere.  Thanks!
2021-11-20 20:57:55 -08:00
Pere Pujal i Carabantes
2609446af1 Merge branch 'master' into sdl2.0
More work on Filling by Bill.
2021-11-20 12:00:25 +01:00
Pere Pujal i Carabantes
705c557f51 Merge branch 'master' into sdl2.0
Work on Fill tool by Bill.
2021-11-20 11:45:07 +01:00
Bill Kendrick
e77c7766cd Fill queue is now actually a stack
Size of queue structure (which contains 3 ints, so is 12 bytes on
my Linux laptop) before & after, when filling a few sample images
when running in a 3000x2000 window:

 * a pattern i drew
   queue:   855,040
   stack:   287,744

 * mosaic
   queue:   908,288
   stack:   398,336

 * mosaic 4x via panel magic tool
   queue: 1,451,008
   stack:   734,208
2021-11-20 01:52:43 -08:00
Bill Kendrick
0431cce21f Fill debug updates
Show final queue structure size at the end.
Watching the fill blit happen is now a separate #define'd option.
2021-11-20 01:47:13 -08:00
Bill Kendrick
5cfc185d77 Globalized a ton of stuff, able to queue-ify flood fill
The queue grows ever large, and should shrink itself once
as the queue gets consumed.  In the meantime, it seems to help.

At 3000x2000, with starters/mosaic.svg cut into four via Panels
magic tool, I get a VERY complicated drawing, which no longer
causes a crash.

(It crashed for me, even after some other improvements -- globalizing
many of the unchanging args to the recursive function, calling the
progress bar animation and sound effects calls less frequently --
helped prevent crashing for me with that starter image as-is.)
2021-11-20 01:17:17 -08:00
Bill Kendrick
e06ead84c5 WIP More work on queue-based flood Fill 2021-11-20 00:14:18 -08:00
Bill Kendrick
8a9ab25151 Updated Icelandic translation
h/t Sveinn
2021-11-19 14:06:28 -08:00
Pere Pujal i Carabantes
ebb784199e Merge branch 'master' into sdl2.0 2021-11-19 22:24:12 +01:00
Bill Kendrick
07165fc3ae WIP More work towards span filling
Antialiased edge stuff will be hard to port over :(
2021-11-17 00:55:30 -08:00
Bill Kendrick
2f912bd5d7 WIP Prepare to retrofit fill routine w/ span fill
Add a queue and queue helper functions (disabled via #ifdef
at the moment).
2021-11-17 00:30:35 -08:00
Bill Kendrick
fcf1f66a03 Revert Fill stack explosion prevention
Not the way to do it.
2021-11-16 23:49:52 -08:00
Pere Pujal i Carabantes
6b167caa74 Merge branch 'master' into sdl2.0 2021-11-16 20:16:33 +01:00
Bill Kendrick
af8fd5b8a1 Attempts to improve rotated brushes
* Rotating brush angle is now a double, not an int
 * Don't draw once on click; require some motion
   (does not affect directional brushes, which include
   a "no movement" shape in the middle of the brush bitmap)
2021-11-16 00:13:44 -08:00
Bill Kendrick
6a52e33d35 Improve canvas update w/ rotating brushes 2021-11-15 23:57:12 -08:00
Bill Kendrick
1ff75a5c0c Stop recursive flood fill at depth of 20K
Attempt to void crashing (by blowing up the stack) when doing
a flood-fill of a complicated shape on a large canvas
(e.g., `tuxpaint --3000x2000` with `starters/mosaic.svg`).
2021-11-15 20:40:26 -08:00
Pere Pujal i Carabantes
91800e58c5 Merge branch 'master' into sdl2.0 2021-11-15 01:10:09 +01:00
Pere Pujal i Carabantes
310ed51ede Changing old android/support/v4 to androidX. 2021-11-15 01:08:02 +01:00
Bill Kendrick
b029ceeae7 Portuguese update
from Hugo Carvalho
2021-11-13 13:20:33 -08:00
Pere Pujal i Carabantes
75ca9dd66e Merge branch 'master' into sdl2.0 2021-11-09 23:23:28 +01:00
dolphin6k
c31e0cd504 Updated Japanese translations. 2021-11-09 23:01:19 +09:00
Pere Pujal i Carabantes
32f05c3891 Need to declare tmp_char also for Android. 2021-11-09 00:09:45 +01:00
Pere Pujal i Carabantes
88d8252952 Merge branch 'master' into sdl2.0 2021-11-08 23:33:49 +01:00
Pere Pujal i Carabantes
f32d8b4ab8 Updating Catalan angle translations to a neutral singular/plural. 2021-11-08 23:23:52 +01:00
Bill Kendrick
f65fe54a2c Going back to squelching notices re: unusable fonts
Only doing so if DEBUG set.
2021-11-08 13:21:01 -08:00
Bill Kendrick
70795bffcd Translate new angle-showing tips (Lines, Shapes)
h/t Pere for noticing they weren't appearing
2021-11-08 13:18:38 -08:00
Pere Pujal i Carabantes
b187ca9bb1 Updating Catalan. 2021-11-08 21:12:25 +01:00
Bill Kendrick
58274ed01f Refresh PO/POT after Lightning desc. typo fix 2021-11-07 20:33:03 -08:00
Pere Pujal i Carabantes
1afe9e155c Merge branch 'master' into sdl2.0
Tons of bugfixes and improvements for Windows by Toyama Shin-Ichi
Angle rotation and some magic tools by Bill.
2021-11-06 08:59:22 +01:00
dolphin6k
46dd77fdb5 Reverted to mtw(). (MultiByteToWideChar() was not safe for the labels on other versions of Windows.) 2021-11-06 01:00:18 +09:00
dolphin6k
1efedfa191 Windows Recycle Bin support seems to be stable. / Replaced mtw() with MultiByteToWideChar(). 2021-11-06 00:29:10 +09:00
dolphin6k
5c669730a9 Re-defined iswprint() using GetStringTypeW on windows. 2021-11-05 16:55:23 +09:00
Bill Kendrick
0a529cea96 Avoid crashing on config file lines lacking =
Instead, emit a warning to stdout (though really we may want to
exit cleanly, like parse.gperf does when coming across an
unrecognized option).
2021-11-04 21:30:07 -07:00
dolphin6k
7c8f6bca80 Addressed warnings when compiling on MinGW/MSYS
Following warnings still remain so far.

src/tuxpaint.c:199:2: warning: #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" [-Wcpp]
  199 | #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR"
      |  ^~~~~~~

src/parse.gperf: In function 'parse_one_option':
src/parse.gperf:306:45: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
  306 |   memcpy(offset+(char*)tmpcfg, &opt, sizeof(char*)); /* FIXME: This causes a warning; should it be 'sizeof(char)', or do we need to have the warning suppressed? -bjk 2021.10.14 */
      |                                             ^~~~

src/dirwalk.c: In function 'tp_ftw':
src/dirwalk.c:348:2: warning: #warning Failed to see DT_UNKNOWN [-Wcpp]
  348 | #warning Failed to see DT_UNKNOWN
      |  ^~~~~~~

src/get_fname.c: In function 'get_fname':
src/get_fname.c💯3: warning: 'dir' may be used uninitialized in this function [-Wmaybe-uninitialized]
  100 |   snprintf(f, sizeof(f),
      |   ^~~~~~~~~~~~~~~~~~~~~~
  101 |            "%s%c%s",
      |            ~~~~~~~~~
  102 |     dir, (*name) ? '/' : '\0', /* Some mkdir()'s don't like trailing slashes */
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  103 |     name);
      |     ~~~~~

magic/src/cartoon.c:178:99: warning: unused parameter 'last' [-Wunused-parameter]
  178 | static void do_cartoon(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
      |                                                                                     ~~~~~~~~~~~~~~^~~~
2021-11-05 12:23:09 +09:00
Bill Kendrick
19db5e1b4a Avoid compile-time warnings re: wchar_t comparison
When assembling UTF-8 in render_text_w() (to send to SDL_Pango),
we assumed `wchar_t` could encompass the entirety of Unicode
(up to U+10FFFF); however, on Windows `wchar_t` is only 16-bits,
meaning the test for characters <= U+FFFF was always true.

This reworks the if/elseif/else block, via some "#ifndef WIN32"
tests, to avoid this warning.

In the end, we need to replace our internal use of `wchar_t`
with something 32-bit, to allow for higher Unicode code points
(e.g., to support Emoji via the Text and Label tools).

Additonally, some work will need to be done to ensure that
text stored as Labels within saved Tux Paint images (PNGs) continued
to work correctly, and could be traded between platforms.
(Untested, but right now I assume a picture drawn on Linux where
`wchar_t` is 32-bit would break if you attempt to load it on Windows,
and possibly vice-versa?)

See https://sourceforge.net/p/tuxpaint/feature-requests/210/
2021-11-03 22:16:24 -07:00
Bill Kendrick
f46df76736 Clean up comment formatting re: UTF-8 stuff 2021-11-03 21:28:03 -07:00
dolphin6k
6145fb8bc2 Addressed some compile time warnings. 2021-11-03 22:04:24 +09:00
dolphin6k
0cb079acb0 win32_trash.c: converted newline from <CR><LF> to <LF> 2021-11-03 20:51:25 +09:00
dolphin6k
2a6b55e3c2 "Move to recycle bin" for Windows is now ready for the tests. 2021-10-31 17:18:16 +09:00
dolphin6k
f9efb48450 win32_trash() to work correctly on various version of windows.
Careful tests are still required.
2021-10-31 15:49:55 +09:00
dolphin6k
b667aa7d79 win32_trash() is still quite unstable. 2021-10-31 02:34:24 +09:00
dolphin6k
e9f31ac4ce Updated Japanese translations. 2021-10-30 18:51:54 +09:00
Bill Kendrick
022e7cd4eb Remove FIXME re: Windows trash support
...since Shin-ichi is adding it :)
2021-10-29 16:25:09 -07:00
dolphin6k
8d23668589 UNLINK_ONLY macro to work correctly for windows. 2021-10-30 07:34:30 +09:00
dolphin6k
87ed5bc991 tweak for win32_trash() 2021-10-29 23:37:19 +09:00
Bill Kendrick
adc181e3ec More debugging in dirwalk & fonts 2021-10-28 22:52:06 -07:00
Bill Kendrick
0701eeae74 Portuguese translation update
From Hugo Carvalho
2021-10-28 10:01:02 -07:00
Bill Kendrick
32d3ac4ce2 Icelandic translation update
From Sveinn í Felli
2021-10-28 09:38:37 -07:00
dolphin6k
61ce0798d9 Initial implimentation of win32_trash() 2021-10-28 22:47:32 +09:00