performance

This commit is contained in:
Alexey Kudravtsev
2016-07-18 12:57:21 +03:00
parent 355a1253df
commit 1bb6b56eba
@@ -36,15 +36,10 @@ import java.util.List;
import java.util.stream.Collectors;
public class RainbowHighlighter {
private final float[] myFloats;
@NotNull private final TextAttributesScheme myColorsScheme;
public RainbowHighlighter(@Nullable TextAttributesScheme colorsScheme) {
myColorsScheme = colorsScheme != null ? colorsScheme : EditorColorsManager.getInstance().getGlobalScheme();
TextAttributes attributes = myColorsScheme.getAttributes(DefaultLanguageHighlighterColors.CONSTANT);
Color foregroundColor = attributes.getForegroundColor();
float[] components = foregroundColor.getRGBColorComponents(null);
myFloats = Color.RGBtoHSB((int)(255 * components[0]), (int)(255 * components[0]), (int)(255 * components[0]), null);
}
public static final HighlightInfoType RAINBOW_ELEMENT = new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, DefaultLanguageHighlighterColors.CONSTANT);
@@ -72,7 +67,7 @@ public class RainbowHighlighter {
final float colors = 36.0f;
final float v = Math.round(Math.abs(colors * hash) / Integer.MAX_VALUE) / colors;
return Color.getHSBColor(v, 0.7f, myFloats[2] + .3f);
return Color.getHSBColor(v, 0.7f, .3f);
}
public HighlightInfo getInfo(@Nullable String nameKey, @Nullable PsiElement id, @Nullable TextAttributesKey colorKey) {