Issue #1554 - Select by Color tool does not select pixel(s) or area(s) of pixel(s)
In gimp_pickable_contiguous_region_by_color(), add a small epsilon
to the threshold value, to allow for small errors due to the input
color and pickable pixel-colors being converted to the common
format through different paths.
While we *could* special-case threshold == 0 when the input color
comes from the same pickable, as is the case for the select-by-
color tool, and perform an exact comparison in the original format,
in the more general case the input color can come from an arbitrary
source, such as a plug-in.
(cherry picked from commit a6c79770c3)
This commit is contained in:
parent
bf793f9d59
commit
3f43c2ea12
1 changed files with 10 additions and 0 deletions
|
|
@ -41,6 +41,8 @@ extern "C"
|
|||
#include "gimppickable-contiguous-region.h"
|
||||
|
||||
|
||||
#define EPSILON 1e-6
|
||||
|
||||
#define PIXELS_PER_THREAD \
|
||||
(/* each thread costs as much as */ 64.0 * 64.0 /* pixels */)
|
||||
|
||||
|
|
@ -209,6 +211,14 @@ gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
|
|||
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
/* increase the threshold by EPSILON, to allow for conversion errors,
|
||||
* especially when threshold == 0 (see issue #1554.) we need to do this
|
||||
* here, but not in the other functions, since the input color gets converted
|
||||
* to the format in which we perform the comparison through a different path
|
||||
* than the pickable's pixels, which can introduce error.
|
||||
*/
|
||||
threshold += EPSILON;
|
||||
|
||||
gimp_pickable_flush (pickable);
|
||||
|
||||
src_buffer = gimp_pickable_get_buffer (pickable);
|
||||
|
|
|
|||
Loading…
Reference in a new issue