Skip to content

Commit

Permalink
Remove epi backend from egui_glow
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Mar 13, 2022
1 parent 445b1c4 commit a382d73
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 168 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 2 additions & 11 deletions egui_glium/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,7 @@ default_fonts = ["egui/default_fonts"]
links = ["egui-winit/links"]

# enable persisting native window options and egui memory
persistence = [
"egui-winit/persistence",
"egui/persistence",
"epi", # also implied by the lines below, see https://github.com/rust-lang/cargo/issues/8832
"epi/file_storage",
"epi/persistence",
]
persistence = ["egui-winit/persistence", "egui/persistence"]

# experimental support for a screen reader
screen_reader = ["egui-winit/screen_reader"]
Expand All @@ -55,10 +49,7 @@ egui = { version = "0.17.0", path = "../egui", default-features = false, feature
"convert_bytemuck",
"single_threaded",
] }
egui-winit = { version = "0.17.0", path = "../egui-winit", default-features = false, features = [
"epi",
] }
epi = { version = "0.17.0", path = "../epi", optional = true }
egui-winit = { version = "0.17.0", path = "../egui-winit", default-features = false, features = [] }

ahash = "0.7"
bytemuck = "1.7"
Expand Down
1 change: 0 additions & 1 deletion egui_glium/examples/native_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release

use epi::NativeTexture;
use glium::glutin;

fn create_display(event_loop: &glutin::event_loop::EventLoop<()>) -> glium::Display {
Expand Down
141 changes: 0 additions & 141 deletions egui_glium/src/epi_backend.rs

This file was deleted.

5 changes: 0 additions & 5 deletions egui_glium/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@
mod painter;
pub use painter::Painter;

#[cfg(feature = "epi")]
mod epi_backend;
#[cfg(feature = "epi")]
pub use epi_backend::{run, NativeOptions};

pub use egui_winit;

// ----------------------------------------------------------------------------
Expand Down
11 changes: 2 additions & 9 deletions egui_glium/src/painter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub struct Painter {

textures: AHashMap<egui::TextureId, Rc<SrgbTexture2d>>,

#[cfg(feature = "epi")]
/// [`egui::TextureId::User`] index
next_native_tex_id: u64,
}
Expand Down Expand Up @@ -58,7 +57,6 @@ impl Painter {
max_texture_side,
program,
textures: Default::default(),
#[cfg(feature = "epi")]
next_native_tex_id: 0,
}
}
Expand Down Expand Up @@ -279,20 +277,15 @@ impl Painter {
fn get_texture(&self, texture_id: egui::TextureId) -> Option<&SrgbTexture2d> {
self.textures.get(&texture_id).map(|rc| rc.as_ref())
}
}

#[cfg(feature = "epi")]
impl epi::NativeTexture for Painter {
type Texture = Rc<SrgbTexture2d>;

fn register_native_texture(&mut self, native: Self::Texture) -> egui::TextureId {
pub fn register_native_texture(&mut self, native: Rc<SrgbTexture2d>) -> egui::TextureId {
let id = egui::TextureId::User(self.next_native_tex_id);
self.next_native_tex_id += 1;
self.textures.insert(id, native);
id
}

fn replace_native_texture(&mut self, id: egui::TextureId, replacing: Self::Texture) {
pub fn replace_native_texture(&mut self, id: egui::TextureId, replacing: Rc<SrgbTexture2d>) {
self.textures.insert(id, replacing);
}
}

0 comments on commit a382d73

Please sign in to comment.