1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

app, pdb: fix #13480 inconsistent use of maximum radius...

for generated brushes.
The maximum radius we allowed for generated brushes was not used
consistently everywhere.
In the API call we clamped it to 0.0-32767.0, while the param_spec
set min and max to 0.1 and 4000.0, and the brush editor used a
maximum of 1000.0.
Using a large value (probably anything larger than 4000) would
sooner or later lead to a crash.

Instead of manual changes everywhere, let's define a maximum and
minimum in one place and use that wherever we need the min/max values.
Use the values as set in the param_spec for the defines.
The only place we can't easily do that is in brush.pdb, so we add
a comment above our defines that the values need updating there too.

Actually we should probably use more defines for other values too,
that way there is less chance of min/max values getting out of synch
throughout our code.
This commit is contained in:
Jacob Boerema
2025-03-31 15:54:44 -04:00
parent e67a99b275
commit 5273f26ef0
7 changed files with 17 additions and 8 deletions

View File

@@ -542,7 +542,7 @@ sub brush_set_radius {
$help = <<'HELP';
Sets the radius for a generated brush.
Clamps radius to [0.0, 32767.0].
Clamps radius to [0.1, 4000.0].
Returns the clamped value.
Returns an error when brush is non-parametric or not editable.
HELP