summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ui/src/org
diff options
context:
space:
mode:
authorMichael Keppler <michael.keppler@gmx.de>2014-11-28 21:21:59 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2014-11-29 01:30:13 +0100
commit1a721437808cbf7ae0bcdd1b2e060a69aaf2a16b (patch)
tree27c14e2d2103065d403d668d9f57ae4772db4f69 /org.eclipse.jgit.ui/src/org
parent147e24a7b224fe6d643bb24100030ff70bfbca35 (diff)
downloadjgit-1a721437808cbf7ae0bcdd1b2e060a69aaf2a16b.tar.gz
jgit-1a721437808cbf7ae0bcdd1b2e060a69aaf2a16b.zip
Use baseline instead of centerline in PlotRenderer
If the text extent height of a to be rendered plot line is odd, then the SWTPlotRenderer cannot calculate the correct Y position for drawing the label and draws the label with a 1 pixel offset. SWT text drawing uses the baseline as Y coordinate. Due to the given centerline API in the AbstractPlotRenderer the overall calculation of the baseline for SWT is effectively (height / 2) * 2, thereby rounding all odd heights downward to the next even number. This change pushes the division by 2 from the caller into the implementations of drawText. A corresponding change will be pushed in the egit repository. Bug: 450813 Change-Id: I66f4e71873bb8e6f936fde573bbe4c35fe23a022 Signed-off-by: Michael Keppler <michael.keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.ui/src/org')
-rw-r--r--org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java
index 25d9f97ced..c1168f17f3 100644
--- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java
+++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AWTPlotRenderer.java
@@ -123,7 +123,7 @@ final class AWTPlotRenderer extends AbstractPlotRenderer<SwingLane, Color>
@Override
protected void drawText(final String msg, final int x, final int y) {
final int texth = g.getFontMetrics().getHeight();
- final int y0 = y - texth/2 + (cell.getHeight() - texth)/2;
+ final int y0 = (y - texth) / 2 + (cell.getHeight() - texth) / 2;
g.setColor(cell.getForeground());
g.drawString(msg, x, y0 + texth - g.getFontMetrics().getDescent());
}