We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f92d9c8 commit 6e2bca2Copy full SHA for 6e2bca2
src/util/rgba4444.rs
@@ -14,9 +14,10 @@ impl ColorMap for RGBA4444 {
14
15
#[inline(always)]
16
fn map_color(&self, color: &mut Rgba<u8>) {
17
- color[0] = (color[0] / 15) * 15;
18
- color[1] = (color[1] / 15) * 15;
19
- color[2] = (color[2] / 15) * 15;
20
- color[3] = (color[3] / 15) * 15;
+ let convert = |x: u8| (x as f32 / 255.0 * 15.0) as u8 * (255 / 15);
+ color[0] = convert(color[0]);
+ color[1] = convert(color[1]);
+ color[2] = convert(color[2]);
21
+ color[3] = convert(color[3]);
22
}
23
0 commit comments