mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 10:30:42 +00:00
Skip color dist calc if exact match
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user