diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 9fef9c6cd..3bcd99984 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,7 +8,7 @@ http://www.tuxpaint.org/ $Id$ -2009.September.27 (0.9.22) +2009.September.29 (0.9.22) * New Magic Tools: ---------------- * Blinds - Close window blinds over your picture. @@ -29,6 +29,12 @@ $Id$ * Starter images can be in SVG format. (Avoids loading PNG if SVG with the same name exists.) + * When a default size was not specified, SVG-based Stamps would default + to the largest, which was canvas-sized. Now defaulting to a more + reasonable size. (And users can click the maximum size choice to get + the largest, canvas-sized rendition.) + (SF.net bug #2836471) + * Widened dialog windows, to help avoid word-wrap and overlap problems with some prompts, in some locales. (SF.net bug #2834461) diff --git a/src/debug.h b/src/debug.h index fba3ab209..9c5ec37b3 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1 +1 @@ -//#define DEBUG +/* #define DEBUG */ diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 62c8405f3..e0f2dbcf0 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -1252,6 +1252,8 @@ typedef struct stamp_type unsigned min:5; unsigned size:5; unsigned max:5; + + unsigned is_svg:1; } stamp_type; #define MAX_STAMP_GROUPS 256 @@ -5403,10 +5405,16 @@ static void loadstamp_finisher(stamp_type * sd, unsigned w, unsigned h, lower = upper; } + mid = default_stamp_size; if (ratio != 1.0) mid = compute_default_scale_factor(ratio); + /* Ratio override for SVGs! */ + if (ratio == 1.0 && sd->is_svg) { + mid = compute_default_scale_factor(0.2); + } + if (mid > upper) mid = upper; @@ -5690,7 +5698,24 @@ static void get_stamp_thumb(stamp_type * sd) ratio = loadinfo(buf, sd); } else + { + /* So here, unless an SVG stamp has a .dat file with a 'scale', + the Stamp ends up defaulting to 100% (ratio=1.0). + Since we render the SVG as large as possible, for quality reasons, + we almost never want the _default_ size to be 100%. + + So we need to either (a) keep track of the SVG's own pixel size + and try to set the default size to something close to that, + or (b) pick a universal initial size that we can apply to _all_ SVGs + where the initial size is left unspecified (which means knowing when + they're SVGs). + + So far, I'm doing (b), in loadstamp_finisher... + + -bjk 2009.09.29 */ + ratio = 1.0; + } #ifndef NOSOUND /* good time to load the sound */ @@ -6105,6 +6130,13 @@ static void loadstamp_callback(SDL_Surface * screen, dotext - files[i].str + 1 + dirlen); stamp_data[stamp_group][num_stamps[stamp_group]]->stampname[dotext - files[i].str + 1 + dirlen] = '\0'; + + if (strcmp(ext, ".svg") == 0) { + stamp_data[stamp_group][num_stamps[stamp_group]]->is_svg = 1; + } else { + stamp_data[stamp_group][num_stamps[stamp_group]]->is_svg = 0; + } + num_stamps[stamp_group]++; } free(files[i].str);