src/text.c

changeset 17
25013a35e07d
parent 16
c5dde81b6fb2
child 18
00c0632f0f40
     1.1 --- a/src/text.c	Wed Nov 15 22:51:40 2023 +0100
     1.2 +++ b/src/text.c	Sun Nov 19 13:22:43 2023 +0100
     1.3 @@ -38,6 +38,12 @@
     1.4          unsigned max_width,
     1.5          cxmutstr text) {
     1.6  
     1.7 +    // short circuit - if fully transparent, just hide it
     1.8 +    if (asc_context.ink.alpha == 0) {
     1.9 +        node->hidden = true;
    1.10 +        return;
    1.11 +    }
    1.12 +
    1.13      // Generate new texture, if required
    1.14      if (node->tex_id == 0) {
    1.15          glGenTextures(1, &node->tex_id);
    1.16 @@ -93,6 +99,8 @@
    1.17  }
    1.18  
    1.19  void asc_text_redraw(AscTextNode *node) {
    1.20 +    if (node->hidden) return;
    1.21 +
    1.22      if (node->tex_id == 0) {
    1.23          asc_error("Tried to redraw text node after destruction");
    1.24          return;

mercurial