src/text.c

changeset 17
25013a35e07d
parent 16
c5dde81b6fb2
child 18
00c0632f0f40
--- a/src/text.c	Wed Nov 15 22:51:40 2023 +0100
+++ b/src/text.c	Sun Nov 19 13:22:43 2023 +0100
@@ -38,6 +38,12 @@
         unsigned max_width,
         cxmutstr text) {
 
+    // short circuit - if fully transparent, just hide it
+    if (asc_context.ink.alpha == 0) {
+        node->hidden = true;
+        return;
+    }
+
     // Generate new texture, if required
     if (node->tex_id == 0) {
         glGenTextures(1, &node->tex_id);
@@ -93,6 +99,8 @@
 }
 
 void asc_text_redraw(AscTextNode *node) {
+    if (node->hidden) return;
+
     if (node->tex_id == 0) {
         asc_error("Tried to redraw text node after destruction");
         return;

mercurial