/*******************************************************************************
- * 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
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
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();
}
@Override
if (! ((TimeChartEvent) event).isVisible()) {
return;
}
- lastX = currX;
- currX = rect.x;
if (lastBookmarkX == rect.x || ((TimeChartEvent) event).isBookmarked()) {
drawBookmark(rect, gc);
lastBookmarkX = rect.x;
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;
}
boolean timeSelected = selectedTime >= event.getTime() && selectedTime < event.getTime() + event.getDuration();
if (drawState(getColorScheme(), event, stateRect, gc, selected, timeSelected)) {
- lastX = x;
+ lastX = stateRect.x;
}
}
gc.setClipping((Rectangle) null);
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);
- 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);
}
- 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) {
gc.fillRectangle(rect);
+ } 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);
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
*/