diff --git a/services/graphics-server/src/api/glyphstyle.rs b/services/graphics-server/src/api/glyphstyle.rs index c5c08b3c6..7c8679c0c 100644 --- a/services/graphics-server/src/api/glyphstyle.rs +++ b/services/graphics-server/src/api/glyphstyle.rs @@ -29,9 +29,9 @@ impl From for GlyphStyle { /// Convert style to number for use with register-based message passing sytems // [by bunnie for Xous] -impl Into for GlyphStyle { - fn into(self) -> usize { - match self { +impl From for usize { + fn from(g: GlyphStyle) -> usize { + match g { GlyphStyle::Small => 0, GlyphStyle::Regular => 1, GlyphStyle::Bold => 2, diff --git a/services/graphics-server/src/api/points.rs b/services/graphics-server/src/api/points.rs index c0a9fa29a..792ca1ad2 100644 --- a/services/graphics-server/src/api/points.rs +++ b/services/graphics-server/src/api/points.rs @@ -99,9 +99,9 @@ impl From<&Point> for (i16, i16) { } } -impl Into for Point { - fn into(self) -> usize { - (self.x as usize) << 16 | (self.y as usize) +impl From for usize { + fn from(point: Point) -> usize { + (point.x as usize) << 16 | (point.y as usize) } } diff --git a/services/graphics-server/src/api/shapes.rs b/services/graphics-server/src/api/shapes.rs index 8e2088499..718e54582 100644 --- a/services/graphics-server/src/api/shapes.rs +++ b/services/graphics-server/src/api/shapes.rs @@ -248,13 +248,13 @@ impl Rectangle { } } -impl Into for Rectangle { - fn into(self) -> ClipRect { +impl From for ClipRect { + fn from(rectangle: Rectangle) -> ClipRect { ClipRect::new( - self.x0() as _, - self.y0() as _, - self.x1() as _, - self.y1() as _, + rectangle.x0() as _, + rectangle.y0() as _, + rectangle.x1() as _, + rectangle.y1() as _, ) } } diff --git a/services/graphics-server/src/api/styles.rs b/services/graphics-server/src/api/styles.rs index ffeeaeb4d..efdfe5f85 100644 --- a/services/graphics-server/src/api/styles.rs +++ b/services/graphics-server/src/api/styles.rs @@ -16,9 +16,9 @@ impl From for PixelColor { } } -impl Into for PixelColor { - fn into(self) -> bool { - if self == PixelColor::Dark { +impl From for bool { + fn from(pc: PixelColor) -> bool { + if pc == PixelColor::Dark { true } else { false @@ -36,9 +36,9 @@ impl From for PixelColor { } } -impl Into for PixelColor { - fn into(self) -> usize { - if self == PixelColor::Light { +impl From for usize { + fn from(pc: PixelColor) -> usize { + if pc == PixelColor::Light { 0 } else { 1 @@ -103,11 +103,11 @@ impl From for DrawStyle { } } -impl Into for DrawStyle { - fn into(self) -> usize { +impl From for usize { + fn from(draw_style: DrawStyle) -> usize { let sc: usize; - if self.stroke_color.is_some() { - if self.stroke_color.unwrap() == PixelColor::Dark { + if draw_style.stroke_color.is_some() { + if draw_style.stroke_color.unwrap() == PixelColor::Dark { sc = 0b11; } else { sc = 0b10; @@ -116,8 +116,8 @@ impl Into for DrawStyle { sc = 0; } let fc: usize; - if self.fill_color.is_some() { - if self.fill_color.unwrap() == PixelColor::Dark { + if draw_style.fill_color.is_some() { + if draw_style.fill_color.unwrap() == PixelColor::Dark { fc = 0b11; } else { fc = 0b10; @@ -126,7 +126,7 @@ impl Into for DrawStyle { } else { fc = 0; } - (self.stroke_width as usize) << 16 | sc << 2 | fc + (draw_style.stroke_width as usize) << 16 | sc << 2 | fc } } diff --git a/services/graphics-server/src/api/text.rs b/services/graphics-server/src/api/text.rs index 54beb1f58..0a10c2f19 100644 --- a/services/graphics-server/src/api/text.rs +++ b/services/graphics-server/src/api/text.rs @@ -58,9 +58,9 @@ pub enum TextOp { Render, ComputeBounds, // maybe we don't need this } -impl Into for TextOp { - fn into(self) -> usize { - match self { +impl From for usize { + fn from(op: TextOp) -> usize { + match op { TextOp::Nop => 0, TextOp::Render => 1, TextOp::ComputeBounds => 2,