seperate page fetch and render times

This commit is contained in:
Andreas Gal 2011-05-12 23:35:23 -07:00
parent a9a16ccb8a
commit 59326891d9

View File

@ -45,10 +45,14 @@ function xhrstate() {
} }
function displayPage(num) { function displayPage(num) {
var start = Date.now();
var page = pdf.getPage(pageNum = num);
pageDisplay.value = num; pageDisplay.value = num;
var t0 = Date.now();
var page = pdf.getPage(pageNum = num);
var t1 = Date.now();
var ctx = canvas.getContext("2d"); var ctx = canvas.getContext("2d");
ctx.save(); ctx.save();
ctx.fillStyle = "rgb(255, 255, 255)"; ctx.fillStyle = "rgb(255, 255, 255)";
@ -57,7 +61,10 @@ function displayPage(num) {
var gfx = new CanvasGraphics(ctx); var gfx = new CanvasGraphics(ctx);
page.display(gfx); page.display(gfx);
timeDisplay.innerHTML = (Date.now() - start) + "ms";
var t2 = Date.now();
timeDisplay.innerHTML = (t1 - t0) + "/" + (t2 - t1) + " ms";
} }
function nextPage() { function nextPage() {