diff options
author | Mike Erwin <significant.bit@gmail.com> | 2017-02-02 03:00:30 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2017-02-02 03:00:51 +0300 |
commit | 8e05a5bf8c37174d1019b9dc7efd7a53831f292a (patch) | |
tree | c1018b60c002ca27e949b74f9670f2b77cbb550b /source/blender | |
parent | 64b4a3185c263f5982bb3ecd324f1befb42531bd (diff) |
fix build: BLF Theme color
blenderplayer uses BLF but not Editor UI, so we got a link error for the missing UI_GetThemeColor function.
Moved the new function from BLF to UI.
@Blendify reported problem in IRC
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenfont/BLF_api.h | 2 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf.c | 11 | ||||
-rw-r--r-- | source/blender/editors/include/UI_resources.h | 4 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 8 |
4 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index 856234dad48..b6fc42d774e 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -65,7 +65,6 @@ void BLF_position(int fontid, float x, float y, float z); void BLF_size(int fontid, int size, int dpi); /* goal: small but useful color API */ -void BLF_ThemeColor(int fontid, int colorid); 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); @@ -73,6 +72,7 @@ void BLF_color3ub(int fontid, unsigned char r, unsigned char g, unsigned char b) 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); +/* also available: UI_FontThemeColor(fontid, colorid) */ /* Set a 4x4 matrix to be multiplied before draw the text. * Remember that you need call BLF_enable(BLF_MATRIX) diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 01feb652f31..4b3a965efdf 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -52,8 +52,6 @@ #include "BLF_api.h" -#include "UI_resources.h" - #include "IMB_colormanagement.h" #ifndef BLF_STANDALONE @@ -467,15 +465,6 @@ void BLF_blur(int fontid, int size) } #endif -void BLF_ThemeColor(int fontid, int colorid) -{ - FontBLF *font = blf_get(fontid); - - if (font) { - UI_GetThemeColor4ubv(colorid, font->color); - } -} - void BLF_color4ubv(int fontid, const unsigned char rgba[4]) { FontBLF *font = blf_get(fontid); diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index dbd3d7d9934..5924529ddcc 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -379,6 +379,10 @@ void UI_GetColorPtrShade3ubv(const unsigned char cp1[3], unsigned char col[3] // get a 3 byte color, blended and shaded between two other char color pointers void UI_GetColorPtrBlendShade3ubv(const unsigned char cp1[3], const unsigned char cp2[3], unsigned char col[3], float fac, int offset); +// sets the font color +// (for anything fancy use UI_GetThemeColor[Fancy] then BLF_color) +void UI_FontThemeColor(int fontid, int colorid); + // clear the openGL ClearColor using the input colorid void UI_ThemeClearColor(int colorid); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 38df7620ed6..76b8f348c9c 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -53,6 +53,8 @@ #include "BIF_gl.h" +#include "BLF_api.h" + #include "UI_interface.h" #include "UI_interface_icons.h" @@ -1393,6 +1395,12 @@ void UI_ThemeColorBlendShadeAlpha(int colorid1, int colorid2, float fac, int off glColor4ub(r, g, b, a); } +void UI_FontThemeColor(int fontid, int colorid) +{ + unsigned char color[4]; + UI_GetThemeColor4ubv(colorid, color); + BLF_color4ubv(fontid, color); +} /* get individual values, not scaled */ float UI_GetThemeValuef(int colorid) |