OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
4 * Copyright (C) 2009 Google Inc. All rights reserved. | 4 * Copyright (C) 2009 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 } | 148 } |
149 context.moveTo(position, 0); | 149 context.moveTo(position, 0); |
150 context.lineTo(position, height); | 150 context.lineTo(position, height); |
151 context.stroke(); | 151 context.stroke(); |
152 lastTime = time; | 152 lastTime = time; |
153 lastPosition = position; | 153 lastPosition = position; |
154 } | 154 } |
155 context.restore(); | 155 context.restore(); |
156 }, | 156 }, |
157 | 157 |
158 /** | |
159 * @param {!Object} canvas | |
160 * @param {!WebInspector.TimelineGrid.Calculator} calculator | |
161 * @param {?Array.<!WebInspector.FlameChartDataProvider.Marker>} markers | |
162 */ | |
163 WebInspector.TimelineGrid.drawTimelineMarkers = function(canvas, calculator, mar kers) | |
164 { | |
165 var context = canvas.getContext("2d"); | |
166 context.save(); | |
167 var ratio = window.devicePixelRatio; | |
168 context.scale(ratio, ratio); | |
169 var height = WebInspector.FlameChart.DividersBarHeight - 1; | |
170 context.lineWidth = 2; | |
alph
2014/07/21 12:05:30
it should depend on devicePixelRatio
yurys
2014/07/21 13:49:47
There is already a call to context.scale above.
| |
171 context.translate(0.5, 0.5); | |
alph
2014/07/21 12:05:30
You need to translate by 0.5 iff lineWidth is odd.
yurys
2014/07/21 13:49:47
Done.
| |
172 for (var i = 0; i < markers.length; ++i) { | |
173 var marker = markers[i]; | |
174 var position = calculator.computePosition(marker.timestamp); | |
175 context.strokeStyle = marker.color; | |
176 context.beginPath(); | |
177 context.moveTo(position, 0); | |
178 context.lineTo(position, height); | |
179 context.stroke(); | |
180 } | |
181 context.restore(); | |
182 }, | |
183 | |
184 | |
158 WebInspector.TimelineGrid.prototype = { | 185 WebInspector.TimelineGrid.prototype = { |
159 get dividersElement() | 186 get dividersElement() |
160 { | 187 { |
161 return this._dividersElement; | 188 return this._dividersElement; |
162 }, | 189 }, |
163 | 190 |
164 get dividersLabelBarElement() | 191 get dividersLabelBarElement() |
165 { | 192 { |
166 return this._dividersLabelBarElement; | 193 return this._dividersLabelBarElement; |
167 }, | 194 }, |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 | 371 |
345 /** @return {number} */ | 372 /** @return {number} */ |
346 zeroTime: function() { }, | 373 zeroTime: function() { }, |
347 | 374 |
348 /** @return {number} */ | 375 /** @return {number} */ |
349 maximumBoundary: function() { }, | 376 maximumBoundary: function() { }, |
350 | 377 |
351 /** @return {number} */ | 378 /** @return {number} */ |
352 boundarySpan: function() { } | 379 boundarySpan: function() { } |
353 } | 380 } |
OLD | NEW |