Browse Source

Make paint function accept anything implementing Surface trait (#681)

* Make paint function accept anything implementing Surface trait

* Remove unused imports
pull/694/head
JerzySpendel 3 years ago
committed by GitHub
parent
commit
56502fbb3c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      egui_glium/src/lib.rs
  2. 9
      egui_glium/src/painter.rs

4
egui_glium/src/lib.rs

@ -631,10 +631,10 @@ impl EguiGlium {
(needs_repaint, shapes) (needs_repaint, shapes)
} }
pub fn paint( pub fn paint<T: glium::Surface>(
&mut self, &mut self,
display: &glium::Display, display: &glium::Display,
target: &mut glium::Frame, target: &mut T,
shapes: Vec<egui::epaint::ClippedShape>, shapes: Vec<egui::epaint::ClippedShape>,
) { ) {
let clipped_meshes = self.egui_ctx.tessellate(shapes); let clipped_meshes = self.egui_ctx.tessellate(shapes);

9
egui_glium/src/painter.rs

@ -12,7 +12,6 @@ use {
texture::{self, srgb_texture2d::SrgbTexture2d}, texture::{self, srgb_texture2d::SrgbTexture2d},
uniform, uniform,
uniforms::{MagnifySamplerFilter, SamplerWrapFunction}, uniforms::{MagnifySamplerFilter, SamplerWrapFunction},
Frame, Surface,
}, },
}; };
@ -95,10 +94,10 @@ impl Painter {
/// Main entry-point for painting a frame. /// Main entry-point for painting a frame.
/// You should call `target.clear_color(..)` before /// You should call `target.clear_color(..)` before
/// and `target.finish()` after this. /// and `target.finish()` after this.
pub fn paint_meshes( pub fn paint_meshes<T: glium::Surface>(
&mut self, &mut self,
display: &glium::Display, display: &glium::Display,
target: &mut Frame, target: &mut T,
pixels_per_point: f32, pixels_per_point: f32,
cipped_meshes: Vec<egui::ClippedMesh>, cipped_meshes: Vec<egui::ClippedMesh>,
egui_texture: &egui::Texture, egui_texture: &egui::Texture,
@ -112,9 +111,9 @@ impl Painter {
} }
#[inline(never)] // Easier profiling #[inline(never)] // Easier profiling
pub fn paint_mesh( pub fn paint_mesh<T: glium::Surface>(
&mut self, &mut self,
target: &mut Frame, target: &mut T,
display: &glium::Display, display: &glium::Display,
pixels_per_point: f32, pixels_per_point: f32,
clip_rect: Rect, clip_rect: Rect,

Loading…
Cancel
Save