feat: bound scene visibility rendering and continuous native input
This commit is contained in:
@@ -79,7 +79,7 @@ impl SoftwareRenderer {
|
||||
let lod = (2048. / rect.width.max(rect.height)).min(1.);
|
||||
let w = (rect.width * lod).ceil().max(1.) as u32;
|
||||
let h = (rect.height * lod).ceil().max(1.) as u32;
|
||||
let surface = crate::scene3d::surface(view, w, h)?;
|
||||
let surface = crate::scene3d::surface(view, w, h, rect.width / rect.height)?;
|
||||
for y in top..bottom {
|
||||
for x in left..right {
|
||||
let u = (((x as f32 + 0.5 - rect.x) / rect.width) * w as f32)
|
||||
@@ -197,7 +197,13 @@ impl Canvas<'_> {
|
||||
fn draw_text(&mut self, origin: Point, value: &str, style: TextStyle, color: Color) {
|
||||
let x = origin.x.round() as i32;
|
||||
let y = origin.y.round() as i32;
|
||||
text::draw(value, style, color, |dx, dy, pixel| {
|
||||
let clip = Rect::new(
|
||||
self.clip.x - x as f32,
|
||||
self.clip.y - y as f32,
|
||||
self.clip.width,
|
||||
self.clip.height,
|
||||
);
|
||||
text::draw_clipped(value, style, color, None, clip, |dx, dy, pixel| {
|
||||
self.blend_pixel(x + dx, y + dy, pixel)
|
||||
});
|
||||
}
|
||||
@@ -217,9 +223,20 @@ impl Canvas<'_> {
|
||||
);
|
||||
let left = rect.x.round() as i32;
|
||||
let top = rect.y.round() as i32;
|
||||
text::draw_wrapped(value, style, color, rect.width, |dx, dy, pixel| {
|
||||
self.blend_pixel(left + dx, top + dy, pixel)
|
||||
});
|
||||
let clip = Rect::new(
|
||||
self.clip.x - left as f32,
|
||||
self.clip.y - top as f32,
|
||||
self.clip.width,
|
||||
self.clip.height,
|
||||
);
|
||||
text::draw_clipped(
|
||||
value,
|
||||
style,
|
||||
color,
|
||||
Some(rect.width),
|
||||
clip,
|
||||
|dx, dy, pixel| self.blend_pixel(left + dx, top + dy, pixel),
|
||||
);
|
||||
self.clip = old;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user