1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -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:
Emil Ernerfeldt
2025-01-02 15:34:28 +01:00
committed by GitHub
parent 72ac2113dd
commit aeea70d9e7
7 changed files with 111 additions and 58 deletions

View File

@@ -9,7 +9,7 @@ use epaint::{
use crate::{
load::{Bytes, SizeHint, SizedTexture, TextureLoadResult, TexturePoll},
pos2, Color32, Context, Id, Mesh, Painter, Rect, Response, Rounding, Sense, Shape, Spinner,
Stroke, TextStyle, TextureOptions, Ui, Vec2, Widget, WidgetInfo, WidgetType,
TextStyle, TextureOptions, Ui, Vec2, Widget, WidgetInfo, WidgetType,
};
/// A widget which displays an image.
@@ -822,15 +822,10 @@ pub fn paint_texture_at(
painter.add(Shape::mesh(mesh));
}
None => {
painter.add(RectShape {
rect,
rounding: options.rounding,
fill: options.tint,
stroke: Stroke::NONE,
blur_width: 0.0,
fill_texture_id: texture.id,
uv: options.uv,
});
painter.add(
RectShape::filled(rect, options.rounding, options.tint)
.with_texture(texture.id, options.uv),
);
}
}
}