Make paint function accept anything implementing Surface trait (#681)
* Make paint function accept anything implementing Surface trait * Remove unused imports
This commit is contained in:
parent
9def6ef6df
commit
56502fbb3c
2 changed files with 6 additions and 7 deletions
|
@ -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);
|
||||||
|
|
|
@ -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…
Reference in a new issue