| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 var unclippedBarX = this._timeToPosition(entryStartTime); | 691 var unclippedBarX = this._timeToPosition(entryStartTime); |
| 692 if (this._dataProvider.decorateEntry( | 692 if (this._dataProvider.decorateEntry( |
| 693 entryIndex, context, text, barX, barY, barWidth, barHeight, unclip
pedBarX, this._timeToPixel)) | 693 entryIndex, context, text, barX, barY, barWidth, barHeight, unclip
pedBarX, this._timeToPixel)) |
| 694 continue; | 694 continue; |
| 695 if (!text || !text.length) | 695 if (!text || !text.length) |
| 696 continue; | 696 continue; |
| 697 context.fillStyle = this._dataProvider.textColor(entryIndex); | 697 context.fillStyle = this._dataProvider.textColor(entryIndex); |
| 698 context.fillText(text, barX + textPadding, barY + textBaseHeight); | 698 context.fillText(text, barX + textPadding, barY + textBaseHeight); |
| 699 } | 699 } |
| 700 | 700 |
| 701 context.restore(); |
| 702 |
| 701 this._drawGroupHeaders(width, height); | 703 this._drawGroupHeaders(width, height); |
| 702 context.restore(); | |
| 703 this._drawMarkers(); | 704 this._drawMarkers(); |
| 704 const headerHeight = this._rulerEnabled ? PerfUI.FlameChart.HeaderHeight : 0
; | 705 const headerHeight = this._rulerEnabled ? PerfUI.FlameChart.HeaderHeight : 0
; |
| 705 PerfUI.TimelineGrid.drawCanvasGrid(context, this._calculator, 3, headerHeigh
t); | 706 PerfUI.TimelineGrid.drawCanvasGrid(context, this._calculator, 3, headerHeigh
t); |
| 706 | 707 |
| 707 this._updateElementPosition(this._highlightElement, this._highlightedEntryIn
dex); | 708 this._updateElementPosition(this._highlightElement, this._highlightedEntryIn
dex); |
| 708 this._updateElementPosition(this._selectedElement, this._selectedEntryIndex)
; | 709 this._updateElementPosition(this._selectedElement, this._selectedEntryIndex)
; |
| 709 this._updateMarkerHighlight(); | 710 this._updateMarkerHighlight(); |
| 710 } | 711 } |
| 711 | 712 |
| 712 /** | 713 /** |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 /** | 869 /** |
| 869 * @param {!PerfUI.FlameChart.Group} group | 870 * @param {!PerfUI.FlameChart.Group} group |
| 870 * @param {number} y | 871 * @param {number} y |
| 871 * @param {number} endLevel | 872 * @param {number} endLevel |
| 872 */ | 873 */ |
| 873 _drawCollapsedOverviewForGroup(group, y, endLevel) { | 874 _drawCollapsedOverviewForGroup(group, y, endLevel) { |
| 874 var range = new Common.SegmentedRange(mergeCallback); | 875 var range = new Common.SegmentedRange(mergeCallback); |
| 875 var timeWindowRight = this._timeWindowRight; | 876 var timeWindowRight = this._timeWindowRight; |
| 876 var timeWindowLeft = this._timeWindowLeft - this._paddingLeft / this._timeTo
Pixel; | 877 var timeWindowLeft = this._timeWindowLeft - this._paddingLeft / this._timeTo
Pixel; |
| 877 var context = /** @type {!CanvasRenderingContext2D} */ (this._canvas.getCont
ext('2d')); | 878 var context = /** @type {!CanvasRenderingContext2D} */ (this._canvas.getCont
ext('2d')); |
| 878 var barHeight = this._barHeight - 1; | 879 var barHeight = this._barHeight - 2; |
| 879 var entryStartTimes = this._rawTimelineData.entryStartTimes; | 880 var entryStartTimes = this._rawTimelineData.entryStartTimes; |
| 880 var entryTotalTimes = this._rawTimelineData.entryTotalTimes; | 881 var entryTotalTimes = this._rawTimelineData.entryTotalTimes; |
| 881 | 882 |
| 882 for (var level = group.startLevel; level < endLevel; ++level) { | 883 for (var level = group.startLevel; level < endLevel; ++level) { |
| 883 var levelIndexes = this._timelineLevels[level]; | 884 var levelIndexes = this._timelineLevels[level]; |
| 884 var rightIndexOnLevel = | 885 var rightIndexOnLevel = |
| 885 levelIndexes.lowerBound(timeWindowRight, (time, entryIndex) => time -
entryStartTimes[entryIndex]) - 1; | 886 levelIndexes.lowerBound(timeWindowRight, (time, entryIndex) => time -
entryStartTimes[entryIndex]) - 1; |
| 886 var lastDrawOffset = Infinity; | 887 var lastDrawOffset = Infinity; |
| 887 | 888 |
| 888 for (var entryIndexOnLevel = rightIndexOnLevel; entryIndexOnLevel >= 0; --
entryIndexOnLevel) { | 889 for (var entryIndexOnLevel = rightIndexOnLevel; entryIndexOnLevel >= 0; --
entryIndexOnLevel) { |
| 889 const entryIndex = levelIndexes[entryIndexOnLevel]; | 890 const entryIndex = levelIndexes[entryIndexOnLevel]; |
| 890 const entryStartTime = entryStartTimes[entryIndex]; | 891 const entryStartTime = entryStartTimes[entryIndex]; |
| 891 const barX = this._timeToPositionClipped(entryStartTime); | 892 const barX = this._timeToPositionClipped(entryStartTime); |
| 892 const entryEndTime = entryStartTime + entryTotalTimes[entryIndex]; | 893 const entryEndTime = entryStartTime + entryTotalTimes[entryIndex]; |
| 893 if (isNaN(entryEndTime) || barX >= lastDrawOffset) | 894 if (isNaN(entryEndTime) || barX >= lastDrawOffset) |
| 894 continue; | 895 continue; |
| 895 if (entryEndTime <= timeWindowLeft) | 896 if (entryEndTime <= timeWindowLeft) |
| 896 break; | 897 break; |
| 897 lastDrawOffset = barX; | 898 lastDrawOffset = barX; |
| 898 const color = this._dataProvider.entryColor(entryIndex); | 899 const color = this._dataProvider.entryColor(entryIndex); |
| 899 const endBarX = this._timeToPositionClipped(entryEndTime); | 900 const endBarX = this._timeToPositionClipped(entryEndTime); |
| 900 if (group.style.useDecoratorsForOverview && this._dataProvider.forceDeco
ration(entryIndex)) { | 901 if (group.style.useDecoratorsForOverview && this._dataProvider.forceDeco
ration(entryIndex)) { |
| 901 const unclippedBarX = this._timeToPosition(entryStartTime); | 902 const unclippedBarX = this._timeToPosition(entryStartTime); |
| 902 const barWidth = endBarX - barX; | 903 const barWidth = endBarX - barX; |
| 903 context.beginPath(); | 904 context.beginPath(); |
| 904 context.fillStyle = color; | 905 context.fillStyle = color; |
| 905 context.fillRect(barX, y, barWidth, barHeight); | 906 context.fillRect(barX, y, barWidth, barHeight - 1); |
| 906 this._dataProvider.decorateEntry( | 907 this._dataProvider.decorateEntry( |
| 907 entryIndex, context, '', barX, y, barWidth, this._barHeight, uncli
ppedBarX, this._timeToPixel); | 908 entryIndex, context, '', barX, y, barWidth, barHeight, unclippedBa
rX, this._timeToPixel); |
| 908 continue; | 909 continue; |
| 909 } | 910 } |
| 910 range.append(new Common.Segment(barX, endBarX, color)); | 911 range.append(new Common.Segment(barX, endBarX, color)); |
| 911 } | 912 } |
| 912 } | 913 } |
| 913 | 914 |
| 914 var segments = range.segments().slice().sort((a, b) => a.data.localeCompare(
b.data)); | 915 var segments = range.segments().slice().sort((a, b) => a.data.localeCompare(
b.data)); |
| 915 var lastColor; | 916 var lastColor; |
| 916 context.beginPath(); | 917 context.beginPath(); |
| 917 for (var i = 0; i < segments.length; ++i) { | 918 for (var i = 0; i < segments.length; ++i) { |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 } | 1528 } |
| 1528 | 1529 |
| 1529 /** | 1530 /** |
| 1530 * @override | 1531 * @override |
| 1531 * @return {number} | 1532 * @return {number} |
| 1532 */ | 1533 */ |
| 1533 boundarySpan() { | 1534 boundarySpan() { |
| 1534 return this._maximumBoundaries - this._minimumBoundaries; | 1535 return this._maximumBoundaries - this._minimumBoundaries; |
| 1535 } | 1536 } |
| 1536 }; | 1537 }; |
| OLD | NEW |