1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Add user texture support to egui_glium and egui_web backends

This commit is contained in:
Emil Ernerfeldt
2020-09-11 08:56:47 +02:00
parent 02ef0cd9d5
commit d49aec4079
5 changed files with 321 additions and 114 deletions

View File

@@ -1,6 +1,9 @@
use crate::*;
pub use egui::app::{App, Backend, RunMode, WebInfo};
pub use egui::{
app::{App, Backend, RunMode, WebInfo},
Srgba,
};
// ----------------------------------------------------------------------------
@@ -102,6 +105,14 @@ impl Backend for WebBackend {
fn fps(&self) -> f32 {
1.0 / self.frame_times.mean_time_interval().unwrap_or_default()
}
fn new_texture_srgba_premultiplied(
&mut self,
size: (usize, usize),
pixels: &[Srgba],
) -> egui::TextureId {
self.painter.new_user_texture(size, pixels)
}
}
// ----------------------------------------------------------------------------