src/text.c

changeset 17
25013a35e07d
parent 16
c5dde81b6fb2
child 18
00c0632f0f40
equal deleted inserted replaced
16:c5dde81b6fb2 17:25013a35e07d
35 void asc_text_draw_lb( 35 void asc_text_draw_lb(
36 AscTextNode *node, 36 AscTextNode *node,
37 asc_vec2i position, 37 asc_vec2i position,
38 unsigned max_width, 38 unsigned max_width,
39 cxmutstr text) { 39 cxmutstr text) {
40
41 // short circuit - if fully transparent, just hide it
42 if (asc_context.ink.alpha == 0) {
43 node->hidden = true;
44 return;
45 }
40 46
41 // Generate new texture, if required 47 // Generate new texture, if required
42 if (node->tex_id == 0) { 48 if (node->tex_id == 0) {
43 glGenTextures(1, &node->tex_id); 49 glGenTextures(1, &node->tex_id);
44 glBindTexture(GL_TEXTURE_RECTANGLE, node->tex_id); 50 glBindTexture(GL_TEXTURE_RECTANGLE, node->tex_id);
91 unsigned max_width = asc_context.active_window->dimensions.width - position.width; 97 unsigned max_width = asc_context.active_window->dimensions.width - position.width;
92 asc_text_draw_lb(node, position, max_width, text); 98 asc_text_draw_lb(node, position, max_width, text);
93 } 99 }
94 100
95 void asc_text_redraw(AscTextNode *node) { 101 void asc_text_redraw(AscTextNode *node) {
102 if (node->hidden) return;
103
96 if (node->tex_id == 0) { 104 if (node->tex_id == 0) {
97 asc_error("Tried to redraw text node after destruction"); 105 asc_error("Tried to redraw text node after destruction");
98 return; 106 return;
99 } 107 }
100 108

mercurial