Rename Texture to FontImage

This commit is contained in:
Emil Ernerfeldt 2021-12-28 21:02:23 +01:00
parent d775eb3733
commit 190c85a40f
21 changed files with 93 additions and 81 deletions

View file

@ -428,11 +428,17 @@ impl Context {
.expect("No fonts available until first call to CtxRef::run()") .expect("No fonts available until first call to CtxRef::run()")
} }
/// The egui texture, containing font characters etc. /// The egui font image, containing font characters etc.
///
/// Not valid until first call to [`CtxRef::run()`]. /// Not valid until first call to [`CtxRef::run()`].
/// That's because since we don't know the proper `pixels_per_point` until then. /// That's because since we don't know the proper `pixels_per_point` until then.
pub fn texture(&self) -> Arc<epaint::Texture> { pub fn font_image(&self) -> Arc<epaint::FontImage> {
self.fonts().texture() self.fonts().font_image()
}
#[deprecated = "Renamed font_image"]
pub fn texture(&self) -> Arc<epaint::FontImage> {
self.fonts().font_image()
} }
/// Tell `egui` which fonts to use. /// Tell `egui` which fonts to use.
@ -657,7 +663,7 @@ impl Context {
let clipped_meshes = tessellator::tessellate_shapes( let clipped_meshes = tessellator::tessellate_shapes(
shapes, shapes,
tessellation_options, tessellation_options,
self.fonts().texture().size(), self.fonts().font_image().size(),
); );
*self.paint_stats.lock() = paint_stats.with_clipped_meshes(&clipped_meshes); *self.paint_stats.lock() = paint_stats.with_clipped_meshes(&clipped_meshes);
clipped_meshes clipped_meshes
@ -808,7 +814,7 @@ impl Context {
.show(ui, |ui| { .show(ui, |ui| {
let mut font_definitions = self.fonts().definitions().clone(); let mut font_definitions = self.fonts().definitions().clone();
font_definitions.ui(ui); font_definitions.ui(ui);
self.fonts().texture().ui(ui); self.fonts().font_image().ui(ui);
self.set_fonts(font_definitions); self.set_fonts(font_definitions);
}); });

View file

@ -1,7 +1,7 @@
//! uis for egui types. //! uis for egui types.
use crate::*; use crate::*;
impl Widget for &epaint::Texture { impl Widget for &epaint::FontImage {
fn ui(self, ui: &mut Ui) -> Response { fn ui(self, ui: &mut Ui) -> Response {
use epaint::Mesh; use epaint::Mesh;

View file

@ -386,7 +386,7 @@ pub use emath::{lerp, pos2, remap, remap_clamp, vec2, Align, Align2, NumExt, Pos
pub use epaint::{ pub use epaint::{
color, mutex, color, mutex,
text::{FontData, FontDefinitions, FontFamily, TextStyle}, text::{FontData, FontDefinitions, FontFamily, TextStyle},
ClippedMesh, Color32, Rgba, Shape, Stroke, Texture, TextureId, ClippedMesh, Color32, FontImage, Rgba, Shape, Stroke, TextureId,
}; };
pub mod text { pub mod text {

View file

@ -97,7 +97,11 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let text_shape = TextShape::new(egui::Pos2::ZERO, galley); let text_shape = TextShape::new(egui::Pos2::ZERO, galley);
c.bench_function("tessellate_text", |b| { c.bench_function("tessellate_text", |b| {
b.iter(|| { b.iter(|| {
tessellator.tessellate_text(fonts.texture().size(), text_shape.clone(), &mut mesh); tessellator.tessellate_text(
fonts.font_image().size(),
text_shape.clone(),
&mut mesh,
);
mesh.clear(); mesh.clear();
}) })
}); });

View file

@ -347,8 +347,8 @@ impl Widget for &mut ItemsDemo {
TextureId::Egui, TextureId::Egui,
Value::new(0.0, 10.0), Value::new(0.0, 10.0),
[ [
ui.fonts().texture().width as f32 / 100.0, ui.fonts().font_image().width as f32 / 100.0,
ui.fonts().texture().height as f32 / 100.0, ui.fonts().font_image().height as f32 / 100.0,
], ],
); );

View file

@ -86,7 +86,7 @@ pub fn run(app: Box<dyn epi::App>, native_options: &epi::NativeOptions) -> ! {
&mut target, &mut target,
integration.egui_ctx.pixels_per_point(), integration.egui_ctx.pixels_per_point(),
clipped_meshes, clipped_meshes,
&integration.egui_ctx.texture(), &integration.egui_ctx.font_image(),
); );
target.finish().unwrap(); target.finish().unwrap();

View file

@ -153,7 +153,7 @@ impl EguiGlium {
target, target,
self.egui_ctx.pixels_per_point(), self.egui_ctx.pixels_per_point(),
clipped_meshes, clipped_meshes,
&self.egui_ctx.texture(), &self.egui_ctx.font_image(),
); );
} }
} }

View file

@ -65,15 +65,15 @@ impl Painter {
pub fn upload_egui_texture( pub fn upload_egui_texture(
&mut self, &mut self,
facade: &dyn glium::backend::Facade, facade: &dyn glium::backend::Facade,
texture: &egui::Texture, font_image: &egui::FontImage,
) { ) {
if self.egui_texture_version == Some(texture.version) { if self.egui_texture_version == Some(font_image.version) {
return; // No change return; // No change
} }
let pixels: Vec<Vec<(u8, u8, u8, u8)>> = texture let pixels: Vec<Vec<(u8, u8, u8, u8)>> = font_image
.pixels .pixels
.chunks(texture.width as usize) .chunks(font_image.width as usize)
.map(|row| { .map(|row| {
row.iter() row.iter()
.map(|&a| Color32::from_white_alpha(a).to_tuple()) .map(|&a| Color32::from_white_alpha(a).to_tuple())
@ -85,7 +85,7 @@ impl Painter {
let mipmaps = texture::MipmapsOption::NoMipmap; let mipmaps = texture::MipmapsOption::NoMipmap;
self.egui_texture = self.egui_texture =
Some(SrgbTexture2d::with_format(facade, pixels, format, mipmaps).unwrap()); Some(SrgbTexture2d::with_format(facade, pixels, format, mipmaps).unwrap());
self.egui_texture_version = Some(texture.version); self.egui_texture_version = Some(font_image.version);
} }
/// Main entry-point for painting a frame. /// Main entry-point for painting a frame.
@ -97,9 +97,9 @@ impl Painter {
target: &mut T, 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, font_image: &egui::FontImage,
) { ) {
self.upload_egui_texture(display, egui_texture); self.upload_egui_texture(display, font_image);
for egui::ClippedMesh(clip_rect, mesh) in cipped_meshes { for egui::ClippedMesh(clip_rect, mesh) in cipped_meshes {
self.paint_mesh(target, display, pixels_per_point, clip_rect, &mesh); self.paint_mesh(target, display, pixels_per_point, clip_rect, &mesh);

View file

@ -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_color(color[0], color[1], color[2], color[3]);
gl.clear(glow::COLOR_BUFFER_BIT); 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( painter.paint_meshes(
&gl, &gl,
gl_window.window().inner_size().into(), gl_window.window().inner_size().into(),

View file

@ -164,7 +164,7 @@ impl EguiGlow {
let clipped_meshes = self.egui_ctx.tessellate(shapes); let clipped_meshes = self.egui_ctx.tessellate(shapes);
let dimensions: [u32; 2] = gl_window.window().inner_size().into(); let dimensions: [u32; 2] = gl_window.window().inner_size().into();
self.painter self.painter
.upload_egui_texture(gl, &self.egui_ctx.texture()); .upload_egui_texture(gl, &self.egui_ctx.font_image());
self.painter.paint_meshes( self.painter.paint_meshes(
gl, gl,
dimensions, dimensions,

View file

@ -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(); self.assert_not_destroyed();
if self.egui_texture_version == Some(texture.version) { if self.egui_texture_version == Some(font_image.version) {
return; // No change return; // No change
} }
let gamma = if self.is_embedded && self.post_process.is_none() { let gamma = if self.is_embedded && self.post_process.is_none() {
@ -213,7 +213,7 @@ impl Painter {
} else { } else {
1.0 1.0
}; };
let pixels: Vec<u8> = texture let pixels: Vec<u8> = font_image
.srgba_pixels(gamma) .srgba_pixels(gamma)
.flat_map(|a| Vec::from(a.to_array())) .flat_map(|a| Vec::from(a.to_array()))
.collect(); .collect();
@ -225,15 +225,15 @@ impl Painter {
self.is_webgl_1, self.is_webgl_1,
self.srgb_support, self.srgb_support,
&pixels, &pixels,
texture.width, font_image.width,
texture.height, font_image.height,
)), )),
) { ) {
unsafe { unsafe {
gl.delete_texture(old_tex); gl.delete_texture(old_tex);
} }
} }
self.egui_texture_version = Some(texture.version); self.egui_texture_version = Some(font_image.version);
} }
unsafe fn prepare_painting( unsafe fn prepare_painting(

View file

@ -214,7 +214,8 @@ impl AppRunner {
} }
pub fn paint(&mut self, clipped_meshes: Vec<egui::ClippedMesh>) -> Result<(), JsValue> { 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.clear(self.app.clear_color());
self.painter self.painter
.paint_meshes(clipped_meshes, self.egui_ctx.pixels_per_point())?; .paint_meshes(clipped_meshes, self.egui_ctx.pixels_per_point())?;

View file

@ -1,5 +1,5 @@
use crate::{canvas_element_or_die, console_error}; use crate::{canvas_element_or_die, console_error};
use egui::{ClippedMesh, Rgba, Texture}; use egui::{ClippedMesh, FontImage, Rgba};
use egui_glow::glow; use egui_glow::glow;
use wasm_bindgen::JsCast; use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue; use wasm_bindgen::JsValue;
@ -86,8 +86,8 @@ impl crate::Painter for WrappedGlowPainter {
&self.canvas_id &self.canvas_id
} }
fn upload_egui_texture(&mut self, texture: &Texture) { fn upload_egui_texture(&mut self, font_image: &FontImage) {
self.painter.upload_egui_texture(&self.gl_ctx, texture) self.painter.upload_egui_texture(&self.gl_ctx, font_image)
} }
fn clear(&mut self, clear_color: Rgba) { fn clear(&mut self, clear_color: Rgba) {

View file

@ -10,7 +10,7 @@ pub trait Painter {
/// id of the canvas html element containing the rendering /// id of the canvas html element containing the rendering
fn canvas_id(&self) -> &str; 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); fn clear(&mut self, clear_color: egui::Rgba);

View file

@ -11,7 +11,7 @@ use {
use egui::{ use egui::{
emath::vec2, emath::vec2,
epaint::{Color32, Texture}, epaint::{Color32, FontImage},
}; };
type Gl = WebGlRenderingContext; type Gl = WebGlRenderingContext;
@ -323,8 +323,8 @@ impl crate::Painter for WebGlPainter {
&self.canvas_id &self.canvas_id
} }
fn upload_egui_texture(&mut self, texture: &Texture) { fn upload_egui_texture(&mut self, font_image: &FontImage) {
if self.egui_texture_version == Some(texture.version) { if self.egui_texture_version == Some(font_image.version) {
return; // No change return; // No change
} }
@ -333,8 +333,8 @@ impl crate::Painter for WebGlPainter {
} else { } else {
1.0 // post process enables linear blending 1.0 // post process enables linear blending
}; };
let mut pixels: Vec<u8> = Vec::with_capacity(texture.pixels.len() * 4); let mut pixels: Vec<u8> = Vec::with_capacity(font_image.pixels.len() * 4);
for srgba in texture.srgba_pixels(gamma) { for srgba in font_image.srgba_pixels(gamma) {
pixels.push(srgba.r()); pixels.push(srgba.r());
pixels.push(srgba.g()); pixels.push(srgba.g());
pixels.push(srgba.b()); pixels.push(srgba.b());
@ -353,8 +353,8 @@ impl crate::Painter for WebGlPainter {
Gl::TEXTURE_2D, Gl::TEXTURE_2D,
level, level,
internal_format as i32, internal_format as i32,
texture.width as i32, font_image.width as i32,
texture.height as i32, font_image.height as i32,
border, border,
src_format, src_format,
src_type, src_type,
@ -362,7 +362,7 @@ impl crate::Painter for WebGlPainter {
) )
.unwrap(); .unwrap();
self.egui_texture_version = Some(texture.version); self.egui_texture_version = Some(font_image.version);
} }
fn clear(&mut self, clear_color: egui::Rgba) { fn clear(&mut self, clear_color: egui::Rgba) {

View file

@ -12,7 +12,7 @@ use {
use egui::{ use egui::{
emath::vec2, emath::vec2,
epaint::{Color32, Texture}, epaint::{Color32, FontImage},
}; };
type Gl = WebGl2RenderingContext; type Gl = WebGl2RenderingContext;
@ -307,13 +307,13 @@ impl crate::Painter for WebGl2Painter {
&self.canvas_id &self.canvas_id
} }
fn upload_egui_texture(&mut self, texture: &Texture) { fn upload_egui_texture(&mut self, font_image: &FontImage) {
if self.egui_texture_version == Some(texture.version) { if self.egui_texture_version == Some(font_image.version) {
return; // No change return; // No change
} }
let mut pixels: Vec<u8> = Vec::with_capacity(texture.pixels.len() * 4); let mut pixels: Vec<u8> = Vec::with_capacity(font_image.pixels.len() * 4);
for srgba in texture.srgba_pixels(1.0) { for srgba in font_image.srgba_pixels(1.0) {
pixels.push(srgba.r()); pixels.push(srgba.r());
pixels.push(srgba.g()); pixels.push(srgba.g());
pixels.push(srgba.b()); pixels.push(srgba.b());
@ -333,8 +333,8 @@ impl crate::Painter for WebGl2Painter {
Gl::TEXTURE_2D, Gl::TEXTURE_2D,
level, level,
internal_format as i32, internal_format as i32,
texture.width as i32, font_image.width as i32,
texture.height as i32, font_image.height as i32,
border, border,
src_format, src_format,
src_type, src_type,
@ -342,7 +342,7 @@ impl crate::Painter for WebGl2Painter {
) )
.unwrap(); .unwrap();
self.egui_texture_version = Some(texture.version); self.egui_texture_version = Some(font_image.version);
} }
fn clear(&mut self, clear_color: egui::Rgba) { fn clear(&mut self, clear_color: egui::Rgba) {

View file

@ -6,6 +6,7 @@ All notable changes to the epaint crate will be documented in this file.
## Unreleased ## Unreleased
* `Rgba` now implements `Hash` ([#886](https://github.com/emilk/egui/pull/886)). * `Rgba` now implements `Hash` ([#886](https://github.com/emilk/egui/pull/886)).
* Anti-alias path ends ([#893](https://github.com/emilk/egui/pull/893)). * Anti-alias path ends ([#893](https://github.com/emilk/egui/pull/893)).
* Rename `Texture` to `FontImage`.
## 0.15.0 - 2021-10-24 ## 0.15.0 - 2021-10-24

View file

@ -109,7 +109,7 @@ pub use {
stroke::Stroke, stroke::Stroke,
tessellator::{tessellate_shapes, TessellationOptions, Tessellator}, tessellator::{tessellate_shapes, TessellationOptions, Tessellator},
text::{Fonts, Galley, TextStyle}, text::{Fonts, Galley, TextStyle},
texture_atlas::{Texture, TextureAtlas}, texture_atlas::{FontImage, TextureAtlas},
}; };
pub use emath::{pos2, vec2, Pos2, Rect, Vec2}; pub use emath::{pos2, vec2, Pos2, Rect, Vec2};

View file

@ -377,7 +377,7 @@ fn allocate_glyph(
} else { } else {
let glyph_pos = atlas.allocate((glyph_width, glyph_height)); let glyph_pos = atlas.allocate((glyph_width, glyph_height));
let texture = atlas.texture_mut(); let texture = atlas.image_mut();
glyph.draw(|x, y, v| { glyph.draw(|x, y, v| {
if v > 0.0 { if v > 0.0 {
let px = glyph_pos.0 + x as usize; let px = glyph_pos.0 + x as usize;

View file

@ -6,7 +6,7 @@ use crate::{
font::{Font, FontImpl}, font::{Font, FontImpl},
Galley, LayoutJob, Galley, LayoutJob,
}, },
Texture, TextureAtlas, FontImage, TextureAtlas,
}; };
// TODO: rename // TODO: rename
@ -233,9 +233,10 @@ pub struct Fonts {
definitions: FontDefinitions, definitions: FontDefinitions,
fonts: BTreeMap<TextStyle, Font>, fonts: BTreeMap<TextStyle, Font>,
atlas: Arc<Mutex<TextureAtlas>>, atlas: Arc<Mutex<TextureAtlas>>,
/// Copy of the texture in the texture atlas.
/// Copy of the font image in the texture atlas.
/// This is so we can return a reference to it (the texture atlas is behind a lock). /// This is so we can return a reference to it (the texture atlas is behind a lock).
buffered_texture: Mutex<Arc<Texture>>, buffered_font_image: Mutex<Arc<FontImage>>,
galley_cache: Mutex<GalleyCache>, galley_cache: Mutex<GalleyCache>,
} }
@ -258,7 +259,7 @@ impl Fonts {
// Make the top left pixel fully white: // Make the top left pixel fully white:
let pos = atlas.allocate((1, 1)); let pos = atlas.allocate((1, 1));
assert_eq!(pos, (0, 0)); assert_eq!(pos, (0, 0));
atlas.texture_mut()[pos] = 255; atlas.image_mut()[pos] = 255;
} }
let atlas = Arc::new(Mutex::new(atlas)); let atlas = Arc::new(Mutex::new(atlas));
@ -284,7 +285,7 @@ impl Fonts {
{ {
let mut atlas = atlas.lock(); let mut atlas = atlas.lock();
let texture = atlas.texture_mut(); let texture = atlas.image_mut();
// Make sure we seed the texture version with something unique based on the default characters: // Make sure we seed the texture version with something unique based on the default characters:
texture.version = crate::util::hash(&texture.pixels); texture.version = crate::util::hash(&texture.pixels);
} }
@ -294,7 +295,7 @@ impl Fonts {
definitions, definitions,
fonts, fonts,
atlas, atlas,
buffered_texture: Default::default(), //atlas.lock().texture().clone(); buffered_font_image: Default::default(), //atlas.lock().texture().clone();
galley_cache: Default::default(), galley_cache: Default::default(),
} }
} }
@ -319,11 +320,11 @@ impl Fonts {
} }
/// Call each frame to get the latest available font texture data. /// Call each frame to get the latest available font texture data.
pub fn texture(&self) -> Arc<Texture> { pub fn font_image(&self) -> Arc<FontImage> {
let atlas = self.atlas.lock(); let atlas = self.atlas.lock();
let mut buffered_texture = self.buffered_texture.lock(); let mut buffered_texture = self.buffered_font_image.lock();
if buffered_texture.version != atlas.texture().version { if buffered_texture.version != atlas.image().version {
*buffered_texture = Arc::new(atlas.texture().clone()); *buffered_texture = Arc::new(atlas.image().clone());
} }
buffered_texture.clone() buffered_texture.clone()

View file

@ -1,7 +1,6 @@
// TODO: `TextureData` or similar?
/// An 8-bit texture containing font data. /// An 8-bit texture containing font data.
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct Texture { pub struct FontImage {
/// e.g. a hash of the data. Use this to detect changes! /// e.g. a hash of the data. Use this to detect changes!
/// If the texture changes, this too will change. /// If the texture changes, this too will change.
pub version: u64, pub version: u64,
@ -11,7 +10,7 @@ pub struct Texture {
pub pixels: Vec<u8>, pub pixels: Vec<u8>,
} }
impl Texture { impl FontImage {
pub fn size(&self) -> [usize; 2] { pub fn size(&self) -> [usize; 2] {
[self.width, self.height] [self.width, self.height]
} }
@ -36,7 +35,7 @@ impl Texture {
} }
} }
impl std::ops::Index<(usize, usize)> for Texture { impl std::ops::Index<(usize, usize)> for FontImage {
type Output = u8; type Output = u8;
#[inline] #[inline]
@ -47,7 +46,7 @@ impl std::ops::Index<(usize, usize)> for Texture {
} }
} }
impl std::ops::IndexMut<(usize, usize)> for Texture { impl std::ops::IndexMut<(usize, usize)> for FontImage {
#[inline] #[inline]
fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut u8 { fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut u8 {
assert!(x < self.width); assert!(x < self.width);
@ -61,7 +60,7 @@ impl std::ops::IndexMut<(usize, usize)> for Texture {
/// More characters can be added, possibly expanding the texture. /// More characters can be added, possibly expanding the texture.
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct TextureAtlas { pub struct TextureAtlas {
texture: Texture, image: FontImage,
/// Used for when allocating new rectangles. /// Used for when allocating new rectangles.
cursor: (usize, usize), cursor: (usize, usize),
@ -71,7 +70,7 @@ pub struct TextureAtlas {
impl TextureAtlas { impl TextureAtlas {
pub fn new(width: usize, height: usize) -> Self { pub fn new(width: usize, height: usize) -> Self {
Self { Self {
texture: Texture { image: FontImage {
version: 0, version: 0,
width, width,
height, height,
@ -81,13 +80,13 @@ impl TextureAtlas {
} }
} }
pub fn texture(&self) -> &Texture { pub fn image(&self) -> &FontImage {
&self.texture &self.image
} }
pub fn texture_mut(&mut self) -> &mut Texture { pub fn image_mut(&mut self) -> &mut FontImage {
self.texture.version += 1; self.image.version += 1;
&mut self.texture &mut self.image
} }
/// Returns the coordinates of where the rect ended up. /// Returns the coordinates of where the rect ended up.
@ -98,12 +97,12 @@ impl TextureAtlas {
const PADDING: usize = 1; const PADDING: usize = 1;
assert!( assert!(
w <= self.texture.width, w <= self.image.width,
"Tried to allocate a {} wide glyph in a {} wide texture atlas", "Tried to allocate a {} wide glyph in a {} wide texture atlas",
w, w,
self.texture.width self.image.width
); );
if self.cursor.0 + w > self.texture.width { if self.cursor.0 + w > self.image.width {
// New row: // New row:
self.cursor.0 = 0; self.cursor.0 = 0;
self.cursor.1 += self.row_height + PADDING; self.cursor.1 += self.row_height + PADDING;
@ -111,19 +110,19 @@ impl TextureAtlas {
} }
self.row_height = self.row_height.max(h); self.row_height = self.row_height.max(h);
while self.cursor.1 + self.row_height >= self.texture.height { while self.cursor.1 + self.row_height >= self.image.height {
self.texture.height *= 2; self.image.height *= 2;
} }
if self.texture.width * self.texture.height > self.texture.pixels.len() { if self.image.width * self.image.height > self.image.pixels.len() {
self.texture self.image
.pixels .pixels
.resize(self.texture.width * self.texture.height, 0); .resize(self.image.width * self.image.height, 0);
} }
let pos = self.cursor; let pos = self.cursor;
self.cursor.0 += w + PADDING; self.cursor.0 += w + PADDING;
self.texture.version += 1; self.image.version += 1;
(pos.0 as usize, pos.1 as usize) (pos.0 as usize, pos.1 as usize)
} }
} }