From 4f7db6735400fd6cdc68baf68d9ec5d45efa6f75 Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Fri, 12 May 2017 16:19:22 +0300 Subject: [PATCH 1/3] Use antialiasing for lines in the mapping panes --- .../java/com/intellij/debugger/streams/ui/impl/MappingPane.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt b/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt index 875ce02..b8fe6a3 100644 --- a/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt +++ b/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt @@ -19,6 +19,7 @@ import com.intellij.debugger.streams.ui.LinkedValuesMapping import com.intellij.debugger.streams.ui.ValueWithPosition import com.intellij.ui.JBColor import com.intellij.ui.components.JBLabel +import com.intellij.util.ui.GraphicsUtil import com.intellij.util.ui.JBUI import java.awt.BasicStroke import java.awt.BorderLayout @@ -27,6 +28,7 @@ import java.awt.Graphics2D import javax.swing.JPanel import javax.swing.SwingConstants + /** * @author Vitaliy.Bibaev */ @@ -57,6 +59,7 @@ class MappingPane(name: String, val x1 = x val x2 = x + width + val config = GraphicsUtil.setupAAPainting(g) for (value in beforeValues) { val position: Int = value.position val linkedValues = mapping.getLinkedValues(value) ?: continue @@ -70,6 +73,7 @@ class MappingPane(name: String, } } } + config.restore() } private fun needToDraw(left: ValueWithPosition, right: ValueWithPosition): Boolean = left.isVisible || right.isVisible From aca44618f7a382a25c36ba2600c0f24c9ac394cf Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Fri, 12 May 2017 17:41:02 +0300 Subject: [PATCH 2/3] Draw highlighted mapping lines after grey lines --- .../debugger/streams/ui/impl/MappingPane.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt b/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt index b8fe6a3..889d73a 100644 --- a/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt +++ b/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt @@ -55,17 +55,23 @@ class MappingPane(name: String, if (g is Graphics2D) { g.stroke = STROKE + + val config = GraphicsUtil.setupAAPainting(g) + drawLines(g, REGULAR_LINK_COLOR) + drawLines(g, SELECTED_LINK_COLOR) + config.restore() } + } + private fun drawLines(g: Graphics2D, color: JBColor) { val x1 = x val x2 = x + width - val config = GraphicsUtil.setupAAPainting(g) + g.color = color for (value in beforeValues) { val position: Int = value.position val linkedValues = mapping.getLinkedValues(value) ?: continue for (nextValue in linkedValues) { - if (needToDraw(value, nextValue)) { - g.color = getLineColor(value, nextValue) + if (needToDraw(value, nextValue) && getLineColor(value, nextValue) == color) { val y1 = position val y2 = nextValue.position @@ -73,7 +79,6 @@ class MappingPane(name: String, } } } - config.restore() } private fun needToDraw(left: ValueWithPosition, right: ValueWithPosition): Boolean = left.isVisible || right.isVisible From e7ab4ac488123d966362cf9c33aba8b5dfb05fbd Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Fri, 12 May 2017 17:51:20 +0300 Subject: [PATCH 3/3] Minor: inline redundant variable --- .../java/com/intellij/debugger/streams/ui/impl/MappingPane.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt b/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt index 889d73a..50036b7 100644 --- a/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt +++ b/src/main/java/com/intellij/debugger/streams/ui/impl/MappingPane.kt @@ -68,11 +68,10 @@ class MappingPane(name: String, val x2 = x + width g.color = color for (value in beforeValues) { - val position: Int = value.position val linkedValues = mapping.getLinkedValues(value) ?: continue for (nextValue in linkedValues) { if (needToDraw(value, nextValue) && getLineColor(value, nextValue) == color) { - val y1 = position + val y1 = value.position val y2 = nextValue.position g.drawLine(x1, y1, x2, y2)