forked from qt-creator/qt-creator
QmlProfiler: take the left border into account when painting time marks
Without this the time marks are 1 pixel off in relation to the main view. Change-Id: Iee8aaee447fedb9c57934c8089874414d9000995 Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
@@ -54,17 +54,18 @@ Canvas {
|
||||
context.fillStyle = "white";
|
||||
context.fillRect(0, 0, width, height);
|
||||
|
||||
var realWidth = width - 1; // account for left border
|
||||
var totalTime = endTime - startTime;
|
||||
var spacing = width / totalTime;
|
||||
var spacing = realWidth / totalTime;
|
||||
|
||||
var initialBlockLength = 120;
|
||||
var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / width * initialBlockLength ) / Math.LN2 ) );
|
||||
var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / realWidth * initialBlockLength ) / Math.LN2 ) );
|
||||
var pixelsPerBlock = timePerBlock * spacing;
|
||||
var pixelsPerSection = pixelsPerBlock / 5;
|
||||
var blockCount = width / pixelsPerBlock;
|
||||
var blockCount = realWidth / pixelsPerBlock;
|
||||
|
||||
var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock;
|
||||
var realStartPos = (startTime-realStartTime) * spacing;
|
||||
var realStartPos = (startTime - realStartTime) * spacing - 1;
|
||||
|
||||
timePerPixel = timePerBlock/pixelsPerBlock;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user