Reuse last buffer in Frame if mesh_style matches

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 04:33:54 +01:00
parent d53e262425
commit 20a0577034
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
4 changed files with 53 additions and 42 deletions

View file

@ -2,8 +2,8 @@
use crate::gradient::Gradient;
use crate::layer::mesh;
use iced_native::Color;
use crate::widget::canvas::frame::Transform;
use iced_native::Color;
/// The style used to fill geometry.
#[derive(Debug, Clone)]
@ -64,9 +64,7 @@ impl<'a> Style<'a> {
/// Converts a fill's [Style] to a [mesh::Style] for use in the renderer's shader.
pub(crate) fn as_mesh_style(&self, transform: &Transform) -> mesh::Style {
match self {
Style::Solid(color) => {
mesh::Style::Solid(*color)
},
Style::Solid(color) => mesh::Style::Solid(*color),
Style::Gradient(gradient) => mesh::Style::Gradient(
transform.transform_gradient((*gradient).clone()),
),