PixelPusher-java icon indicating copy to clipboard operation
PixelPusher-java copied to clipboard

RGBW buffer logic likely wrong

Open cbiffle opened this issue 5 years ago • 0 comments

I haven't run the code, but I was driving by and I noticed this line. Which reads:

this.pixels = new Pixel[length * (3/4)]; // changing this to 3/4

3/4 in Java is an integer division expression that evaluates to zero. If you're trying to scale an integer by 3/4, removing the parentheses will get the right answer, assuming it doesn't overflow.

The corresponding logic to switch back out of RGBW seems to have the wrong multiplier, in addition to the zero bug.

cbiffle avatar Sep 10 '19 19:09 cbiffle