| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 | 326 |
| 327 /** | 327 /** |
| 328 * @param {!WebInspector.FlameChartDataProvider} dataProvider | 328 * @param {!WebInspector.FlameChartDataProvider} dataProvider |
| 329 * @param {!WebInspector.FlameChart.TimelineData} timelineData | 329 * @param {!WebInspector.FlameChart.TimelineData} timelineData |
| 330 * @param {!Object} context | 330 * @param {!Object} context |
| 331 * @param {!number} width | 331 * @param {!number} width |
| 332 * @param {!number} height | 332 * @param {!number} height |
| 333 */ | 333 */ |
| 334 WebInspector.CPUProfileFlameChart.OverviewPane.drawOverviewCanvas = function(dat
aProvider, timelineData, context, width, height) | 334 WebInspector.CPUProfileFlameChart.OverviewPane.drawOverviewCanvas = function(dat
aProvider, timelineData, context, width, height) |
| 335 { | 335 { |
| 336 var drawData = WebInspector.CPUProfileFlameChart.OverviewPane.calculateDrawD
ata(dataProvider, timelineData, width); | |
| 337 if (!drawData) | |
| 338 return; | |
| 339 | |
| 340 var ratio = window.devicePixelRatio; | 336 var ratio = window.devicePixelRatio; |
| 341 var canvasWidth = width * ratio; | 337 var canvasWidth = width * ratio; |
| 342 var canvasHeight = height * ratio; | 338 var canvasHeight = height * ratio; |
| 343 | 339 |
| 340 var drawData = WebInspector.CPUProfileFlameChart.OverviewPane.calculateDrawD
ata(dataProvider, timelineData, canvasWidth); |
| 341 if (!drawData) |
| 342 return; |
| 343 |
| 344 var yScaleFactor = canvasHeight / (dataProvider.maxStackDepth() * 1.1); | 344 var yScaleFactor = canvasHeight / (dataProvider.maxStackDepth() * 1.1); |
| 345 context.lineWidth = 1; | 345 context.lineWidth = 1; |
| 346 context.translate(0.5, 0.5); | 346 context.translate(0.5, 0.5); |
| 347 context.strokeStyle = "rgba(20,0,0,0.4)"; | 347 context.strokeStyle = "rgba(20,0,0,0.4)"; |
| 348 context.fillStyle = "rgba(214,225,254,0.8)"; | 348 context.fillStyle = "rgba(214,225,254,0.8)"; |
| 349 context.moveTo(-1, canvasHeight - 1); | 349 context.moveTo(-1, canvasHeight - 1); |
| 350 if (drawData) | 350 context.lineTo(-1, Math.round(canvasHeight - drawData[0] * yScaleFactor - 1)
); |
| 351 context.lineTo(-1, Math.round(height - drawData[0] * yScaleFactor - 1)); | |
| 352 var value; | 351 var value; |
| 353 for (var x = 0; x < width; ++x) { | 352 for (var x = 0; x < canvasWidth; ++x) { |
| 354 value = Math.round(canvasHeight - drawData[x] * yScaleFactor - 1); | 353 value = Math.round(canvasHeight - drawData[x] * yScaleFactor - 1); |
| 355 context.lineTo(x * ratio, value); | 354 context.lineTo(x, value); |
| 356 } | 355 } |
| 357 context.lineTo(canvasWidth + 1, value); | 356 context.lineTo(canvasWidth + 1, value); |
| 358 context.lineTo(canvasWidth + 1, canvasHeight - 1); | 357 context.lineTo(canvasWidth + 1, canvasHeight - 1); |
| 359 context.fill(); | 358 context.fill(); |
| 360 context.stroke(); | 359 context.stroke(); |
| 361 context.closePath(); | 360 context.closePath(); |
| 362 } | 361 } |
| OLD | NEW |