Introduce `viewport` to `Widget::draw`

This should eventually allow us to only generate primitives that are
visible.
This commit is contained in:
Héctor Ramón Jiménez 2020-08-18 03:37:32 +02:00
parent 24297b11ee
commit 4bd44e4ed2
31 changed files with 123 additions and 35 deletions

View File

@ -12,7 +12,7 @@ mod circle {
use iced_graphics::{Backend, Defaults, Primitive, Renderer}; use iced_graphics::{Backend, Defaults, Primitive, Renderer};
use iced_native::{ use iced_native::{
layout, mouse, Background, Color, Element, Hasher, Layout, Length, layout, mouse, Background, Color, Element, Hasher, Layout, Length,
Point, Size, Widget, Point, Rectangle, Size, Widget,
}; };
pub struct Circle { pub struct Circle {
@ -60,6 +60,7 @@ mod circle {
_defaults: &Defaults, _defaults: &Defaults,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) -> (Primitive, mouse::Interaction) { ) -> (Primitive, mouse::Interaction) {
( (
Primitive::Quad { Primitive::Quad {

View File

@ -15,8 +15,8 @@ mod rainbow {
Backend, Defaults, Primitive, Renderer, Backend, Defaults, Primitive, Renderer,
}; };
use iced_native::{ use iced_native::{
layout, mouse, Element, Hasher, Layout, Length, Point, Size, Vector, layout, mouse, Element, Hasher, Layout, Length, Point, Rectangle, Size,
Widget, Vector, Widget,
}; };
pub struct Rainbow; pub struct Rainbow;
@ -57,6 +57,7 @@ mod rainbow {
_defaults: &Defaults, _defaults: &Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> (Primitive, mouse::Interaction) { ) -> (Primitive, mouse::Interaction) {
let b = layout.bounds(); let b = layout.bounds();

View File

@ -96,10 +96,11 @@ where
widget: &dyn Widget<Message, Self>, widget: &dyn Widget<Message, Self>,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
color: Color, color: Color,
) -> Self::Output { ) -> Self::Output {
let (primitive, cursor) = let (primitive, cursor) =
widget.draw(self, defaults, layout, cursor_position); widget.draw(self, defaults, layout, cursor_position, viewport);
let mut primitives = Vec::new(); let mut primitives = Vec::new();

View File

@ -62,6 +62,7 @@ where
}, },
content_layout, content_layout,
cursor_position, cursor_position,
&bounds,
); );
( (

View File

@ -8,8 +8,8 @@
//! [`Frame`]: struct.Frame.html //! [`Frame`]: struct.Frame.html
use crate::{Backend, Defaults, Primitive, Renderer}; use crate::{Backend, Defaults, Primitive, Renderer};
use iced_native::{ use iced_native::{
layout, mouse, Clipboard, Element, Hasher, Layout, Length, Point, Size, layout, mouse, Clipboard, Element, Hasher, Layout, Length, Point,
Vector, Widget, Rectangle, Size, Vector, Widget,
}; };
use std::hash::Hash; use std::hash::Hash;
use std::marker::PhantomData; use std::marker::PhantomData;
@ -196,6 +196,7 @@ where
_defaults: &Defaults, _defaults: &Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> (Primitive, mouse::Interaction) { ) -> (Primitive, mouse::Interaction) {
let bounds = layout.bounds(); let bounds = layout.bounds();
let translation = Vector::new(bounds.x, bounds.y); let translation = Vector::new(bounds.x, bounds.y);

View File

@ -1,7 +1,7 @@
use crate::{Backend, Primitive, Renderer}; use crate::{Backend, Primitive, Renderer};
use iced_native::column; use iced_native::column;
use iced_native::mouse; use iced_native::mouse;
use iced_native::{Element, Layout, Point}; use iced_native::{Element, Layout, Point, Rectangle};
/// A container that distributes its contents vertically. /// A container that distributes its contents vertically.
pub type Column<'a, Message, Backend> = pub type Column<'a, Message, Backend> =
@ -17,6 +17,7 @@ where
content: &[Element<'_, Message, Self>], content: &[Element<'_, Message, Self>],
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Self::Output { ) -> Self::Output {
let mut mouse_interaction = mouse::Interaction::default(); let mut mouse_interaction = mouse::Interaction::default();
@ -26,8 +27,13 @@ where
.iter() .iter()
.zip(layout.children()) .zip(layout.children())
.map(|(child, layout)| { .map(|(child, layout)| {
let (primitive, new_mouse_interaction) = let (primitive, new_mouse_interaction) = child.draw(
child.draw(self, defaults, layout, cursor_position); self,
defaults,
layout,
cursor_position,
viewport,
);
if new_mouse_interaction > mouse_interaction { if new_mouse_interaction > mouse_interaction {
mouse_interaction = new_mouse_interaction; mouse_interaction = new_mouse_interaction;

View File

@ -24,6 +24,7 @@ where
defaults: &Defaults, defaults: &Defaults,
bounds: Rectangle, bounds: Rectangle,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
style_sheet: &Self::Style, style_sheet: &Self::Style,
content: &Element<'_, Message, Self>, content: &Element<'_, Message, Self>,
content_layout: Layout<'_>, content_layout: Layout<'_>,
@ -36,8 +37,13 @@ where
}, },
}; };
let (content, mouse_interaction) = let (content, mouse_interaction) = content.draw(
content.draw(self, &defaults, content_layout, cursor_position); self,
&defaults,
content_layout,
cursor_position,
viewport,
);
if let Some(background) = background(bounds, &style) { if let Some(background) = background(bounds, &style) {
( (

View File

@ -137,7 +137,7 @@ where
let (body, body_layout) = body; let (body, body_layout) = body;
let (body_primitive, body_interaction) = let (body_primitive, body_interaction) =
body.draw(self, defaults, body_layout, cursor_position); body.draw(self, defaults, body_layout, cursor_position, &bounds);
let background = crate::widget::container::background(bounds, &style); let background = crate::widget::container::background(bounds, &style);
@ -224,6 +224,7 @@ where
&defaults, &defaults,
controls_layout, controls_layout,
cursor_position, cursor_position,
&bounds,
); );
( (

View File

@ -1,7 +1,7 @@
use crate::{Backend, Primitive, Renderer}; use crate::{Backend, Primitive, Renderer};
use iced_native::mouse; use iced_native::mouse;
use iced_native::row; use iced_native::row;
use iced_native::{Element, Layout, Point}; use iced_native::{Element, Layout, Point, Rectangle};
/// A container that distributes its contents horizontally. /// A container that distributes its contents horizontally.
pub type Row<'a, Message, Backend> = pub type Row<'a, Message, Backend> =
@ -17,6 +17,7 @@ where
content: &[Element<'_, Message, Self>], content: &[Element<'_, Message, Self>],
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Self::Output { ) -> Self::Output {
let mut mouse_interaction = mouse::Interaction::default(); let mut mouse_interaction = mouse::Interaction::default();
@ -26,8 +27,13 @@ where
.iter() .iter()
.zip(layout.children()) .zip(layout.children())
.map(|(child, layout)| { .map(|(child, layout)| {
let (primitive, new_mouse_interaction) = let (primitive, new_mouse_interaction) = child.draw(
child.draw(self, defaults, layout, cursor_position); self,
defaults,
layout,
cursor_position,
viewport,
);
if new_mouse_interaction > mouse_interaction { if new_mouse_interaction > mouse_interaction {
mouse_interaction = new_mouse_interaction; mouse_interaction = new_mouse_interaction;

View File

@ -1,6 +1,7 @@
use crate::layout;
use crate::overlay;
use crate::{ use crate::{
layout, overlay, Clipboard, Color, Event, Hasher, Layout, Length, Point, Clipboard, Color, Event, Hasher, Layout, Length, Point, Rectangle, Widget,
Widget,
}; };
/// A generic [`Widget`]. /// A generic [`Widget`].
@ -260,9 +261,10 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
self.widget self.widget
.draw(renderer, defaults, layout, cursor_position) .draw(renderer, defaults, layout, cursor_position, viewport)
} }
/// Computes the _layout_ hash of the [`Element`]. /// Computes the _layout_ hash of the [`Element`].
@ -356,9 +358,10 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
self.widget self.widget
.draw(renderer, defaults, layout, cursor_position) .draw(renderer, defaults, layout, cursor_position, viewport)
} }
fn hash_layout(&self, state: &mut Hasher) { fn hash_layout(&self, state: &mut Hasher) {
@ -437,12 +440,14 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.explain( renderer.explain(
defaults, defaults,
self.element.widget.as_ref(), self.element.widget.as_ref(),
layout, layout,
cursor_position, cursor_position,
viewport,
self.color, self.color,
) )
} }

View File

@ -1,4 +1,4 @@
use crate::{Color, Layout, Point, Renderer, Widget}; use crate::{Color, Layout, Point, Rectangle, Renderer, Widget};
/// A renderer able to graphically explain a [`Layout`]. /// A renderer able to graphically explain a [`Layout`].
/// ///
@ -21,6 +21,7 @@ pub trait Debugger: Renderer {
widget: &dyn Widget<Message, Self>, widget: &dyn Widget<Message, Self>,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
color: Color, color: Color,
) -> Self::Output; ) -> Self::Output;
} }

View File

@ -253,9 +253,13 @@ where
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
) -> Renderer::Output { ) -> Renderer::Output {
let primitives = let primitives = self.container.draw(
self.container renderer,
.draw(renderer, defaults, layout, cursor_position); defaults,
layout,
cursor_position,
&layout.bounds(),
);
renderer.decorate( renderer.decorate(
layout.bounds(), layout.bounds(),
@ -368,6 +372,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
self::Renderer::draw( self::Renderer::draw(
renderer, renderer,

View File

@ -35,6 +35,7 @@ impl column::Renderer for Null {
_content: &[Element<'_, Message, Self>], _content: &[Element<'_, Message, Self>],
_layout: Layout<'_>, _layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) { ) {
} }
} }
@ -46,6 +47,7 @@ impl row::Renderer for Null {
_content: &[Element<'_, Message, Self>], _content: &[Element<'_, Message, Self>],
_layout: Layout<'_>, _layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) { ) {
} }
} }
@ -234,6 +236,7 @@ impl container::Renderer for Null {
_defaults: &Self::Defaults, _defaults: &Self::Defaults,
_bounds: Rectangle, _bounds: Rectangle,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
_style: &Self::Style, _style: &Self::Style,
_content: &Element<'_, Message, Self>, _content: &Element<'_, Message, Self>,
_content_layout: Layout<'_>, _content_layout: Layout<'_>,

View File

@ -1,4 +1,6 @@
use crate::{layout, overlay, Clipboard, Element, Event, Layout, Point, Size}; use crate::layout;
use crate::overlay;
use crate::{Clipboard, Element, Event, Layout, Point, Rectangle, Size};
use std::hash::Hasher; use std::hash::Hasher;
@ -327,6 +329,8 @@ where
renderer: &mut Renderer, renderer: &mut Renderer,
cursor_position: Point, cursor_position: Point,
) -> Renderer::Output { ) -> Renderer::Output {
let viewport = Rectangle::with_size(self.bounds);
let overlay = if let Some(mut overlay) = let overlay = if let Some(mut overlay) =
self.root.overlay(Layout::new(&self.base.layout)) self.root.overlay(Layout::new(&self.base.layout))
{ {
@ -365,6 +369,7 @@ where
&Renderer::Defaults::default(), &Renderer::Defaults::default(),
Layout::new(&self.base.layout), Layout::new(&self.base.layout),
base_cursor, base_cursor,
&viewport,
); );
renderer.overlay( renderer.overlay(
@ -378,6 +383,7 @@ where
&Renderer::Defaults::default(), &Renderer::Defaults::default(),
Layout::new(&self.base.layout), Layout::new(&self.base.layout),
cursor_position, cursor_position,
&viewport,
) )
} }
} }

View File

@ -70,7 +70,9 @@ pub use text::Text;
#[doc(no_inline)] #[doc(no_inline)]
pub use text_input::TextInput; pub use text_input::TextInput;
use crate::{layout, overlay, Clipboard, Event, Hasher, Layout, Length, Point}; use crate::{
layout, overlay, Clipboard, Event, Hasher, Layout, Length, Point, Rectangle,
};
/// A component that displays information and allows interaction. /// A component that displays information and allows interaction.
/// ///
@ -134,6 +136,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output; ) -> Renderer::Output;
/// Computes the _layout_ hash of the [`Widget`]. /// Computes the _layout_ hash of the [`Widget`].

View File

@ -215,6 +215,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw( renderer.draw(
defaults, defaults,

View File

@ -180,6 +180,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
let bounds = layout.bounds(); let bounds = layout.bounds();
let mut children = layout.children(); let mut children = layout.children();

View File

@ -1,9 +1,11 @@
//! Distribute content vertically. //! Distribute content vertically.
use std::hash::Hash; use std::hash::Hash;
use crate::layout;
use crate::overlay;
use crate::{ use crate::{
layout, overlay, Align, Clipboard, Element, Event, Hasher, Layout, Length, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, Rectangle,
Point, Widget, Widget,
}; };
use std::u32; use std::u32;
@ -185,8 +187,15 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw(defaults, &self.children, layout, cursor_position) renderer.draw(
defaults,
&self.children,
layout,
cursor_position,
viewport,
)
} }
fn hash_layout(&self, state: &mut Hasher) { fn hash_layout(&self, state: &mut Hasher) {
@ -240,6 +249,7 @@ pub trait Renderer: crate::Renderer + Sized {
content: &[Element<'_, Message, Self>], content: &[Element<'_, Message, Self>],
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Self::Output; ) -> Self::Output;
} }

View File

@ -191,11 +191,13 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw( renderer.draw(
defaults, defaults,
layout.bounds(), layout.bounds(),
cursor_position, cursor_position,
viewport,
&self.style, &self.style,
&self.content, &self.content,
layout.children().next().unwrap(), layout.children().next().unwrap(),
@ -242,6 +244,7 @@ pub trait Renderer: crate::Renderer {
defaults: &Self::Defaults, defaults: &Self::Defaults,
bounds: Rectangle, bounds: Rectangle,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
style: &Self::Style, style: &Self::Style,
content: &Element<'_, Message, Self>, content: &Element<'_, Message, Self>,
content_layout: Layout<'_>, content_layout: Layout<'_>,

View File

@ -1,5 +1,6 @@
//! Display images in your user interface. //! Display images in your user interface.
use crate::{layout, Element, Hasher, Layout, Length, Point, Size, Widget}; use crate::layout;
use crate::{Element, Hasher, Layout, Length, Point, Rectangle, Size, Widget};
use std::{ use std::{
hash::{Hash, Hasher as _}, hash::{Hash, Hasher as _},
@ -97,6 +98,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw(self.handle.clone(), layout) renderer.draw(self.handle.clone(), layout)
} }

View File

@ -588,6 +588,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
let picked_split = self let picked_split = self
.state .state

View File

@ -256,6 +256,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
self::Renderer::draw( self::Renderer::draw(
renderer, renderer,

View File

@ -104,6 +104,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw( renderer.draw(
layout.bounds(), layout.bounds(),

View File

@ -181,6 +181,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
let bounds = layout.bounds(); let bounds = layout.bounds();
let mut children = layout.children(); let mut children = layout.children();

View File

@ -1,11 +1,12 @@
//! Distribute content horizontally. //! Distribute content horizontally.
use std::hash::Hash; use crate::layout;
use crate::overlay;
use crate::{ use crate::{
layout, overlay, Align, Clipboard, Element, Event, Hasher, Layout, Length, Align, Clipboard, Element, Event, Hasher, Layout, Length, Point, Rectangle,
Point, Widget, Widget,
}; };
use std::hash::Hash;
use std::u32; use std::u32;
/// A container that distributes its contents horizontally. /// A container that distributes its contents horizontally.
@ -186,8 +187,15 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw(defaults, &self.children, layout, cursor_position) renderer.draw(
defaults,
&self.children,
layout,
cursor_position,
viewport,
)
} }
fn hash_layout(&self, state: &mut Hasher) { fn hash_layout(&self, state: &mut Hasher) {
@ -242,6 +250,7 @@ pub trait Renderer: crate::Renderer + Sized {
children: &[Element<'_, Message, Self>], children: &[Element<'_, Message, Self>],
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
viewport: &Rectangle,
) -> Self::Output; ) -> Self::Output;
} }

View File

@ -264,6 +264,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
let bounds = layout.bounds(); let bounds = layout.bounds();
let content_layout = layout.children().next().unwrap(); let content_layout = layout.children().next().unwrap();
@ -289,6 +290,10 @@ where
defaults, defaults,
content_layout, content_layout,
cursor_position, cursor_position,
&Rectangle {
y: bounds.y + offset as f32,
..bounds
},
) )
}; };

View File

@ -257,6 +257,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
let start = *self.range.start(); let start = *self.range.start();
let end = *self.range.end(); let end = *self.range.end();

View File

@ -71,6 +71,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw(layout.bounds()) renderer.draw(layout.bounds())
} }

View File

@ -1,5 +1,6 @@
//! Display vector graphics in your application. //! Display vector graphics in your application.
use crate::{layout, Element, Hasher, Layout, Length, Point, Size, Widget}; use crate::layout;
use crate::{Element, Hasher, Layout, Length, Point, Rectangle, Size, Widget};
use std::{ use std::{
hash::{Hash, Hasher as _}, hash::{Hash, Hasher as _},
@ -103,6 +104,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw(self.handle.clone(), layout) renderer.draw(self.handle.clone(), layout)
} }

View File

@ -149,6 +149,7 @@ where
defaults: &Renderer::Defaults, defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
_cursor_position: Point, _cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
renderer.draw( renderer.draw(
defaults, defaults,

View File

@ -493,6 +493,7 @@ where
_defaults: &Renderer::Defaults, _defaults: &Renderer::Defaults,
layout: Layout<'_>, layout: Layout<'_>,
cursor_position: Point, cursor_position: Point,
_viewport: &Rectangle,
) -> Renderer::Output { ) -> Renderer::Output {
let bounds = layout.bounds(); let bounds = layout.bounds();
let text_bounds = layout.children().next().unwrap().bounds(); let text_bounds = layout.children().next().unwrap().bounds();