aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/renderer/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs
index e6d33c9b..d510692c 100644
--- a/src/renderer/mod.rs
+++ b/src/renderer/mod.rs
@@ -873,10 +873,12 @@ impl<'a> LoadGlyph for LoaderApi<'a> {
match self.atlas[*self.current_atlas].insert(rasterized, &mut self.active_tex) {
Ok(glyph) => glyph,
Err(_) => {
- let atlas = Atlas::new(ATLAS_SIZE);
- *self.active_tex = 0; // Atlas::new binds a texture. Ugh this is sloppy.
- *self.current_atlas = 0;
- self.atlas.insert(0, atlas);
+ *self.current_atlas += 1;
+ if *self.current_atlas == self.atlas.len() {
+ let atlas = Atlas::new(ATLAS_SIZE);
+ *self.active_tex = 0; // Atlas::new binds a texture. Ugh this is sloppy.
+ self.atlas.push(atlas);
+ }
self.load_glyph(rasterized)
}
}