1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Refactor: turn ClippedShape from struct-enum to a normal struct (#3225)

This commit is contained in:
Emil Ernerfeldt
2023-08-10 14:50:11 +02:00
committed by GitHub
parent 66cbb61ad5
commit 83c18498e9
5 changed files with 26 additions and 13 deletions

View File

@@ -1036,7 +1036,10 @@ impl Tessellator {
clipped_shape: ClippedShape,
out_primitives: &mut Vec<ClippedPrimitive>,
) {
let ClippedShape(new_clip_rect, new_shape) = clipped_shape;
let ClippedShape {
clip_rect: new_clip_rect,
shape: new_shape,
} = clipped_shape;
if !new_clip_rect.is_positive() {
return; // skip empty clip rectangles
@@ -1044,7 +1047,13 @@ impl Tessellator {
if let Shape::Vec(shapes) = new_shape {
for shape in shapes {
self.tessellate_clipped_shape(ClippedShape(new_clip_rect, shape), out_primitives);
self.tessellate_clipped_shape(
ClippedShape {
clip_rect: new_clip_rect,
shape,
},
out_primitives,
);
}
return;
}
@@ -1641,7 +1650,10 @@ fn test_tessellator() {
shapes.push(Shape::mesh(mesh));
let shape = Shape::Vec(shapes);
let clipped_shapes = vec![ClippedShape(rect, shape)];
let clipped_shapes = vec![ClippedShape {
clip_rect: rect,
shape,
}];
let font_tex_size = [1024, 1024]; // unused
let prepared_discs = vec![]; // unused