mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Rename Texture to FontImage
This commit is contained in:
@@ -214,7 +214,8 @@ impl AppRunner {
|
||||
}
|
||||
|
||||
pub fn paint(&mut self, clipped_meshes: Vec<egui::ClippedMesh>) -> Result<(), JsValue> {
|
||||
self.painter.upload_egui_texture(&self.egui_ctx.texture());
|
||||
self.painter
|
||||
.upload_egui_texture(&self.egui_ctx.font_image());
|
||||
self.painter.clear(self.app.clear_color());
|
||||
self.painter
|
||||
.paint_meshes(clipped_meshes, self.egui_ctx.pixels_per_point())?;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{canvas_element_or_die, console_error};
|
||||
use egui::{ClippedMesh, Rgba, Texture};
|
||||
use egui::{ClippedMesh, FontImage, Rgba};
|
||||
use egui_glow::glow;
|
||||
use wasm_bindgen::JsCast;
|
||||
use wasm_bindgen::JsValue;
|
||||
@@ -86,8 +86,8 @@ impl crate::Painter for WrappedGlowPainter {
|
||||
&self.canvas_id
|
||||
}
|
||||
|
||||
fn upload_egui_texture(&mut self, texture: &Texture) {
|
||||
self.painter.upload_egui_texture(&self.gl_ctx, texture)
|
||||
fn upload_egui_texture(&mut self, font_image: &FontImage) {
|
||||
self.painter.upload_egui_texture(&self.gl_ctx, font_image)
|
||||
}
|
||||
|
||||
fn clear(&mut self, clear_color: Rgba) {
|
||||
|
||||
@@ -10,7 +10,7 @@ pub trait Painter {
|
||||
/// id of the canvas html element containing the rendering
|
||||
fn canvas_id(&self) -> &str;
|
||||
|
||||
fn upload_egui_texture(&mut self, texture: &egui::Texture);
|
||||
fn upload_egui_texture(&mut self, font_image: &egui::FontImage);
|
||||
|
||||
fn clear(&mut self, clear_color: egui::Rgba);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ use {
|
||||
|
||||
use egui::{
|
||||
emath::vec2,
|
||||
epaint::{Color32, Texture},
|
||||
epaint::{Color32, FontImage},
|
||||
};
|
||||
|
||||
type Gl = WebGlRenderingContext;
|
||||
@@ -323,8 +323,8 @@ impl crate::Painter for WebGlPainter {
|
||||
&self.canvas_id
|
||||
}
|
||||
|
||||
fn upload_egui_texture(&mut self, texture: &Texture) {
|
||||
if self.egui_texture_version == Some(texture.version) {
|
||||
fn upload_egui_texture(&mut self, font_image: &FontImage) {
|
||||
if self.egui_texture_version == Some(font_image.version) {
|
||||
return; // No change
|
||||
}
|
||||
|
||||
@@ -333,8 +333,8 @@ impl crate::Painter for WebGlPainter {
|
||||
} else {
|
||||
1.0 // post process enables linear blending
|
||||
};
|
||||
let mut pixels: Vec<u8> = Vec::with_capacity(texture.pixels.len() * 4);
|
||||
for srgba in texture.srgba_pixels(gamma) {
|
||||
let mut pixels: Vec<u8> = Vec::with_capacity(font_image.pixels.len() * 4);
|
||||
for srgba in font_image.srgba_pixels(gamma) {
|
||||
pixels.push(srgba.r());
|
||||
pixels.push(srgba.g());
|
||||
pixels.push(srgba.b());
|
||||
@@ -353,8 +353,8 @@ impl crate::Painter for WebGlPainter {
|
||||
Gl::TEXTURE_2D,
|
||||
level,
|
||||
internal_format as i32,
|
||||
texture.width as i32,
|
||||
texture.height as i32,
|
||||
font_image.width as i32,
|
||||
font_image.height as i32,
|
||||
border,
|
||||
src_format,
|
||||
src_type,
|
||||
@@ -362,7 +362,7 @@ impl crate::Painter for WebGlPainter {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
self.egui_texture_version = Some(texture.version);
|
||||
self.egui_texture_version = Some(font_image.version);
|
||||
}
|
||||
|
||||
fn clear(&mut self, clear_color: egui::Rgba) {
|
||||
|
||||
@@ -12,7 +12,7 @@ use {
|
||||
|
||||
use egui::{
|
||||
emath::vec2,
|
||||
epaint::{Color32, Texture},
|
||||
epaint::{Color32, FontImage},
|
||||
};
|
||||
|
||||
type Gl = WebGl2RenderingContext;
|
||||
@@ -307,13 +307,13 @@ impl crate::Painter for WebGl2Painter {
|
||||
&self.canvas_id
|
||||
}
|
||||
|
||||
fn upload_egui_texture(&mut self, texture: &Texture) {
|
||||
if self.egui_texture_version == Some(texture.version) {
|
||||
fn upload_egui_texture(&mut self, font_image: &FontImage) {
|
||||
if self.egui_texture_version == Some(font_image.version) {
|
||||
return; // No change
|
||||
}
|
||||
|
||||
let mut pixels: Vec<u8> = Vec::with_capacity(texture.pixels.len() * 4);
|
||||
for srgba in texture.srgba_pixels(1.0) {
|
||||
let mut pixels: Vec<u8> = Vec::with_capacity(font_image.pixels.len() * 4);
|
||||
for srgba in font_image.srgba_pixels(1.0) {
|
||||
pixels.push(srgba.r());
|
||||
pixels.push(srgba.g());
|
||||
pixels.push(srgba.b());
|
||||
@@ -333,8 +333,8 @@ impl crate::Painter for WebGl2Painter {
|
||||
Gl::TEXTURE_2D,
|
||||
level,
|
||||
internal_format as i32,
|
||||
texture.width as i32,
|
||||
texture.height as i32,
|
||||
font_image.width as i32,
|
||||
font_image.height as i32,
|
||||
border,
|
||||
src_format,
|
||||
src_type,
|
||||
@@ -342,7 +342,7 @@ impl crate::Painter for WebGl2Painter {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
self.egui_texture_version = Some(texture.version);
|
||||
self.egui_texture_version = Some(font_image.version);
|
||||
}
|
||||
|
||||
fn clear(&mut self, clear_color: egui::Rgba) {
|
||||
|
||||
Reference in New Issue
Block a user