1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

[epaint] Replace tuple (Rect, Shape) with tuple-struct ClippedShape

This commit is contained in:
Emil Ernerfeldt
2021-01-17 01:35:14 +01:00
parent 7b318887ee
commit 8598c365a1
7 changed files with 37 additions and 27 deletions

View File

@@ -61,7 +61,7 @@ pub use {
shape::Shape,
stats::PaintStats,
stroke::Stroke,
tessellator::{PaintJob, PaintJobs, TessellationOptions},
tessellator::TessellationOptions,
text::{Galley, TextStyle},
texture_atlas::{Texture, TextureAtlas},
triangles::{Triangles, Vertex},
@@ -101,3 +101,21 @@ pub(crate) struct PaintRect {
pub fill: Color32,
pub stroke: Stroke,
}
/// A [`Shape`] within a clip rectangle.
///
/// Everything is using logical points.
#[derive(Clone, Debug)]
pub struct ClippedShape(
/// Clip / scissor rectangle.
/// Only show the part of the [`shape`] that falls within this.
pub emath::Rect,
/// The shape
pub Shape,
);
/// A clip triangle and some textured triangles, all in points (logical pixels).
pub type PaintJob = (emath::Rect, Triangles);
/// Grouped by clip rectangles, in points (logical pixels).
pub type PaintJobs = Vec<PaintJob>;