Skip to content
Snippets Groups Projects
Commit e81d2661 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Make scale_rgb_channel_value() a bit smoother and avoid divide by zero.

parent 1878d784
Branches
Tags
No related merge requests found
......@@ -406,7 +406,9 @@ function redefine_palette(palette, bits)
// Scale from 6-bit to 8-bit RGB color channel
function scale_rgb_channel_value(val)
{
var newval = Math.ceil(0xff / (0x3f / (val&0x3f)));
val &= 0x3f;
var newval = (val << 2) | (val >> 4);
// log(LOG_DEBUG, format("scaled color channel from %d (%X) to %d (%x)", val, val, newval, newval));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment