Template export: Test file sizes, too

Avoid exporting a saved picture to a new template if one already
exists with both the same filename prefix, and now also identical
file sizes (in bytes).

Bugfix - The export function was always dumping chunks that
were the size of the input buffer, which means the final chunk
(which will frequently be smaller) will contain garbage data
beyond the end.
This commit is contained in:
Bill Kendrick 2023-05-27 14:17:48 -07:00
parent 785401d68e
commit e578de2c6b
2 changed files with 73 additions and 17 deletions

View file

@ -40,6 +40,12 @@ https://tuxpaint.org/
* WIP - Saved pictures can, from the Open dialog, be copied into
the user's templates directory, and used as backgrounds
for other drawings by selecting it from the New dialog.
+ If the original image has already been exported as a template,
it will not be re-saved. We check, in this order:
- identical filename prefix (based on original saved picture)
- identical file sizes
- TODO identical image dimensions
- TODO identical image data
Closes https://sourceforge.net/p/tuxpaint/feature-requests/236/
Bill Kendrick <bill@newbreedsoftware.com>
+ TODO - Need to allow the ability to turn this feature off.
@ -48,8 +54,6 @@ https://tuxpaint.org/
- tuxpaint-docs,tuxpaint: Document in OPTIONS docs
- tuxpaint-docs,tuxpaint: Document in manpage
- tuxpaint-config: Add support to Tux Paint Config.
+ WIP - Ensure the same unchanged saved image isn't made into
multiple redundant templates.
* Bug Fixes:
----------
@ -69,6 +73,10 @@ https://tuxpaint.org/
h/t Giancarlo Orru for reporting the main part of this bug.
Bill Kendrick <bill@newbreedsoftware.com>
* Exported drawings (to e.g. ~/Pictures) would contain extraneous
data beyond the end of the data (copied from the original PNG).
Bill Kendrick <bill@newbreedsoftware.com>
* Localization Updates:
---------------------
* Russian translaton