1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Merge pull request #4420 from prometheansacrifice/RemovingCheckSetPresence

Removing set-presence-in-ImageData check from canvas.js
This commit is contained in:
Yury Delendik 2014-03-13 08:31:53 -05:00
commit 31ea4e0f4d
2 changed files with 16 additions and 9 deletions

View file

@ -507,20 +507,15 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
} else if (imgData.kind === ImageKind.RGBA_32BPP) {
// RGBA, 32-bits per pixel.
var haveSetAndSubarray = 'set' in dest && 'subarray' in src;
for (var i = 0; i < totalChunks; i++) {
var thisChunkHeight =
(i < fullChunks) ? fullChunkHeight : partialChunkHeight;
var elemsInThisChunk = imgData.width * thisChunkHeight * 4;
if (haveSetAndSubarray) {
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
srcPos += elemsInThisChunk;
} else {
for (var j = 0; j < elemsInThisChunk; j++) {
dest[j] = src[srcPos++];
}
}
dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk));
srcPos += elemsInThisChunk;
ctx.putImageData(chunkImgData, 0, i * fullChunkHeight);
}