Skip to content

Commit

Permalink
Reset transIndex changes to fix tests (debug images were broken)
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Oct 24, 2016
1 parent 3a6c388 commit ddccb95
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/GIFEncoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function GIFEncoder(width, height, options) {
this.transparent = null;

// transparent index in color table
this.transIndex = null;
this.transIndex = 0;

// -1 = no repeat, 0 = forever. anything else is repeat count
this.repeat = -1;
Expand Down Expand Up @@ -277,15 +277,15 @@ GIFEncoder.prototype.analyzePixels = function() {
this.colorDepth = 8;
this.palSize = 7;

// get closest match to transparent color if specified
// find index for transparent color
if (this.transparent !== null) {
this.transIndex = imgq.lookupRGB(
(this.transparent & 0xFF0000) >> 16,
(this.transparent & 0x00FF00) >> 8,
(this.transparent & 0x0000FF)
);
} else {
this.transIndex = null;
this.transIndex = 0;
}
};

Expand Down Expand Up @@ -348,9 +348,7 @@ GIFEncoder.prototype.writeGraphicCtrlExt = function() {
);

this.writeShort(this.delay); // delay x 1/100 sec
if (this.transIndex !== null) {
this.writeByte(this.transIndex); // transparent color index
}
this.writeByte(this.transIndex); // transparent color index
this.writeByte(0); // block terminator
};

Expand Down

0 comments on commit ddccb95

Please sign in to comment.