pdb: never pass bogus supersample values to gimp_drawable_gradient()

even when supersampling is not enabled, or we will get warnings about
out-of-range property values.
This commit is contained in:
Michael Natterer
2018-04-16 01:18:05 +02:00
parent 055e61f065
commit 410e55c40c
4 changed files with 54 additions and 22 deletions

View File

@ -228,14 +228,22 @@ drawable_edit_gradient_fill_invoker (GimpProcedure *procedure,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
if (success && supersample)
if (success)
{
if (supersample_max_depth < 1 || supersample_max_depth > 9)
success = FALSE;
if (supersample)
{
if (supersample_max_depth < 1 || supersample_max_depth > 9)
success = FALSE;
if (supersample_threshold < 0.0 || supersample_threshold > 4.0)
success = FALSE;
}
if (supersample_threshold < 0.0 || supersample_threshold > 4.0)
success = FALSE;
}
else
{
supersample_max_depth = CLAMP (supersample_max_depth, 1, 9);
supersample_threshold = CLAMP (supersample_threshold, 0.0, 4.0);
}
}
if (success)
{

View File

@ -777,13 +777,21 @@ edit_blend_invoker (GimpProcedure *procedure,
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
if (success && supersample)
if (success)
{
if (max_depth < 1 || max_depth > 9)
success = FALSE;
if (supersample)
{
if (max_depth < 1 || max_depth > 9)
success = FALSE;
if (threshold < 0.0 || threshold > 4.0)
success = FALSE;
if (threshold < 0.0 || threshold > 4.0)
success = FALSE;
}
else
{
max_depth = CLAMP (max_depth, 1, 9);
threshold = CLAMP (threshold, 0.0, 4.0);
}
}
if (success)

View File

@ -247,14 +247,22 @@ HELP
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
if (success && supersample)
if (success)
{
if (supersample_max_depth < 1 || supersample_max_depth > 9)
success = FALSE;
if (supersample)
{
if (supersample_max_depth < 1 || supersample_max_depth > 9)
success = FALSE;
if (supersample_threshold < 0.0 || supersample_threshold > 4.0)
success = FALSE;
}
if (supersample_threshold < 0.0 || supersample_threshold > 4.0)
success = FALSE;
}
else
{
supersample_max_depth = CLAMP (supersample_max_depth, 1, 9);
supersample_threshold = CLAMP (supersample_threshold, 0.0, 4.0);
}
}
if (success)
{

View File

@ -869,13 +869,21 @@ HELP
GIMP_PDB_ITEM_CONTENT, error) &&
gimp_pdb_item_is_not_group (GIMP_ITEM (drawable), error));
if (success && supersample)
if (success)
{
if (max_depth < 1 || max_depth > 9)
success = FALSE;
if (supersample)
{
if (max_depth < 1 || max_depth > 9)
success = FALSE;
if (threshold < 0.0 || threshold > 4.0)
success = FALSE;
if (threshold < 0.0 || threshold > 4.0)
success = FALSE;
}
else
{
max_depth = CLAMP (max_depth, 1, 9);
threshold = CLAMP (threshold, 0.0, 4.0);
}
}
if (success)