From 3b159a61b88a48a28dfa6c42eefedf8ac9ff4da1 Mon Sep 17 00:00:00 2001 From: gered Date: Mon, 1 May 2023 16:24:51 -0400 Subject: [PATCH] add inline annotations to some methods where i probably forgot before these don't really affect performance in any meaningful way, according to the benchmarks i just added. lol --- ggdt/src/graphics/bitmap/indexed/primitives.rs | 5 +++++ ggdt/src/graphics/bitmap/rgb/primitives.rs | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ggdt/src/graphics/bitmap/indexed/primitives.rs b/ggdt/src/graphics/bitmap/indexed/primitives.rs index c38e523..39d2dda 100644 --- a/ggdt/src/graphics/bitmap/indexed/primitives.rs +++ b/ggdt/src/graphics/bitmap/indexed/primitives.rs @@ -40,6 +40,7 @@ impl IndexedBitmap { /// Draws a line from x1,y1 to x2,y2 by blending the drawn pixels using the given blend map, /// or the color specified if the blend map does not include this color. + #[inline] pub fn blended_line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, color: u8, blend_map: &BlendMap) { if let Some(blend_mapping) = blend_map.get_mapping(color) { self.line_custom( @@ -56,6 +57,7 @@ impl IndexedBitmap { /// Draws a horizontal line from x1,y to x2,y by blending the drawn pixels using the given /// blend map, or the color specified if the blend map does not include this color. + #[inline] pub fn blended_horiz_line(&mut self, x1: i32, x2: i32, y: i32, color: u8, blend_map: &BlendMap) { if let Some(blend_mapping) = blend_map.get_mapping(color) { self.horiz_line_custom( @@ -71,6 +73,7 @@ impl IndexedBitmap { /// Draws a vertical line from x,y1 to x,y2 by blending the drawn pixels using the given blend /// map, or the color specified if the blend map does not include this color. + #[inline] pub fn blended_vert_line(&mut self, x: i32, y1: i32, y2: i32, color: u8, blend_map: &BlendMap) { if let Some(blend_mapping) = blend_map.get_mapping(color) { self.vert_line_custom( @@ -88,6 +91,7 @@ impl IndexedBitmap { /// drawn, assuming they are specifying the top-left and bottom-right corners respectively. /// The box is drawn by blending the drawn pixels using the given blend map, or the color /// specified if the blend map does not include this color. + #[inline] pub fn blended_rect(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, color: u8, blend_map: &BlendMap) { if let Some(blend_mapping) = blend_map.get_mapping(color) { self.rect_custom( @@ -106,6 +110,7 @@ impl IndexedBitmap { /// drawn, assuming they are specifying the top-left and bottom-right corners respectively. The /// filled box is draw by blending the drawn pixels using the given blend map, or the color /// specified if the blend map does not include this color. + #[inline] pub fn blended_filled_rect(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, color: u8, blend_map: &BlendMap) { if let Some(blend_mapping) = blend_map.get_mapping(color) { self.filled_rect_custom( diff --git a/ggdt/src/graphics/bitmap/rgb/primitives.rs b/ggdt/src/graphics/bitmap/rgb/primitives.rs index a4d91ad..6d9c4e0 100644 --- a/ggdt/src/graphics/bitmap/rgb/primitives.rs +++ b/ggdt/src/graphics/bitmap/rgb/primitives.rs @@ -25,6 +25,7 @@ impl RgbaBitmap { } /// Draws a line from x1,y1 to x2,y2 by blending the drawn pixels using the given blend function. + #[inline] pub fn blended_line(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, color: u32, blend: BlendFunction) { self.line_custom( x1, // @@ -37,6 +38,7 @@ impl RgbaBitmap { /// Draws a horizontal line from x1,y to x2,y by blending the drawn pixels using the given /// blend function. + #[inline] pub fn blended_horiz_line(&mut self, x1: i32, x2: i32, y: i32, color: u32, blend: BlendFunction) { self.horiz_line_custom( x1, // @@ -48,6 +50,7 @@ impl RgbaBitmap { /// Draws a vertical line from x,y1 to x,y2 by blending the drawn pixels using the given blend /// function. + #[inline] pub fn blended_vert_line(&mut self, x: i32, y1: i32, y2: i32, color: u32, blend: BlendFunction) { self.vert_line_custom( x, // @@ -60,6 +63,7 @@ impl RgbaBitmap { /// Draws an empty box (rectangle) using the points x1,y1 and x2,y2 to form the box to be /// drawn, assuming they are specifying the top-left and bottom-right corners respectively. /// The box is drawn by blending the drawn pixels using the given blend function. + #[inline] pub fn blended_rect(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, color: u32, blend: BlendFunction) { self.rect_custom( x1, // @@ -73,6 +77,7 @@ impl RgbaBitmap { /// Draws a filled box (rectangle) using the points x1,y1 and x2,y2 to form the box to be /// drawn, assuming they are specifying the top-left and bottom-right corners respectively. The /// filled box is draw by blending the drawn pixels using the given blend function. + #[inline] pub fn blended_filled_rect(&mut self, x1: i32, y1: i32, x2: i32, y2: i32, color: u32, blend: BlendFunction) { self.filled_rect_custom( x1, //