mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Add epaint::Brush for controlling RectShape texturing (#5565)
Also wraps `Shape::Mesh` in an `Arc`. No new features, but decreases size of `Shape` from 72 bytes to 64.
This commit is contained in:
@@ -1406,7 +1406,7 @@ impl Tessellator {
|
||||
return;
|
||||
}
|
||||
|
||||
out.append(mesh);
|
||||
out.append_ref(&mesh);
|
||||
}
|
||||
Shape::LineSegment { points, stroke } => {
|
||||
self.tessellate_line_segment(points, stroke, out);
|
||||
@@ -1693,14 +1693,14 @@ impl Tessellator {
|
||||
/// * `rect`: the rectangle to tessellate.
|
||||
/// * `out`: triangles are appended to this.
|
||||
pub fn tessellate_rect(&mut self, rect: &RectShape, out: &mut Mesh) {
|
||||
let brush = rect.brush.as_ref();
|
||||
let RectShape {
|
||||
mut rect,
|
||||
mut rounding,
|
||||
fill,
|
||||
stroke,
|
||||
mut blur_width,
|
||||
fill_texture_id,
|
||||
uv,
|
||||
..
|
||||
} = *rect;
|
||||
|
||||
if self.options.coarse_tessellation_culling
|
||||
@@ -1775,7 +1775,11 @@ impl Tessellator {
|
||||
path.add_line_loop(&self.scratchpad_points);
|
||||
let path_stroke = PathStroke::from(stroke).outside();
|
||||
|
||||
if uv.is_positive() {
|
||||
if let Some(brush) = brush {
|
||||
let crate::Brush {
|
||||
fill_texture_id,
|
||||
uv,
|
||||
} = **brush;
|
||||
// Textured
|
||||
let uv_from_pos = |p: Pos2| {
|
||||
pos2(
|
||||
@@ -2173,7 +2177,7 @@ impl Tessellator {
|
||||
|
||||
profiling::scope!("distribute results", tessellated.len().to_string());
|
||||
for (index, mesh) in tessellated {
|
||||
shapes[index].shape = Shape::Mesh(mesh);
|
||||
shapes[index].shape = Shape::Mesh(mesh.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user