From ea513be421ff0e9ac154744ceb000496b31df82b Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Mon, 18 Jul 2016 07:21:33 +0300 Subject: [PATCH] IDEA-97406 move effect color to parameter --- .../src/com/intellij/ui/paint/EffectPainter.java | 1 + .../com/intellij/openapi/editor/impl/EditorImpl.java | 9 ++++----- .../openapi/editor/impl/view/EditorPainter.java | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java b/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java index 53150ce5a095..530f846350e9 100644 --- a/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java +++ b/platform/platform-api/src/com/intellij/ui/paint/EffectPainter.java @@ -226,6 +226,7 @@ public enum EffectPainter implements RegionPainter { } Integer round = height > 2 ? height : null; while (dx <= width) { + //noinspection SuspiciousNameCombination RectanglePainter.FILL.paint(g, x + dx, y, height, height, round); dx += length; } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java index a4dcf312bf5b..2bf62345e9d3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorImpl.java @@ -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()); } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java index d1f95fd67060..f25a1bd18e31 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/view/EditorPainter.java @@ -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); } }