mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +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 closest = 0;
|
||||||
int smallestDistance = Integer.MAX_VALUE;
|
int smallestDistance = Integer.MAX_VALUE;
|
||||||
for(int compare : colors) {
|
for(int compare : colors) {
|
||||||
int distance = ColorUtil.distance(color, compare);
|
if(color == compare) {
|
||||||
if(distance == 0) {
|
|
||||||
closest = compare;
|
closest = compare;
|
||||||
break;
|
break;
|
||||||
} else if(distance < smallestDistance) {
|
}
|
||||||
|
int distance = ColorUtil.distance(color, compare);
|
||||||
|
if(distance < smallestDistance) {
|
||||||
smallestDistance = distance;
|
smallestDistance = distance;
|
||||||
closest = compare;
|
closest = compare;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user