mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-02 07:55:28 +00:00
Skip color dist calc if exact match
This commit is contained in:
parent
878bede60b
commit
a97273f358
@ -20,11 +20,12 @@ public class ClosestMatchColorConverter<T> implements ColorConverter<T> {
|
||||
int closest = 0;
|
||||
int smallestDistance = Integer.MAX_VALUE;
|
||||
for(int compare : colors) {
|
||||
int distance = ColorUtil.distance(color, compare);
|
||||
if(distance == 0) {
|
||||
if(color == compare) {
|
||||
closest = compare;
|
||||
break;
|
||||
} else if(distance < smallestDistance) {
|
||||
}
|
||||
int distance = ColorUtil.distance(color, compare);
|
||||
if(distance < smallestDistance) {
|
||||
smallestDistance = distance;
|
||||
closest = compare;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user