Removing set-presence-in-ImageData check from canvas.js
This commit is contained in:
parent
ad623ffbb2
commit
30e00bc573
@ -507,20 +507,15 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
|||||||
|
|
||||||
} else if (imgData.kind === ImageKind.RGBA_32BPP) {
|
} else if (imgData.kind === ImageKind.RGBA_32BPP) {
|
||||||
// RGBA, 32-bits per pixel.
|
// RGBA, 32-bits per pixel.
|
||||||
var haveSetAndSubarray = 'set' in dest && 'subarray' in src;
|
|
||||||
|
|
||||||
for (var i = 0; i < totalChunks; i++) {
|
for (var i = 0; i < totalChunks; i++) {
|
||||||
var thisChunkHeight =
|
var thisChunkHeight =
|
||||||
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
|
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
|
||||||
var elemsInThisChunk = imgData.width * thisChunkHeight * 4;
|
var elemsInThisChunk = imgData.width * thisChunkHeight * 4;
|
||||||
if (haveSetAndSubarray) {
|
|
||||||
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
|
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
|
||||||
srcPos += elemsInThisChunk;
|
srcPos += elemsInThisChunk;
|
||||||
} else {
|
|
||||||
for (var j = 0; j < elemsInThisChunk; j++) {
|
|
||||||
dest[j] = src[srcPos++];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
|
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,3 +493,15 @@ if (typeof PDFJS === 'undefined') {
|
|||||||
PDFJS.disableHistory = true;
|
PDFJS.disableHistory = true;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
(function checkSetPresenceInImageData() {
|
||||||
|
if (window.CanvasPixelArray) {
|
||||||
|
if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
|
||||||
|
window.CanvasPixelArray.prototype.set = function(arr) {
|
||||||
|
for (var i = 0, ii = this.length; i < ii; i++) {
|
||||||
|
this[i] = arr[i];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user