Use Uint8ClampedArray
when returning image data in src/core/jbig2.js
and src/core/jpg.js
This commit is contained in:
parent
74ad90cb8f
commit
f6636d6b19
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user