Skip to content

Commit

Permalink
Update dependencies and remove palette (2x improvement in compile tim…
Browse files Browse the repository at this point in the history
…e) (SecondHalfGames#143)

update dependencies and remove palette
  • Loading branch information
Uriopass authored Mar 16, 2024
1 parent 54de82b commit 6263f57
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions crates/yakui-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ edition = "2021"

[dependencies]
anymap = "0.12.1"
bitflags = "1.3.2"
glam = "0.24.2"
keyboard-types = { version = "0.6.2", default-features = false }
bitflags = "2.4.2"
glam = "0.25.0"
keyboard-types = { version = "0.7.0", default-features = false }
log = "0.4.17"
palette = "0.7.4"
fast-srgb8 = "1.0.0"
profiling = "1.0.6"
smallvec = "1.9.0"
thunderdome = "0.6.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/yakui-core/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub enum EventResponse {

bitflags::bitflags! {
/// A bitfield of events that a widget can register to be notified about.
#[derive(Default)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy, Default)]
pub struct EventInterest: u8 {
/// Notify this widget of mouse events occuring within its layout
/// rectangle.
Expand All @@ -140,6 +140,6 @@ bitflags::bitflags! {
const FOCUSED_KEYBOARD = 16;

/// Notify this widget of all mouse events.
const MOUSE_ALL = Self::MOUSE_INSIDE.bits | Self::MOUSE_OUTSIDE.bits | Self::MOUSE_MOVE.bits;
const MOUSE_ALL = Self::MOUSE_INSIDE.bits() | Self::MOUSE_OUTSIDE.bits() | Self::MOUSE_MOVE.bits();
}
}
17 changes: 9 additions & 8 deletions crates/yakui-core/src/geometry/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ impl Color {

/// Create a new `Color` from a linear RGB color.
pub fn from_linear(value: Vec4) -> Self {
let linear = palette::LinSrgba::new(value.x, value.y, value.z, value.w);
let (r, g, b, a) = palette::Srgba::<u8>::from_linear(linear).into_components();

let r = fast_srgb8::f32_to_srgb8(value.x);
let g = fast_srgb8::f32_to_srgb8(value.y);
let b = fast_srgb8::f32_to_srgb8(value.z);
let a = (value.w * 255.0).round() as u8;
Self::rgba(r, g, b, a)
}

Expand All @@ -70,11 +71,11 @@ impl Color {

/// Convert this color to a linear RGB color.
pub fn to_linear(&self) -> Vec4 {
palette::Srgba::new(self.r, self.g, self.b, self.a)
.into_format::<f32, f32>()
.into_linear()
.into_components()
.into()
let r = fast_srgb8::srgb8_to_f32(self.r);
let g = fast_srgb8::srgb8_to_f32(self.g);
let b = fast_srgb8::srgb8_to_f32(self.b);
let a = self.a as f32 / 255.0;
Vec4::new(r, g, b, a)
}

/// Blend with `other` in linear space
Expand Down
2 changes: 1 addition & 1 deletion crates/yakui-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2021"
yakui-core = { path = "../yakui-core", version = "0.2.0" }

wgpu = "0.19.0"
glam = { version = "0.24.2", features = ["bytemuck"] }
glam = { version = "0.25.0", features = ["bytemuck"] }
bytemuck = { version = "1.12.1", features = ["derive"] }
thunderdome = "0.6.0"
profiling = "1.0.6"

0 comments on commit 6263f57

Please sign in to comment.