From 0c75b450750a8082501ef9f4f0cbb082f73692c9 Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Mon, 2 Nov 2015 19:57:13 -0500 Subject: [PATCH] Save the context of the full image as well. --- src/imagetilesource.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/imagetilesource.js b/src/imagetilesource.js index 9f8796db..7563ce40 100644 --- a/src/imagetilesource.js +++ b/src/imagetilesource.js @@ -234,12 +234,8 @@ return levels; } - var currentWidth = Math.floor(image.naturalWidth / 2); - var currentHeight = Math.floor(image.naturalHeight / 2); - - if (currentWidth < minWidth || currentHeight < minHeight) { - return levels; - } + var currentWidth = image.naturalWidth; + var currentHeight = image.naturalHeight; var bigCanvas = document.createElement("canvas"); var bigContext = bigCanvas.getContext("2d"); @@ -247,16 +243,12 @@ bigCanvas.width = currentWidth; bigCanvas.height = currentHeight; bigContext.drawImage(image, 0, 0, currentWidth, currentHeight); + levels[0].context2D = bigContext; if ($.isCanvasTainted(bigContext.canvas)) { // If the canvas is tainted, we can't compute the pyramid. return levels; } - levels.splice(0, 0, { - context2D: bigContext, - width: currentWidth, - height: currentHeight - }); while (currentWidth >= minWidth * 2 && currentHeight >= minHeight * 2) { currentWidth = Math.floor(currentWidth / 2);