mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Rename Texture to FontImage
This commit is contained in:
@@ -99,7 +99,7 @@ pub fn run(app: Box<dyn epi::App>, native_options: &epi::NativeOptions) -> ! {
|
||||
gl.clear_color(color[0], color[1], color[2], color[3]);
|
||||
gl.clear(glow::COLOR_BUFFER_BIT);
|
||||
}
|
||||
painter.upload_egui_texture(&gl, &integration.egui_ctx.texture());
|
||||
painter.upload_egui_texture(&gl, &integration.egui_ctx.font_image());
|
||||
painter.paint_meshes(
|
||||
&gl,
|
||||
gl_window.window().inner_size().into(),
|
||||
|
||||
@@ -164,7 +164,7 @@ impl EguiGlow {
|
||||
let clipped_meshes = self.egui_ctx.tessellate(shapes);
|
||||
let dimensions: [u32; 2] = gl_window.window().inner_size().into();
|
||||
self.painter
|
||||
.upload_egui_texture(gl, &self.egui_ctx.texture());
|
||||
.upload_egui_texture(gl, &self.egui_ctx.font_image());
|
||||
self.painter.paint_meshes(
|
||||
gl,
|
||||
dimensions,
|
||||
|
||||
@@ -202,10 +202,10 @@ impl Painter {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn upload_egui_texture(&mut self, gl: &glow::Context, texture: &egui::Texture) {
|
||||
pub fn upload_egui_texture(&mut self, gl: &glow::Context, font_image: &egui::FontImage) {
|
||||
self.assert_not_destroyed();
|
||||
|
||||
if self.egui_texture_version == Some(texture.version) {
|
||||
if self.egui_texture_version == Some(font_image.version) {
|
||||
return; // No change
|
||||
}
|
||||
let gamma = if self.is_embedded && self.post_process.is_none() {
|
||||
@@ -213,7 +213,7 @@ impl Painter {
|
||||
} else {
|
||||
1.0
|
||||
};
|
||||
let pixels: Vec<u8> = texture
|
||||
let pixels: Vec<u8> = font_image
|
||||
.srgba_pixels(gamma)
|
||||
.flat_map(|a| Vec::from(a.to_array()))
|
||||
.collect();
|
||||
@@ -225,15 +225,15 @@ impl Painter {
|
||||
self.is_webgl_1,
|
||||
self.srgb_support,
|
||||
&pixels,
|
||||
texture.width,
|
||||
texture.height,
|
||||
font_image.width,
|
||||
font_image.height,
|
||||
)),
|
||||
) {
|
||||
unsafe {
|
||||
gl.delete_texture(old_tex);
|
||||
}
|
||||
}
|
||||
self.egui_texture_version = Some(texture.version);
|
||||
self.egui_texture_version = Some(font_image.version);
|
||||
}
|
||||
|
||||
unsafe fn prepare_painting(
|
||||
|
||||
Reference in New Issue
Block a user