Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper dither re-enabled #1045

Merged
merged 4 commits into from Apr 3, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Doug's extract_bytes() fix

  • Loading branch information
kvark committed Mar 31, 2017
commit 58900ba9996d1f9326d91366a35c8498e77279e7
@@ -197,19 +197,19 @@ pub struct PackedTexel {

impl PackedTexel {
pub fn high_bytes(color: &ColorF) -> PackedTexel {
Self::extract_bytes(color, COLOR_FLOAT_TO_FIXED)
Self::extract_bytes(color, 8)
}

pub fn low_bytes(color: &ColorF) -> PackedTexel {
Self::extract_bytes(color, COLOR_FLOAT_TO_FIXED_WIDE)
Self::extract_bytes(color, 0)
}

fn extract_bytes(color: &ColorF, multiplier: f32) -> PackedTexel {
fn extract_bytes(color: &ColorF, shift_by: i32) -> PackedTexel {
PackedTexel {
b: ((0.5 + color.b * multiplier).floor() as u32 & 0xff) as u8,
g: ((0.5 + color.g * multiplier).floor() as u32 & 0xff) as u8,
r: ((0.5 + color.r * multiplier).floor() as u32 & 0xff) as u8,
a: ((0.5 + color.a * multiplier).floor() as u32 & 0xff) as u8,
b: ((0.5 + color.b * COLOR_FLOAT_TO_FIXED_WIDE).floor() as u32 >> shift_by & 0xff) as u8,
g: ((0.5 + color.g * COLOR_FLOAT_TO_FIXED_WIDE).floor() as u32 >> shift_by & 0xff) as u8,
r: ((0.5 + color.r * COLOR_FLOAT_TO_FIXED_WIDE).floor() as u32 >> shift_by & 0xff) as u8,
a: ((0.5 + color.a * COLOR_FLOAT_TO_FIXED_WIDE).floor() as u32 >> shift_by & 0xff) as u8,
}
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.