Skip to content

Commit

Permalink
Use a loop to copy png image data instead of Buffer.copy
Browse files Browse the repository at this point in the history
  • Loading branch information
blikblum committed Dec 23, 2018
1 parent ffdda49 commit acbeceb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/image/png.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class PNGImage {
let i = p = a = 0;
const len = pixels.length;
while (i < len) {
pixels.copy(imgData, p, i, i + colorCount);
p += colorCount;
i += colorCount;
for (let colorIndex = 0; colorIndex < colorCount; colorIndex++) {
imgData[p++] = pixels[i++];
}
alphaChannel[a++] = pixels[i++];
}

Expand Down

0 comments on commit acbeceb

Please sign in to comment.