Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,6 @@ impl From<Rgba8> for Bgra8 {
}
}

impl Into<Rgba8> for Bgra8 {
fn into(self) -> Rgba8 {
Rgba8 {
r: self.r,
g: self.g,
b: self.b,
a: self.a,
}
}
}

#[repr(C)]
#[derive(Copy, Clone, PartialEq, Debug, Default)]
pub struct Rgba {
Expand All @@ -120,6 +109,17 @@ impl Rgba {
}
}

impl From<Bgra8> for Rgba8 {
fn from(bgra: Bgra8) -> Rgba8 {
Rgba8 {
r: bgra.r,
g: bgra.g,
b: bgra.b,
a: bgra.a,
}
}
}

impl From<Rgba8> for Rgba {
fn from(rgba8: Rgba8) -> Self {
Self {
Expand All @@ -131,13 +131,13 @@ impl From<Rgba8> for Rgba {
}
}

impl Into<wgpu::Color> for Rgba {
fn into(self) -> wgpu::Color {
impl From<Rgba> for wgpu::Color {
fn from(rgba: Rgba) -> wgpu::Color {
wgpu::Color {
r: self.r as f64,
g: self.g as f64,
b: self.b as f64,
a: self.a as f64,
r: rgba.r as f64,
g: rgba.g as f64,
b: rgba.b as f64,
a: rgba.a as f64,
}
}
}
6 changes: 3 additions & 3 deletions src/swapchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ pub enum PresentMode {
NoVsync,
}

impl Into<wgpu::PresentMode> for PresentMode {
fn into(self) -> wgpu::PresentMode {
match self {
impl From<PresentMode> for wgpu::PresentMode {
fn from(present_mode: PresentMode) -> wgpu::PresentMode {
match present_mode {
PresentMode::Vsync => wgpu::PresentMode::Mailbox,
PresentMode::NoVsync => wgpu::PresentMode::Immediate,
}
Expand Down