IDEA-97406 move effect color to parameter

This commit is contained in:
Sergey Malenkov
2016-07-18 07:21:33 +03:00
parent 771ca5a1f6
commit ea513be421
3 changed files with 10 additions and 10 deletions
@@ -226,6 +226,7 @@ public enum EffectPainter implements RegionPainter<Paint> {
}
Integer round = height > 2 ? height : null;
while (dx <= width) {
//noinspection SuspiciousNameCombination
RectanglePainter.FILL.paint(g, x + dx, y, height, height, round);
dx += length;
}
@@ -2412,22 +2412,21 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
if (attributes != null && attributes.getEffectColor() != null) {
int y = visibleLineToY(visibleStartLine) + getAscent() + 1;
g.setColor(attributes.getEffectColor());
if (attributes.getEffectType() == EffectType.WAVE_UNDERSCORE) {
EffectPainter.WAVE_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), null);
EffectPainter.WAVE_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), attributes.getEffectColor());
}
else if (attributes.getEffectType() == EffectType.BOLD_DOTTED_LINE) {
g.setColor(getBackgroundColor(attributes));
EffectPainter.BOLD_DOTTED_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), attributes.getEffectColor());
}
else if (attributes.getEffectType() == EffectType.STRIKEOUT) {
EffectPainter.STRIKE_THROUGH.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getCharHeight(), null);
EffectPainter.STRIKE_THROUGH.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getCharHeight(), attributes.getEffectColor());
}
else if (attributes.getEffectType() == EffectType.BOLD_LINE_UNDERSCORE) {
EffectPainter.BOLD_LINE_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), null);
EffectPainter.BOLD_LINE_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), attributes.getEffectColor());
}
else if (attributes.getEffectType() != EffectType.BOXED) {
EffectPainter.LINE_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), null);
EffectPainter.LINE_UNDERSCORE.paint((Graphics2D)g, end.x, y - 1, charWidth - 1, getDescent(), attributes.getEffectColor());
}
}
}
@@ -425,24 +425,24 @@ class EditorPainter implements TextDrawingCallback {
private void paintTextEffect(Graphics2D g, float xFrom, float xTo, int y, Color effectColor, EffectType effectType, boolean allowBorder) {
int xStart = (int)xFrom;
int xEnd = (int)xTo;
g.setColor(effectColor);
if (effectType == EffectType.LINE_UNDERSCORE) {
EffectPainter.LINE_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), null);
EffectPainter.LINE_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), effectColor);
}
else if (effectType == EffectType.BOLD_LINE_UNDERSCORE) {
EffectPainter.BOLD_LINE_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), null);
EffectPainter.BOLD_LINE_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), effectColor);
}
else if (effectType == EffectType.STRIKEOUT) {
EffectPainter.STRIKE_THROUGH.paint(g, xStart, y, xEnd - xStart, myView.getCharHeight(), null);
EffectPainter.STRIKE_THROUGH.paint(g, xStart, y, xEnd - xStart, myView.getCharHeight(), effectColor);
}
else if (effectType == EffectType.WAVE_UNDERSCORE) {
EffectPainter.WAVE_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), null);
EffectPainter.WAVE_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), effectColor);
}
else if (effectType == EffectType.BOLD_DOTTED_LINE) {
g.setColor(myEditor.getBackgroundColor());
EffectPainter.BOLD_DOTTED_UNDERSCORE.paint(g, xStart, y, xEnd - xStart, myView.getDescent(), effectColor);
}
else if (allowBorder && (effectType == EffectType.BOXED || effectType == EffectType.ROUNDED_BOX)) {
g.setColor(effectColor);
drawSimpleBorder(g, xStart, xEnd - 1, y - myView.getAscent(), effectType == EffectType.ROUNDED_BOX);
}
}