This allows for many short time events mapping to the same pixel to be
blended in together instead of drawing only the first one and discarding
the remaining. This functionality is optional and off by default.
The Time Chart view is updated to use this scheme to allow the
highlighted ticks from a color settings filter to be noticeable even if
the time event is not the first event of that pixel.
Change-Id: I316f044157cef50f6744d128c3661964b97f09c1
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/51068
Reviewed-by: Hudson CI
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
(cherry picked from commit
37a507dca88f92e040df4d860191a88224fca382)
Reviewed-on: https://git.eclipse.org/r/51344
/*******************************************************************************
/*******************************************************************************
- * Copyright (c) 2010, 2014 Ericsson
+ * Copyright (c) 2010, 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
private static final Color BOOKMARK_OUTER_COLOR = new Color(Display.getDefault(), 2, 70, 140);
private static final Color SEARCH_MATCH_COLOR = new Color(Display.getDefault(), 177, 118, 14);
private static final Color BOOKMARK_OUTER_COLOR = new Color(Display.getDefault(), 2, 70, 140);
private static final Color SEARCH_MATCH_COLOR = new Color(Display.getDefault(), 177, 118, 14);
- private int lastX = Integer.MIN_VALUE;
- private int currX = Integer.MIN_VALUE;
- private int lastPriority;
private int lastBookmarkX = Integer.MIN_VALUE;
@Override
private int lastBookmarkX = Integer.MIN_VALUE;
@Override
if (! ((TimeChartEvent) event).isVisible()) {
return ITimeGraphPresentationProvider.INVISIBLE;
}
if (! ((TimeChartEvent) event).isVisible()) {
return ITimeGraphPresentationProvider.INVISIBLE;
}
- int priority = ((TimeChartEvent) event).getColorSettingPriority();
- if (currX == lastX) {
- priority = Math.min(priority, lastPriority);
- }
- lastPriority = priority;
- return priority;
+ return ((TimeChartEvent) event).getColorSettingPriority();
if (! ((TimeChartEvent) event).isVisible()) {
return;
}
if (! ((TimeChartEvent) event).isVisible()) {
return;
}
- lastX = currX;
- currX = rect.x;
if (lastBookmarkX == rect.x || ((TimeChartEvent) event).isBookmarked()) {
drawBookmark(rect, gc);
lastBookmarkX = rect.x;
if (lastBookmarkX == rect.x || ((TimeChartEvent) event).isBookmarked()) {
drawBookmark(rect, gc);
lastBookmarkX = rect.x;
fViewer.addRangeListener(this);
fViewer.addSelectionListener(this);
fViewer.setMinimumItemWidth(1);
fViewer.addRangeListener(this);
fViewer.addSelectionListener(this);
fViewer.setMinimumItemWidth(1);
+ fViewer.getTimeGraphControl().setBlendSubPixelEvents(true);
IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
fViewer.getTimeGraphControl().setStatusLineManager(statusLineManager);
IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
fViewer.getTimeGraphControl().setStatusLineManager(statusLineManager);
private boolean fIsInFocus = false;
private boolean fMouseOverSplitLine = false;
private int fGlobalItemHeight = CUSTOM_ITEM_HEIGHT;
private boolean fIsInFocus = false;
private boolean fMouseOverSplitLine = false;
private int fGlobalItemHeight = CUSTOM_ITEM_HEIGHT;
+ private boolean fBlendSubPixelEvents = false;
private int fMinimumItemWidth = 0;
private int fTopIndex = 0;
private int fDragState = DRAG_NONE;
private int fMinimumItemWidth = 0;
private int fTopIndex = 0;
private int fDragState = DRAG_NONE;
}
boolean timeSelected = selectedTime >= event.getTime() && selectedTime < event.getTime() + event.getDuration();
if (drawState(getColorScheme(), event, stateRect, gc, selected, timeSelected)) {
}
boolean timeSelected = selectedTime >= event.getTime() && selectedTime < event.getTime() + event.getDuration();
if (drawState(getColorScheme(), event, stateRect, gc, selected, timeSelected)) {
}
}
gc.setClipping((Rectangle) null);
}
}
gc.setClipping((Rectangle) null);
return false;
}
boolean visible = rect.width == 0 ? false : true;
return false;
}
boolean visible = rect.width == 0 ? false : true;
+ rect.width = Math.max(1, rect.width);
Color black = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
gc.setForeground(black);
Color black = Display.getDefault().getSystemColor(SWT.COLOR_BLACK);
gc.setForeground(black);
- if (visible) {
- if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) {
+ if (colorIdx == ITimeGraphPresentationProvider.TRANSPARENT) {
+ if (visible) {
// Only draw the top and bottom borders
gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y);
gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1);
if (rect.width == 1) {
gc.drawPoint(rect.x, rect.y - 2);
}
// Only draw the top and bottom borders
gc.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y);
gc.drawLine(rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1);
if (rect.width == 1) {
gc.drawPoint(rect.x, rect.y - 2);
}
- fTimeGraphProvider.postDrawEvent(event, rect, gc);
- return false;
- }
- Color stateColor = null;
- if (colorIdx < fEventColorMap.length) {
- stateColor = fEventColorMap[colorIdx];
- } else {
- stateColor = black;
+ fTimeGraphProvider.postDrawEvent(event, rect, gc);
+ return false;
+ }
+ Color stateColor = null;
+ if (colorIdx < fEventColorMap.length) {
+ stateColor = fEventColorMap[colorIdx];
+ } else {
+ stateColor = black;
+ }
- boolean reallySelected = timeSelected && selected;
- // fill all rect area
- gc.setBackground(stateColor);
+ boolean reallySelected = timeSelected && selected;
+ // fill all rect area
+ gc.setBackground(stateColor);
+ if (visible) {
+ } else if (fBlendSubPixelEvents) {
+ gc.setAlpha(128);
+ gc.fillRectangle(rect);
+ gc.setAlpha(255);
+ }
- if (reallySelected) {
- gc.drawLine(rect.x, rect.y - 1, rect.x + rect.width - 1, rect.y - 1);
- gc.drawLine(rect.x, rect.y + rect.height, rect.x + rect.width - 1, rect.y + rect.height);
- }
- } else {
+ if (reallySelected) {
+ gc.drawLine(rect.x, rect.y - 1, rect.x + rect.width - 1, rect.y - 1);
+ gc.drawLine(rect.x, rect.y + rect.height, rect.x + rect.width - 1, rect.y + rect.height);
+ }
+ if (!visible) {
gc.drawPoint(rect.x, rect.y - 2);
}
fTimeGraphProvider.postDrawEvent(event, rect, gc);
gc.drawPoint(rect.x, rect.y - 2);
}
fTimeGraphProvider.postDrawEvent(event, rect, gc);
return fMinimumItemWidth;
}
return fMinimumItemWidth;
}
+ /**
+ * Set whether all time events with a duration shorter than one pixel should
+ * be blended in. If false, only the first such time event will be drawn and
+ * the subsequent time events in the same pixel will be discarded. The
+ * default value is false.
+ *
+ * @param blend
+ * true if sub-pixel events should be blended, false otherwise.
+ * @since 2.0
+ */
+ public void setBlendSubPixelEvents(boolean blend) {
+ fBlendSubPixelEvents = blend;
+ }
+
/**
* @return The entries that are currently filtered out
*/
/**
* @return The entries that are currently filtered out
*/