IDEA-153969 Change draw order of underline effect

This commit is contained in:
Dmitry Batrak
2016-04-11 10:16:08 +03:00
parent ea09858d2b
commit 37ef41b641
@@ -372,6 +372,10 @@ class EditorPainter implements TextDrawingCallback {
@Override
public void paint(Graphics2D g, VisualLineFragmentsIterator.Fragment fragment, int start, int end,
TextAttributes attributes, float xStart, float xEnd, int y) {
boolean allowBorder = fragment.getCurrentFoldRegion() != null;
if (attributes != null && hasTextEffect(attributes.getEffectColor(), attributes.getEffectType(), allowBorder)) {
paintTextEffect(g, xStart, xEnd, y, attributes.getEffectColor(), attributes.getEffectType(), allowBorder);
}
if (attributes != null && attributes.getForegroundColor() != null) {
g.setColor(attributes.getForegroundColor());
fragment.draw(g, xStart, y, start, end);
@@ -384,10 +388,6 @@ class EditorPainter implements TextDrawingCallback {
}
paintWhitespace(g, text, xStart, y, start, end, whitespacePaintingStrategy, fragment, whiteSpaceStroke, whiteSpaceStrokeWidth);
}
boolean allowBorder = fragment.getCurrentFoldRegion() != null;
if (attributes != null && hasTextEffect(attributes.getEffectColor(), attributes.getEffectType(), allowBorder)) {
paintTextEffect(g, xStart, xEnd, y, attributes.getEffectColor(), attributes.getEffectType(), allowBorder);
}
}
@Override
@@ -410,14 +410,12 @@ class EditorPainter implements TextDrawingCallback {
private float paintLineLayoutWithEffect(Graphics2D g, LineLayout layout, float x, float y,
@Nullable Color effectColor, @Nullable EffectType effectType) {
float initialX = x;
if (hasTextEffect(effectColor, effectType, false)) {
paintTextEffect(g, x, x + layout.getWidth(), (int)y, effectColor, effectType, false);
}
for (LineLayout.VisualFragment fragment : layout.getFragmentsInVisualOrder(x)) {
fragment.draw(g, x, y);
x = fragment.getEndX();
}
if (hasTextEffect(effectColor, effectType, false)) {
paintTextEffect(g, initialX, x, (int)y, effectColor, effectType, false);
}
return x;
}