Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: Source/devtools/front_end/timeline/TimelineEventOverview.js

Issue 1179413007: DevTools: Tune frame rate bar on events overview for hidpi (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 var ctx = this._context; 369 var ctx = this._context;
370 var y = baseY + 10; 370 var y = baseY + 10;
371 if (!frames.length) 371 if (!frames.length)
372 return height; 372 return height;
373 373
374 ctx.save(); 374 ctx.save();
375 ctx.translate(0, position * window.devicePixelRatio); 375 ctx.translate(0, position * window.devicePixelRatio);
376 ctx.beginPath(); 376 ctx.beginPath();
377 ctx.rect(0, 0, this._canvas.width, height * window.devicePixelRatio); 377 ctx.rect(0, 0, this._canvas.width, height * window.devicePixelRatio);
378 ctx.clip(); 378 ctx.clip();
379 ctx.lineWidth = window.devicePixelRatio;
380 379
381 this._drawHorizontalGuide(baseY - visualHeight - 0.5, WebInspector.UIStr ing("60\u2009fps")); 380 this._drawHorizontalGuide(baseY - visualHeight - 0.5, WebInspector.UIStr ing("60\u2009fps"));
382 381
382 var lineWidth = window.devicePixelRatio;
383 var offset = lineWidth & 1 ? 0.5 : 0;
384 var tickDepth = 1.5 * window.devicePixelRatio;
383 ctx.beginPath(); 385 ctx.beginPath();
384 ctx.moveTo(0, y); 386 ctx.moveTo(0, y);
385 for (var i = 0; i < frames.length; ++i) { 387 for (var i = 0; i < frames.length; ++i) {
386 var frame = frames[i]; 388 var frame = frames[i];
387 var x = Math.round((frame.startTime - timeOffset) * scale) + 0.5; 389 var x = Math.round((frame.startTime - timeOffset) * scale) + offset;
388 ctx.lineTo(x, y); 390 ctx.lineTo(x, y);
389 ctx.lineTo(x, y + 1.5); 391 ctx.lineTo(x, y + tickDepth);
390 y = frame.idle ? baseY + 0.5 : Math.round(baseY - visualHeight * Mat h.min(baseFrameDurationMs / frame.duration, 1)) - 0.5; 392 y = frame.idle ? baseY + 1 : Math.round(baseY - visualHeight * Math. min(baseFrameDurationMs / frame.duration, 1)) - offset;
391 ctx.lineTo(x, y + 1.5); 393 ctx.lineTo(x, y + tickDepth);
392 ctx.lineTo(x, y); 394 ctx.lineTo(x, y);
393 } 395 }
394 if (frames.length) { 396 if (frames.length) {
395 var lastFrame = frames.peekLast(); 397 var lastFrame = frames.peekLast();
396 var x = Math.round((lastFrame.startTime + lastFrame.duration - timeO ffset) * scale) + 0.5; 398 var x = Math.round((lastFrame.startTime + lastFrame.duration - timeO ffset) * scale) + offset;
397 ctx.lineTo(x, y); 399 ctx.lineTo(x, y);
398 } 400 }
399 ctx.lineTo(x, baseY + 10); 401 ctx.lineTo(x, baseY + 10);
400 ctx.fillStyle = "hsl(110, 50%, 88%)"; 402 ctx.fillStyle = "hsl(110, 50%, 88%)";
401 ctx.strokeStyle = "hsl(110, 50%, 60%)"; 403 ctx.strokeStyle = "hsl(110, 50%, 60%)";
404 ctx.lineWidth = lineWidth;
402 ctx.fill(); 405 ctx.fill();
403 ctx.stroke(); 406 ctx.stroke();
404 ctx.restore(); 407 ctx.restore();
405 return height; 408 return height;
406 }, 409 },
407 410
408 /** 411 /**
409 * @param {number} y 412 * @param {number} y
410 * @param {string} label 413 * @param {string} label
411 */ 414 */
412 _drawHorizontalGuide: function(y, label) 415 _drawHorizontalGuide: function(y, label)
413 { 416 {
414 var ctx = this._context; 417 var ctx = this._context;
415 ctx.save(); 418 ctx.save();
419 ctx.translate(0, y);
420 ctx.scale(window.devicePixelRatio, window.devicePixelRatio);
416 ctx.beginPath(); 421 ctx.beginPath();
417 ctx.moveTo(0, y); 422 ctx.moveTo(0, 0);
418 ctx.lineTo(this._canvas.width, y); 423 ctx.lineTo(this._canvas.width, 0);
419 ctx.strokeStyle = "hsl(0, 0%, 85%)"; 424 ctx.strokeStyle = "hsl(0, 0%, 85%)";
420 ctx.setLineDash([3]); 425 ctx.setLineDash([3]);
426 ctx.lineWidth = 1;
421 ctx.stroke(); 427 ctx.stroke();
422 ctx.fillStyle = "hsl(0, 0%, 65%)"; 428 ctx.fillStyle = "hsl(0, 0%, 70%)";
423 ctx.font = "9px " + WebInspector.fontFamily(); 429 ctx.font = "9px " + WebInspector.fontFamily();
424 ctx.fillText(label, 4, y + 8); 430 ctx.fillText(label, 4, 9);
425 ctx.restore(); 431 ctx.restore();
426 }, 432 },
427 433
428 _onCategoryVisibilityChanged: function() 434 _onCategoryVisibilityChanged: function()
429 { 435 {
430 this.update(); 436 this.update();
431 }, 437 },
432 438
433 /** 439 /**
434 * @param {number} begin 440 * @param {number} begin
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 counters[group] = this._quantDuration; 603 counters[group] = this._quantDuration;
598 this._callback(counters); 604 this._callback(counters);
599 interval -= this._quantDuration; 605 interval -= this._quantDuration;
600 } 606 }
601 this._counters = []; 607 this._counters = [];
602 this._counters[group] = interval; 608 this._counters[group] = interval;
603 this._lastTime = time; 609 this._lastTime = time;
604 this._remainder = this._quantDuration - interval; 610 this._remainder = this._quantDuration - interval;
605 } 611 }
606 } 612 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698