mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-20 00:33:13 +03:00
Save the context of the full image as well.
This commit is contained in:
parent
37ca9235f8
commit
0c75b45075
@ -234,12 +234,8 @@
|
|||||||
return levels;
|
return levels;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentWidth = Math.floor(image.naturalWidth / 2);
|
var currentWidth = image.naturalWidth;
|
||||||
var currentHeight = Math.floor(image.naturalHeight / 2);
|
var currentHeight = image.naturalHeight;
|
||||||
|
|
||||||
if (currentWidth < minWidth || currentHeight < minHeight) {
|
|
||||||
return levels;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bigCanvas = document.createElement("canvas");
|
var bigCanvas = document.createElement("canvas");
|
||||||
var bigContext = bigCanvas.getContext("2d");
|
var bigContext = bigCanvas.getContext("2d");
|
||||||
@ -247,16 +243,12 @@
|
|||||||
bigCanvas.width = currentWidth;
|
bigCanvas.width = currentWidth;
|
||||||
bigCanvas.height = currentHeight;
|
bigCanvas.height = currentHeight;
|
||||||
bigContext.drawImage(image, 0, 0, currentWidth, currentHeight);
|
bigContext.drawImage(image, 0, 0, currentWidth, currentHeight);
|
||||||
|
levels[0].context2D = bigContext;
|
||||||
|
|
||||||
if ($.isCanvasTainted(bigContext.canvas)) {
|
if ($.isCanvasTainted(bigContext.canvas)) {
|
||||||
// If the canvas is tainted, we can't compute the pyramid.
|
// If the canvas is tainted, we can't compute the pyramid.
|
||||||
return levels;
|
return levels;
|
||||||
}
|
}
|
||||||
levels.splice(0, 0, {
|
|
||||||
context2D: bigContext,
|
|
||||||
width: currentWidth,
|
|
||||||
height: currentHeight
|
|
||||||
});
|
|
||||||
|
|
||||||
while (currentWidth >= minWidth * 2 && currentHeight >= minHeight * 2) {
|
while (currentWidth >= minWidth * 2 && currentHeight >= minHeight * 2) {
|
||||||
currentWidth = Math.floor(currentWidth / 2);
|
currentWidth = Math.floor(currentWidth / 2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user