Skip to content

Commit

Permalink
fix #7302, premultiply canvas images when updating texture
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Sep 20, 2018
1 parent a1233cb commit 212dc4a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/source/canvas_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,9 @@ class CanvasSource extends ImageSource {
}

if (!this.texture) {
this.texture = new Texture(context, this.canvas, gl.RGBA);
this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
} else if (resize) {
this.texture.update(this.canvas);
} else if (this._playing) {
this.texture.bind(gl.LINEAR, gl.CLAMP_TO_EDGE);
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, this.canvas);
this.texture = new Texture(context, this.canvas, gl.RGBA, { premultiply: true });
} else if (resize || this._playing) {
this.texture.update(this.canvas, { premultiply: true });
}

for (const w in this.tiles) {
Expand Down

0 comments on commit 212dc4a

Please sign in to comment.