OpenGL immediate mode: fix Waveform Font color

This commit is contained in:
Clément Foucault 2017-02-07 22:40:01 +01:00 committed by Julian Eisel
parent b4a01e7f4f
commit 5b10a6bb8e
3 changed files with 9 additions and 0 deletions

View File

@ -70,6 +70,7 @@ void BLF_color4ubv(int fontid, const unsigned char rgba[4]);
void BLF_color3ubv(int fontid, const unsigned char rgb[3]);
void BLF_color3ubv_alpha(int fontid, const unsigned char rgb[3], unsigned char alpha);
void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b);
void BLF_color4f(int fontid, float r, float g, float b, float a);
void BLF_color4fv(int fontid, const float rgba[4]);
void BLF_color3f(int fontid, float r, float g, float b);
void BLF_color3fv_alpha(int fontid, const float rgb[3], float alpha);

View File

@ -503,6 +503,12 @@ void BLF_color4fv(int fontid, const float rgba[4])
}
}
void BLF_color4f(int fontid, float r, float g, float b, float a)
{
float rgba[4] = { r, g, b, a };
BLF_color4fv(fontid, rgba);
}
void BLF_color3fv_alpha(int fontid, const float rgb[3], float alpha)
{
float rgba[4];

View File

@ -764,8 +764,10 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol),
/* draw scale numbers first before binding any shader */
for (int i = 0; i < 6; i++) {
char str[4];
const int font_id = BLF_default();
BLI_snprintf(str, sizeof(str), "%-3d", i * 20);
str[3] = '\0';
BLF_color4f(font_id, 1.f, 1.f, 1.f, 0.08f);
BLF_draw_default(rect.xmin + 1, yofs - 5 + (i / 5.f) * h, 0, str, sizeof(str) - 1);
}