diff --git a/src/core/jbig2.js b/src/core/jbig2.js index c0beebcdf..d7cd398ff 100644 --- a/src/core/jbig2.js +++ b/src/core/jbig2.js @@ -955,7 +955,7 @@ var Jbig2Image = (function Jbig2ImageClosure() { onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) { this.currentPageInfo = info; var rowSize = (info.width + 7) >> 3; - var buffer = new Uint8Array(rowSize * info.height); + var buffer = new Uint8ClampedArray(rowSize * info.height); // The contents of ArrayBuffers are initialized to 0. // Fill the buffer with 0xFF only if info.defaultPixelValue is set if (info.defaultPixelValue) { diff --git a/src/core/jpx.js b/src/core/jpx.js index d6925b44a..7d5490df1 100644 --- a/src/core/jpx.js +++ b/src/core/jpx.js @@ -1386,7 +1386,7 @@ var JpxImage = (function JpxImageClosure() { transformedTiles[c] = transformTile(context, tile, c); } var tile0 = transformedTiles[0]; - var out = new Uint8Array(tile0.items.length * componentsCount); + var out = new Uint8ClampedArray(tile0.items.length * componentsCount); var result = { left: tile0.left, top: tile0.top, diff --git a/src/core/stream.js b/src/core/stream.js index 17b764e6e..5aa78c392 100644 --- a/src/core/stream.js +++ b/src/core/stream.js @@ -991,7 +991,7 @@ var JpxStream = (function JpxStreamClosure() { if (tileCount === 1) { this.buffer = jpxImage.tiles[0].items; } else { - var data = new Uint8Array(width * height * componentsCount); + var data = new Uint8ClampedArray(width * height * componentsCount); for (var k = 0; k < tileCount; k++) { var tileComponents = jpxImage.tiles[k];