comparison libmlk-ui/ui/label.c @ 298:196264679079

misc: remove usage of bool
author David Demelier <markand@malikania.fr>
date Wed, 10 Mar 2021 18:49:08 +0100
parents 71b3b7036de7
children d01e83210ca2
comparison
equal deleted inserted replaced
297:6151152d009c 298:196264679079
44 44
45 font = t->fonts[THEME_FONT_INTERFACE]; 45 font = t->fonts[THEME_FONT_INTERFACE];
46 46
47 /* Shadow text, only if enabled. */ 47 /* Shadow text, only if enabled. */
48 if (label->flags & LABEL_FLAGS_SHADOW) { 48 if (label->flags & LABEL_FLAGS_SHADOW) {
49 if (!font_render(font, &tex, label->text, t->colors[THEME_COLOR_SHADOW])) 49 if (font_render(font, &tex, label->text, t->colors[THEME_COLOR_SHADOW]) < 0)
50 panic(); 50 panic();
51 51
52 texture_draw(&tex, label->x + 1, label->y + 1); 52 texture_draw(&tex, label->x + 1, label->y + 1);
53 texture_finish(&tex); 53 texture_finish(&tex);
54 } 54 }
55 55
56 /* Normal text. */ 56 /* Normal text. */
57 if (!font_render(font, &tex, label->text, t->colors[THEME_COLOR_NORMAL])) 57 if (font_render(font, &tex, label->text, t->colors[THEME_COLOR_NORMAL]) < 0)
58 panic(); 58 panic();
59 59
60 texture_draw(&tex, label->x, label->y); 60 texture_draw(&tex, label->x, label->y);
61 texture_finish(&tex); 61 texture_finish(&tex);
62 } 62 }
63 63
64 bool 64 int
65 label_ok(const struct label *label) 65 label_ok(const struct label *label)
66 { 66 {
67 return label && label->text && strlen(label->text) > 0; 67 return label && label->text && strlen(label->text) > 0;
68 } 68 }
69 69
73 assert(label); 73 assert(label);
74 assert(label->text); 74 assert(label->text);
75 75
76 const struct theme *t = label->theme ? label->theme : theme_default(); 76 const struct theme *t = label->theme ? label->theme : theme_default();
77 77
78 if (!font_query(t->fonts[THEME_FONT_INTERFACE], label->text, w, h)) 78 if (font_query(t->fonts[THEME_FONT_INTERFACE], label->text, w, h) < 0)
79 panic(); 79 panic();
80 } 80 }
81 81
82 void 82 void
83 label_draw(const struct label *label) 83 label_draw(const struct label *label)