From cc8a0a57a7f4563c27725ac0a596947f040d9138 Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 21 Feb 2025 23:42:01 +0800 Subject: [PATCH] fixup apis to use traits --- libs/ux-api/src/wordwrap.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/ux-api/src/wordwrap.rs b/libs/ux-api/src/wordwrap.rs index 4531fef66..cfcf067d1 100644 --- a/libs/ux-api/src/wordwrap.rs +++ b/libs/ux-api/src/wordwrap.rs @@ -128,7 +128,7 @@ impl ComposedType { /// Note: it is up to the caller to ensure that clip_rect is within the renderable screen area. We do no /// additional checks around this. - pub fn render(&self, frbuf: &mut [u32], offset: Point, invert: bool, clip_rect: Rectangle) { + pub fn render(&self, frbuf: &mut T, offset: Point, invert: bool, clip_rect: Rectangle) { const MAX_GLYPH_MARGIN: isize = 16; // let mut strpos; // just for debugging insertion points for word in self.words.iter() { @@ -159,18 +159,19 @@ impl ComposedType { } else { let cr = ClipRect::new(clip_rect.tl().x, clip_rect.tl().y, clip_rect.br().x, clip_rect.br().y); + let rawbuf = unsafe { frbuf.raw_mut() }; if glyph.large { blitstr2::xor_glyph_large( - frbuf, + rawbuf, (maybe_x, maybe_y), *glyph, glyph.invert ^ invert, cr, ); } else if !glyph.double { - blitstr2::xor_glyph(frbuf, (maybe_x, maybe_y), *glyph, glyph.invert ^ invert, cr); + blitstr2::xor_glyph(rawbuf, (maybe_x, maybe_y), *glyph, glyph.invert ^ invert, cr); } else { - blitstr2::xor_glyph_2x(frbuf, (maybe_x, maybe_y), *glyph, glyph.invert ^ invert, cr); + blitstr2::xor_glyph_2x(rawbuf, (maybe_x, maybe_y), *glyph, glyph.invert ^ invert, cr); } if glyph.insert { // log::info!("insert at {},{}", glyph.ch, strpos - 1);