Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 14, 2022
1 parent 7ac0811 commit 3f9e3c7
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion egui_glium/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl EguiGlium {
display,
target,
self.egui_ctx.pixels_per_point(),
clipped_primitives,
&clipped_primitives,
&textures_delta,
);
}
Expand Down
6 changes: 3 additions & 3 deletions egui_glium/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl Painter {
display: &glium::Display,
target: &mut T,
pixels_per_point: f32,
clipped_primitives: Vec<egui::ClippedPrimitive>,
clipped_primitives: &[egui::ClippedPrimitive],
textures_delta: &egui::TexturesDelta,
) {
for (id, image_delta) in &textures_delta.set {
Expand All @@ -92,7 +92,7 @@ impl Painter {
display: &glium::Display,
target: &mut T,
pixels_per_point: f32,
clipped_primitives: Vec<egui::ClippedPrimitive>,
clipped_primitives: &[egui::ClippedPrimitive],
) {
for egui::ClippedPrimitive {
clip_rect,
Expand All @@ -116,7 +116,7 @@ impl Painter {
target: &mut T,
display: &glium::Display,
pixels_per_point: f32,
clip_rect: Rect,
clip_rect: &Rect,
mesh: &Mesh,
) {
debug_assert!(mesh.is_valid());
Expand Down
2 changes: 1 addition & 1 deletion egui_glow/src/epi_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub fn run(app: Box<dyn epi::App>, native_options: &epi::NativeOptions) -> ! {
painter.paint_and_update_textures(
gl_window.window().inner_size().into(),
integration.egui_ctx.pixels_per_point(),
clipped_primitives,
&clipped_primitives,
&textures_delta,
);

Expand Down
6 changes: 3 additions & 3 deletions egui_glow/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl Painter {
&mut self,
inner_size: [u32; 2],
pixels_per_point: f32,
clipped_primitives: Vec<egui::ClippedPrimitive>,
clipped_primitives: &[egui::ClippedPrimitive],
textures_delta: &egui::TexturesDelta,
) {
for (id, image_delta) in &textures_delta.set {
Expand Down Expand Up @@ -324,7 +324,7 @@ impl Painter {
&mut self,
inner_size: [u32; 2],
pixels_per_point: f32,
clipped_primitives: Vec<egui::ClippedPrimitive>,
clipped_primitives: &[egui::ClippedPrimitive],
) {
self.assert_not_destroyed();

Expand All @@ -340,7 +340,7 @@ impl Painter {
primitive,
} in clipped_primitives
{
set_clip_rect(&self.gl, size_in_pixels, pixels_per_point, clip_rect);
set_clip_rect(&self.gl, size_in_pixels, pixels_per_point, *clip_rect);

match primitive {
Primitive::Mesh(mesh) => {
Expand Down
2 changes: 1 addition & 1 deletion egui_glow/src/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl EguiGlow {
self.painter.paint_primitives(
dimensions,
self.egui_ctx.pixels_per_point(),
clipped_primitives,
&clipped_primitives,
);

for id in textures_delta.free.drain(..) {
Expand Down
5 changes: 1 addition & 4 deletions egui_web/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,7 @@ impl AppRunner {
}

/// Paint the results of the last call to [`Self::logic`].
pub fn paint(
&mut self,
clipped_primitives: Vec<egui::ClippedPrimitive>,
) -> Result<(), JsValue> {
pub fn paint(&mut self, clipped_primitives: &[egui::ClippedPrimitive]) -> Result<(), JsValue> {
let textures_delta = std::mem::take(&mut self.textures_delta);

self.painter.clear(self.app.clear_color());
Expand Down
4 changes: 2 additions & 2 deletions egui_web/src/glow_wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl WrappedGlowPainter {

pub fn paint_primitives(
&mut self,
clipped_primitives: Vec<ClippedPrimitive>,
clipped_primitives: &[ClippedPrimitive],
pixels_per_point: f32,
) -> Result<(), JsValue> {
let canvas_dimension = [self.canvas.width(), self.canvas.height()];
Expand All @@ -66,7 +66,7 @@ impl WrappedGlowPainter {

pub fn paint_and_update_textures(
&mut self,
clipped_primitives: Vec<egui::ClippedPrimitive>,
clipped_primitives: &[egui::ClippedPrimitive],
pixels_per_point: f32,
textures_delta: &egui::TexturesDelta,
) -> Result<(), JsValue> {
Expand Down
2 changes: 1 addition & 1 deletion egui_web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ fn paint_and_schedule(runner_ref: &AppRunnerRef, panicked: Arc<AtomicBool>) -> R
let mut runner_lock = runner_ref.lock();
if runner_lock.needs_repaint.fetch_and_clear() {
let (needs_repaint, clipped_primitives) = runner_lock.logic()?;
runner_lock.paint(clipped_primitives)?;
runner_lock.paint(&clipped_primitives)?;
if needs_repaint {
runner_lock.needs_repaint.set_true();
}
Expand Down
4 changes: 2 additions & 2 deletions epaint/src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ impl std::fmt::Debug for PaintCallback {

impl std::cmp::PartialEq for PaintCallback {
fn eq(&self, other: &Self) -> bool {
// As I understand it, the problem this clippy tried to protect against can only happen
// if we do dynamic casts back and forth on the pointers, and we don't do that.
// As I understand it, the problem this clippy is trying to protect against
// can only happen if we do dynamic casts back and forth on the pointers, and we don't do that.
#[allow(clippy::vtable_address_comparisons)]
{
self.rect.eq(&other.rect) && std::sync::Arc::ptr_eq(&self.callback, &other.callback)
Expand Down

0 comments on commit 3f9e3c7

Please sign in to comment.