Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Tasse2012-07-16 14:14:32 -0400
committerPatrick Tasse2012-07-16 16:58:55 -0400
commitf72153f6e555ecd507975984cb2e149a90d639e9 (patch)
treeb0ac04e413a1eb470472dbad646b2baf9154443c
parent051286dfce04e20180e32bd1f0c11298870fd1dc (diff)
downloadorg.eclipse.linuxtools-f72153f6e555ecd507975984cb2e149a90d639e9.tar.gz
org.eclipse.linuxtools-f72153f6e555ecd507975984cb2e149a90d639e9.tar.xz
org.eclipse.linuxtools-f72153f6e555ecd507975984cb2e149a90d639e9.zip
Fix for bug 385222: Canvas border hides histogram data.
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java2
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java9
2 files changed, 7 insertions, 4 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java
index d6d7d711bf..52b9f3990c 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/FullTraceHistogram.java
@@ -190,7 +190,7 @@ public class FullTraceHistogram extends Histogram implements MouseMoveListener {
int left = (int) ((fRangeStartTime - fDataModel.getFirstBucketTime()) / bucketSpan);
int right = left + rangeWidth;
int center = (left + right) / 2;
- int height = fCanvas.getSize().y - 2;
+ int height = fCanvas.getSize().y;
// Draw the selection window
imageGC.setForeground(fTimeRangeColor);
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
index 4dcc1a1d4c..5b26514a32 100644
--- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
+++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/histogram/Histogram.java
@@ -30,6 +30,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas;
@@ -203,14 +204,16 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
fMaxNbEventsText.setLayoutData(gridData);
// Histogram itself
+ Composite canvasComposite = new Composite(composite, SWT.BORDER);
gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.verticalSpan = 2;
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
- fCanvas = new Canvas(composite, SWT.BORDER | SWT.DOUBLE_BUFFERED);
- fCanvas.setLayoutData(gridData);
+ canvasComposite.setLayoutData(gridData);
+ canvasComposite.setLayout(new FillLayout());
+ fCanvas = new Canvas(canvasComposite, SWT.DOUBLE_BUFFERED);
// Y-axis min event (always 0...)
gridData = new GridData();
@@ -528,7 +531,7 @@ public abstract class Histogram implements ControlListener, PaintListener, KeyLi
imageGC.setBackground(fHistoBarColor);
final int limit = width < scaledData.fWidth ? width : scaledData.fWidth;
for (int i = 1; i < limit; i++) {
- final int value = (int) (scaledData.fData[i] * scaledData.fScalingFactor);
+ final int value = (int) Math.ceil(scaledData.fData[i] * scaledData.fScalingFactor);
imageGC.fillRectangle(i, height - value, 1, value);
}

Back to the top