Skip to content

Commit 8bc7ed2

Browse files
committed
Improve display of idle/active boundaries in timeline
Now always displays an active entry method if one exists on a pixel, previously it was possible for one pixel wide active EMOs to be displayed underneath adjacent idle EMOs. Also adds support for single pixel wide idle sections and stops emobossing idle EMOs.
1 parent 4b2fbb6 commit 8bc7ed2

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

src/projections/Tools/Timeline/EntryMethodObject.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,8 +866,19 @@ public boolean paintMe(Graphics2D g2d, final int actualDisplayWidth, final int t
866866
}
867867

868868
boolean paintedEP = false;
869-
// Only draw this EMO if it covers some pixel that hasn't been filled yet
870-
if (right > maxFilledX.ep) {
869+
// Only draw this EMO if it covers some pixel that hasn't been filled yet or it is covers a previously idle pixel
870+
if (right > maxFilledX.ep || (maxFilledX.epIsIdle && !isIdle)) {
871+
// Generally, maxFilledX.ep should contain the pixel before the pixel corresponding
872+
// to the end time of the previous block, avoiding overlap if the current block
873+
// happens to start immediately after the previous one. However, if the previous
874+
// block was short enough that it started and ended on the same pixel, it may
875+
// overlap the start of this one; this checks and corrects for that case.
876+
if (left == maxFilledX.ep && !maxFilledX.epIsIdle) {
877+
left++;
878+
rectWidth--;
879+
}
880+
881+
maxFilledX.epIsIdle = isIdle;
871882
maxFilledX.ep = right;
872883
paintedEP = true;
873884

@@ -894,9 +905,9 @@ public boolean paintMe(Graphics2D g2d, final int actualDisplayWidth, final int t
894905
right -= 5;
895906
}
896907

897-
// Paint the main rectangle for the object, as long as it is not a skinny idle event
908+
// Paint the main rectangle for the object
898909
g2d.setPaint(c);
899-
if (rectWidth > 1 || !isIdle) {
910+
if (rectWidth > 0) {
900911
g2d.fillRect(left, topCoord + verticalInset, rectWidth, rectHeight);
901912
// System.out.println("Entry method painting at (" + left + "," + (topCoord+verticalInset) + "," + rectWidth + "," + rectHeight + ")");
902913
if (isCommThreadMsgRecv()) {
@@ -906,7 +917,7 @@ public boolean paintMe(Graphics2D g2d, final int actualDisplayWidth, final int t
906917
}
907918

908919
// Paint the edges of the rectangle lighter/darker to give an embossed look
909-
if (rectWidth > 2 && !data.colorByMemoryUsage() && rectHeight > 1) {
920+
if (rectWidth > 3 && !isIdle && !data.colorByMemoryUsage() && rectHeight > 1) {
910921
g2d.setPaint(makeMoreLikeForeground(c));
911922
g2d.drawLine(left, topCoord + verticalInset, right, topCoord + verticalInset);
912923
if (left == leftCoord)

src/projections/Tools/Timeline/MainPanel.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,13 @@ public void paintInParallel(Graphics g){
214214
*/
215215
public class MaxFilledX {
216216
public int ep, pack, msg;
217+
public boolean epIsIdle;
217218

218219
public MaxFilledX() {
219220
ep = 0;
220221
pack = 0;
221222
msg = 0;
223+
epIsIdle = false;
222224
}
223225
}
224226
/**

0 commit comments

Comments
 (0)