File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1279,14 +1279,17 @@ function checkPutBinaryImageDataCompatibility() {
1279
1279
} catch (e ) {
1280
1280
CanvasGraphics .prototype .putBinaryImageData =
1281
1281
function CanvasGraphicsPutBinaryImageDataShim (ctx , imgData , w , h ) {
1282
- var tmpImgData = ctx .getImageData (0 , 0 , w , h );
1282
+ var tmpImgData = 'createImageData' in ctx ? ctx .createImageData (w , h ) :
1283
+ ctx .getImageData (0 , 0 , w , h );
1283
1284
1284
- // Copy over the imageData pixel by pixel.
1285
1285
var tmpImgDataPixels = tmpImgData .data ;
1286
- var len = tmpImgDataPixels .length ;
1287
-
1288
- while (len --) {
1289
- tmpImgDataPixels [len ] = imgData .data [len ];
1286
+ var data = imgData .data ;
1287
+ if ('set' in tmpImgDataPixels )
1288
+ tmpImgDataPixels .set (data );
1289
+ else {
1290
+ // Copy over the imageData pixel by pixel.
1291
+ for (var i = 0 , ii = tmpImgDataPixels .length ; i < ii ; i ++)
1292
+ tmpImgDataPixels [i ] = data [i ];
1290
1293
}
1291
1294
1292
1295
ctx .putImageData (tmpImgData , 0 , 0 );
You can’t perform that action at this time.
0 commit comments