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

@ -1,7 +1,7 @@
//! A collection of triangle primitives.
use crate::{Color, Point, Rectangle, triangle};
use crate::gradient::Gradient;
use crate::{triangle, Color, Point, Rectangle};
/// A mesh of triangles.
#[derive(Debug, Clone, Copy)]
@ -19,16 +19,16 @@ pub struct Mesh<'a> {
pub style: &'a Style,
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
/// Supported shaders for primitives.
pub enum Style {
/// Fill a primitive with a solid color.
Solid(Color),
/// Fill a primitive with an interpolated color.
Gradient(Gradient)
Gradient(Gradient),
}
impl <'a> Into<Style> for Gradient {
impl<'a> Into<Style> for Gradient {
fn into(self) -> Style {
match self {
Gradient::Linear(linear) => {