Reuse last buffer in Frame if mesh_style matches
This commit is contained in:
parent
d53e262425
commit
20a0577034
4 changed files with 53 additions and 42 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue