File tree 2 files changed +16
-9
lines changed
2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -507,20 +507,15 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
507
507
508
508
} else if (imgData .kind === ImageKind .RGBA_32BPP ) {
509
509
// RGBA, 32-bits per pixel.
510
- var haveSetAndSubarray = 'set' in dest && 'subarray' in src ;
511
510
512
511
for (var i = 0 ; i < totalChunks ; i ++) {
513
512
var thisChunkHeight =
514
513
(i < fullChunks ) ? fullChunkHeight : partialChunkHeight ;
515
514
var elemsInThisChunk = imgData .width * thisChunkHeight * 4 ;
516
- if (haveSetAndSubarray ) {
517
- dest .set (src .subarray (srcPos , srcPos + elemsInThisChunk ));
518
- srcPos += elemsInThisChunk ;
519
- } else {
520
- for (var j = 0 ; j < elemsInThisChunk ; j ++) {
521
- dest [j ] = src [srcPos ++];
522
- }
523
- }
515
+
516
+ dest .set (src .subarray (srcPos , srcPos + elemsInThisChunk ));
517
+ srcPos += elemsInThisChunk ;
518
+
524
519
ctx .putImageData (chunkImgData , 0 , i * fullChunkHeight );
525
520
}
526
521
Original file line number Diff line number Diff line change @@ -524,3 +524,15 @@ if (typeof PDFJS === 'undefined') {
524
524
PDFJS .disableHistory = true ;
525
525
}
526
526
})();
527
+
528
+ (function checkSetPresenceInImageData () {
529
+ if (window .CanvasPixelArray ) {
530
+ if (typeof window .CanvasPixelArray .prototype .set !== 'function' ) {
531
+ window .CanvasPixelArray .prototype .set = function (arr ) {
532
+ for (var i = 0 , ii = this .length ; i < ii ; i ++) {
533
+ this [i ] = arr [i ];
534
+ }
535
+ };
536
+ }
537
+ }
538
+ })();
You can’t perform that action at this time.
0 commit comments