Skip to content

Commit

Permalink
Ensure replacement color is positive (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreban authored Apr 20, 2021
1 parent 7b0fec4 commit aa41b64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/lib/ImageHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class ImageHelper {
// See https://github.com/GoogleChromeLabs/bubblewrap/issues/488#issuecomment-806560923.
if (backgroundColor && image.hasAlpha()) {
// The replacement colour is the same as the background colour, but fully transparent.
const replacementColor = (backgroundColor.rgbNumber() << 8) & 0xFFFFFF00;
const replacementColor = ((backgroundColor.rgbNumber() << 8) & 0xFFFFFF00) >>> 0;

// Iterate over the pixels, check for fully transparent ones and replace with
// replacementColor.
Expand Down

0 comments on commit aa41b64

Please sign in to comment.