Skip to content

Commit

Permalink
gdk: Avoid duplicate code on RGBA constants
Browse files Browse the repository at this point in the history
Use the new constructed instead.
  • Loading branch information
SeaDve authored and bilelmoussaoui committed Sep 3, 2023
1 parent 567d31e commit 0665f3c
Showing 1 changed file with 11 additions and 53 deletions.
64 changes: 11 additions & 53 deletions gdk4/src/rgba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,59 +208,17 @@ impl RGBA {
}
}

pub const BLACK: RGBA = Self {
inner: ffi::GdkRGBA {
red: 0f32,
green: 0f32,
blue: 0f32,
alpha: 1f32,
},
};

pub const BLUE: RGBA = Self {
inner: ffi::GdkRGBA {
red: 0f32,
green: 0f32,
blue: 1f32,
alpha: 1f32,
},
};

pub const GREEN: RGBA = Self {
inner: ffi::GdkRGBA {
red: 0f32,
green: 1f32,
blue: 0f32,
alpha: 1f32,
},
};

pub const RED: RGBA = Self {
inner: ffi::GdkRGBA {
red: 1f32,
green: 0f32,
blue: 0f32,
alpha: 1f32,
},
};

pub const WHITE: RGBA = Self {
inner: ffi::GdkRGBA {
red: 1f32,
green: 1f32,
blue: 1f32,
alpha: 1f32,
},
};

pub const TRANSPARENT: RGBA = Self {
inner: ffi::GdkRGBA {
red: 0f32,
green: 0f32,
blue: 0f32,
alpha: 0f32,
},
};
pub const BLACK: RGBA = Self::new(0f32, 0f32, 0f32, 1f32);

pub const BLUE: RGBA = Self::new(0f32, 0f32, 1f32, 1f32);

pub const GREEN: RGBA = Self::new(0f32, 1f32, 0f32, 1f32);

pub const RED: RGBA = Self::new(1f32, 0f32, 0f32, 1f32);

pub const WHITE: RGBA = Self::new(1f32, 1f32, 1f32, 1f32);

pub const TRANSPARENT: RGBA = Self::new(0f32, 0f32, 0f32, 0f32);
}

impl fmt::Debug for RGBA {
Expand Down

0 comments on commit 0665f3c

Please sign in to comment.