BLF: assert alpha doesn't exceed 1.0 for icon outlines

Causes undefined behavior, so the caller needs to clamp.
This commit is contained in:
Campbell Barton
2025-09-06 13:55:20 +10:00
parent 7a4f8ffc17
commit b303d6bb19
2 changed files with 4 additions and 0 deletions

View File

@@ -526,6 +526,7 @@ void blf_draw_svg_icon(FontBLF *font,
bool multicolor,
blender::FunctionRef<void(std::string &)> edit_source_cb)
{
BLI_assert(outline_alpha <= 1.0f); /* Higher values overflow, caller must ensure. */
blf_font_size(font, size);
font->pos[0] = int(x);
font->pos[1] = int(y);

View File

@@ -101,6 +101,9 @@ bool blf_font_size(FontBLF *font, float size);
void blf_font_draw(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
void blf_font_draw__wrap(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
/**
* \param outline_alpha: Alpha value between 0 and 1.
*/
void blf_draw_svg_icon(FontBLF *font,
uint icon_id,
float x,