From 4b365064cfbd4cc802e0e575bcbbfc9539e9fda2 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 10 Feb 2017 00:00:21 +0100 Subject: Remove most (maybe all?) remaining yellow text Decided to request the text color as argument for UI_fonstyle_draw functions, rather than keeping it being another state to keep track of. --- .../editors/animation/anim_channels_defines.c | 11 ++++++----- source/blender/editors/animation/anim_draw.c | 14 +++++++------- source/blender/editors/animation/anim_markers.c | 14 ++++++-------- source/blender/editors/include/UI_interface.h | 14 ++++++++------ source/blender/editors/interface/interface_panel.c | 12 ++++++------ .../blender/editors/interface/interface_regions.c | 18 ++++++++++-------- source/blender/editors/interface/interface_style.c | 16 +++++++++------- .../blender/editors/interface/interface_widgets.c | 16 +++++++--------- source/blender/editors/interface/view2d.c | 3 ++- source/blender/editors/space_file/file_draw.c | 22 ++++++++++++++-------- source/blender/editors/space_info/textview.c | 7 +------ .../blender/editors/space_outliner/outliner_draw.c | 11 +++++++---- source/blender/windowmanager/intern/wm_dragdrop.c | 4 ++-- 13 files changed, 85 insertions(+), 77 deletions(-) diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index ef8dabc1631..716c96fa489 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3903,19 +3903,20 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float if (acf->name && !achannel_is_being_renamed(ac, acf, channel_index)) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; char name[ANIM_CHAN_NAME_SIZE]; /* hopefully this will be enough! */ - + unsigned char col[4]; + /* set text color */ /* XXX: if active, highlight differently? */ if (selected) - UI_ThemeColor(TH_TEXT_HI); + UI_GetThemeColor4ubv(TH_TEXT_HI, col); else - UI_ThemeColor(TH_TEXT); - + UI_GetThemeColor4ubv(TH_TEXT, col); + /* get name */ acf->name(ale, name); offset += 3; - UI_fontstyle_draw_simple(fstyle, offset, ytext, name); + UI_fontstyle_draw_simple(fstyle, offset, ytext, name, col); /* draw red underline if channel is disabled */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE) && (ale->flag & FCURVE_DISABLED)) { diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 58b9b8eba91..2b830657923 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -71,6 +71,9 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const bool time) { const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; + VertexFormat *format = immVertexFormat(); + unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + unsigned char col[4]; float xscale, yscale, x, y; char numstr[32] = " t"; /* t is the character to start replacing from */ int slen; @@ -96,9 +99,6 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const /* get starting coordinates for drawing */ x = cfra * xscale; y = 0.9f * U.widget_unit; - - VertexFormat *format = immVertexFormat(); - unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -107,11 +107,11 @@ static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const immRectf(pos, x, y, x + slen, y + 0.75f * U.widget_unit); immUnbindProgram(); - + /* draw current frame number - black text */ - UI_ThemeColor(TH_TEXT); - UI_fontstyle_draw_simple(fstyle, x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr); - + UI_GetThemeColor4ubv(TH_TEXT, col); + UI_fontstyle_draw_simple(fstyle, x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr, col); + /* restore view transform */ glScalef(xscale, 1.0, 1.0); } diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index f4a673a888b..ef9c2ced580 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -36,7 +36,7 @@ #include "DNA_object_types.h" #include "BLI_blenlib.h" -#include "BLI_math_base.h" +#include "BLI_math.h" #include "BLI_utildefines.h" #include "BLT_translation.h" @@ -380,19 +380,20 @@ static void draw_marker( /* and the marker name too, shifted slightly to the top-right */ if (marker->name[0]) { + unsigned char text_col[4]; float x, y; /* minimal y coordinate which wouldn't be occluded by scroll */ int min_y = 17.0f * UI_DPI_FAC; if (marker->flag & SELECT) { - UI_ThemeColor(TH_TEXT_HI); + UI_GetThemeColor4ubv(TH_TEXT_HI, text_col); x = xpos + 4.0f * UI_DPI_FAC; y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) : 29.0f * UI_DPI_FAC; y = max_ii(y, min_y); } else { - UI_ThemeColor(TH_TEXT); + UI_GetThemeColor4ubv(TH_TEXT, text_col); if ((marker->frame <= cfra) && (marker->frame + 5 > cfra)) { x = xpos + 8.0f * UI_DPI_FAC; y = (ypixels <= 39.0f * UI_DPI_FAC) ? (ypixels - 10.0f * UI_DPI_FAC) : 29.0f * UI_DPI_FAC; @@ -406,14 +407,11 @@ static void draw_marker( #ifdef DURIAN_CAMERA_SWITCH if (marker->camera && (marker->camera->restrictflag & OB_RESTRICT_RENDER)) { - float col[4]; - glGetFloatv(GL_CURRENT_COLOR, col); - col[3] = 0.4; - glColor4fv(col); + text_col[3] = 100; } #endif - UI_fontstyle_draw_simple(fstyle, x, y, marker->name); + UI_fontstyle_draw_simple(fstyle, x, y, marker->name, text_col); } } diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 8caf772ca9a..153c3d415e6 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -1047,12 +1047,14 @@ void UI_context_active_but_prop_get_templateID( /* Styled text draw */ void UI_fontstyle_set(const struct uiFontStyle *fs); -void UI_fontstyle_draw_ex( - const struct uiFontStyle *fs, const struct rcti *rect, const char *str, - size_t len, float *r_xofs, float *r_yofs); -void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str); -void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str); -void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str); +void UI_fontstyle_draw_ex(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, + const unsigned char col[4], size_t len, float *r_xofs, float *r_yofs); +void UI_fontstyle_draw(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, + const unsigned char col[4]); +void UI_fontstyle_draw_rotated(const struct uiFontStyle *fs, const struct rcti *rect, const char *str, + const unsigned char col[4]); +void UI_fontstyle_draw_simple(const struct uiFontStyle *fs, float x, float y, const char *str, + const unsigned char col[4]); void UI_fontstyle_draw_simple_backdrop( const struct uiFontStyle *fs, float x, float y, const char *str, const float col_fg[4], const float col_bg[4]); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 9daddc459aa..1bdc47e5037 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -536,29 +536,29 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const r rcti hrect; int pnl_icons; const char *activename = panel->drawname[0] ? panel->drawname : panel->panelname; + unsigned char col_title[4]; /* + 0.001f to avoid flirting with float inaccuracy */ if (panel->control & UI_PNL_CLOSE) pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f; else pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f; - - /* active tab */ + /* draw text label */ - UI_ThemeColor(TH_TITLE); - + UI_GetThemeColor4ubv(TH_TITLE, col_title); + hrect = *rect; if (dir == 'h') { hrect.xmin = rect->xmin + pnl_icons; hrect.ymin += 2.0f / block->aspect; - UI_fontstyle_draw(&style->paneltitle, &hrect, activename); + UI_fontstyle_draw(&style->paneltitle, &hrect, activename, col_title); } else { /* ignore 'pnl_icons', otherwise the text gets offset horizontally * + 0.001f to avoid flirting with float inaccuracy */ hrect.xmin = rect->xmin + (PNL_ICON + 5) / block->aspect + 0.001f; - UI_fontstyle_draw_rotated(&style->paneltitle, &hrect, activename); + UI_fontstyle_draw_rotated(&style->paneltitle, &hrect, activename, col_title); } } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 62bab15dfb3..b78fa0706c0 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -194,6 +194,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) uiWidgetColors *theme = ui_tooltip_get_theme(); rcti bbox = data->bbox; float tip_colors[UI_TIP_LC_MAX][3]; + unsigned char drawcol[4] = {0, 0, 0, 255}; /* to store color in while drawing (alpha is always 255) */ float *main_color = tip_colors[UI_TIP_LC_MAIN]; /* the color from the theme */ float *value_color = tip_colors[UI_TIP_LC_VALUE]; @@ -260,9 +261,9 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) fstyle_header.shadowalpha = 1.0f; fstyle_header.word_wrap = true; + rgb_float_to_uchar(drawcol, tip_colors[UI_TIP_LC_MAIN]); UI_fontstyle_set(&fstyle_header); - glColor3fv(tip_colors[UI_TIP_LC_MAIN]); - UI_fontstyle_draw(&fstyle_header, &bbox, data->header); + UI_fontstyle_draw(&fstyle_header, &bbox, data->header, drawcol); /* offset to the end of the last line */ xofs = data->line_geom[i].x_pos; @@ -270,9 +271,9 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) bbox.xmin += xofs; bbox.ymax -= yofs; - glColor3fv(tip_colors[UI_TIP_LC_ACTIVE]); + rgb_float_to_uchar(drawcol, tip_colors[UI_TIP_LC_ACTIVE]); fstyle_header.shadow = 0; - UI_fontstyle_draw(&fstyle_header, &bbox, data->active_info); + UI_fontstyle_draw(&fstyle_header, &bbox, data->active_info, drawcol); /* undo offset */ bbox.xmin -= xofs; @@ -280,14 +281,15 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) } else if (data->format[i].style == UI_TIP_STYLE_MONO) { uiFontStyle fstyle_mono = data->fstyle; + fstyle_mono.uifont_id = blf_mono_font; fstyle_mono.word_wrap = true; UI_fontstyle_set(&fstyle_mono); /* XXX, needed because we dont have mono in 'U.uifonts' */ BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.pixelsize, U.dpi); - glColor3fv(tip_colors[data->format[i].color_id]); - UI_fontstyle_draw(&fstyle_mono, &bbox, data->lines[i]); + rgb_float_to_uchar(drawcol, tip_colors[data->format[i].color_id]); + UI_fontstyle_draw(&fstyle_mono, &bbox, data->lines[i], drawcol); } else { uiFontStyle fstyle_normal = data->fstyle; @@ -296,8 +298,8 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) /* draw remaining data */ UI_fontstyle_set(&fstyle_normal); - glColor3fv(tip_colors[data->format[i].color_id]); - UI_fontstyle_draw(&fstyle_normal, &bbox, data->lines[i]); + rgb_float_to_uchar(drawcol, tip_colors[data->format[i].color_id]); + UI_fontstyle_draw(&fstyle_normal, &bbox, data->lines[i], drawcol); } bbox.ymax -= data->lineh * data->line_geom[i].lines; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 8bba8fc5534..01bce9d7bdc 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -149,7 +149,7 @@ static uiFont *uifont_to_blfont(int id) void UI_fontstyle_draw_ex( - const uiFontStyle *fs, const rcti *rect, const char *str, + const uiFontStyle *fs, const rcti *rect, const char *str, const unsigned char col[4], size_t len, float *r_xofs, float *r_yofs) { int xofs = 0, yofs; @@ -196,6 +196,7 @@ void UI_fontstyle_draw_ex( /* clip is very strict, so we give it some space */ BLF_clipping(fs->uifont_id, rect->xmin - 2, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4); BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f); + BLF_color4ubv(fs->uifont_id, col); BLF_draw(fs->uifont_id, str, len); @@ -205,17 +206,17 @@ void UI_fontstyle_draw_ex( *r_yofs = yofs; } -void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str) +void UI_fontstyle_draw(const uiFontStyle *fs, const rcti *rect, const char *str, const unsigned char col[4]) { float xofs, yofs; UI_fontstyle_draw_ex( - fs, rect, str, + fs, rect, str, col, BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs); } /* drawn same as above, but at 90 degree angle */ -void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str) +void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const char *str, const unsigned char col[4]) { float height; int xofs, yofs; @@ -249,6 +250,7 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const ch BLF_enable(fs->uifont_id, BLF_ROTATION); BLF_rotation(fs->uifont_id, angle); + BLF_color4ubv(fs->uifont_id, col); if (fs->shadow) { BLF_enable(fs->uifont_id, BLF_SHADOW); @@ -275,13 +277,14 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const ch * * For drawing on-screen labels. */ -void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str) +void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const unsigned char col[4]) { if (fs->kerning == 1) BLF_enable(fs->uifont_id, BLF_KERNING_DEFAULT); UI_fontstyle_set(fs); BLF_position(fs->uifont_id, x, y, 0.0f); + BLF_color4ubv(fs->uifont_id, col); BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); if (fs->kerning == 1) @@ -315,12 +318,11 @@ void UI_fontstyle_draw_simple_backdrop( x + width + margin, (y + decent) + height + margin, margin, col_bg); - - glColor4fv(col_fg); } BLF_position(fs->uifont_id, x, y, 0.0f); + BLF_color4fv(fs->uifont_id, col_fg); BLF_draw(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); if (fs->kerning == 1) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 84b022ca440..ff4762ccc6a 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1458,8 +1458,6 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b } #endif - BLF_color4ubv(fstyle->uifont_id, (unsigned char *)wcol->text); - if (!use_right_only) { /* for underline drawing */ float font_xofs, font_yofs; @@ -1467,7 +1465,8 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b int drawlen = (drawstr_left_len == INT_MAX) ? strlen(drawstr + but->ofs) : (drawstr_left_len - but->ofs); if (drawlen > 0) { - UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, drawlen, &font_xofs, &font_yofs); + UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, (unsigned char *)wcol->text, + drawlen, &font_xofs, &font_yofs); if (but->menu_key != '\0') { char fixedbuf[128]; @@ -1493,6 +1492,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b ul_advance = BLF_width(fstyle->uifont_id, fixedbuf, ul_index); BLF_position(fstyle->uifont_id, rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f); + BLF_color4ubv(fstyle->uifont_id, (unsigned char *)wcol->text); BLF_draw(fstyle->uifont_id, "_", 2); if (fstyle->kerning == 1) { @@ -1507,7 +1507,7 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b if (drawstr_right) { fstyle->align = UI_STYLE_TEXT_RIGHT; rect->xmax -= UI_TEXT_CLIP_MARGIN; - UI_fontstyle_draw(fstyle, rect, drawstr_right); + UI_fontstyle_draw(fstyle, rect, drawstr_right, (unsigned char *)wcol->text); } } @@ -4129,8 +4129,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0'); } - BLF_color4ubv(fstyle->uifont_id, (unsigned char *)wt->wcol.text); - UI_fontstyle_draw(fstyle, rect, drawstr); + UI_fontstyle_draw(fstyle, rect, drawstr, (unsigned char *)wt->wcol.text); } /* part text right aligned */ @@ -4138,7 +4137,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic if (cpoin) { fstyle->align = UI_STYLE_TEXT_RIGHT; rect->xmax = _rect.xmax - 5; - UI_fontstyle_draw(fstyle, rect, cpoin + 1); + UI_fontstyle_draw(fstyle, rect, cpoin + 1, (unsigned char *)wt->wcol.text); *cpoin = UI_SEP_CHAR; } } @@ -4196,7 +4195,6 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int BLI_strncpy(drawstr, name, sizeof(drawstr)); UI_text_clip_middle_ex(fstyle, drawstr, okwidth, minwidth, max_len, '\0'); - BLF_color4ubv(fstyle->uifont_id, (unsigned char *)wt->wcol.text); - UI_fontstyle_draw(fstyle, &trect, drawstr); + UI_fontstyle_draw(fstyle, &trect, drawstr, (unsigned char *)wt->wcol.text); } } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 15993e4e564..7b4559126b6 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1855,6 +1855,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v /* scale indicators */ if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) { + const int font_id = BLF_default(); View2DGrid *grid = vs->grid; float fac, dfac, fac2, val; @@ -1869,7 +1870,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v dfac = dfac * BLI_rcti_size_x(&hor); /* set starting value, and text color */ - UI_ThemeColor(TH_TEXT); + UI_FontThemeColor(font_id, TH_TEXT); val = grid->startx; /* if we're clamping to whole numbers only, make sure entries won't be repeated */ diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index f049d616aa7..0c3de753a2e 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -290,7 +290,8 @@ static void file_draw_icon(uiBlock *block, const char *path, int sx, int sy, int } -static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align) +static void file_draw_string(int sx, int sy, const char *string, float width, int height, short align, + unsigned char col[4]) { uiStyle *style; uiFontStyle fs; @@ -315,7 +316,7 @@ static void file_draw_string(int sx, int sy, const char *string, float width, in rect.ymin = sy - height; rect.ymax = sy; - UI_fontstyle_draw(&fs, &rect, fname); + UI_fontstyle_draw(&fs, &rect, fname, col); } void file_calc_previews(const bContext *C, ARegion *ar) @@ -537,6 +538,7 @@ void file_draw_list(const bContext *C, ARegion *ar) short align; bool do_drag; int column_space = 0.6f * UI_UNIT_X; + unsigned char text_col[4]; const bool small_size = SMALL_SIZE_CHECK(params->thumbnail_size); const bool update_stat_strings = small_size != SMALL_SIZE_CHECK(layout->curr_size); const float thumb_icon_aspect = sqrtf(64.0f / (float)(params->thumbnail_size)); @@ -645,7 +647,7 @@ void file_draw_list(const bContext *C, ARegion *ar) sx += ICON_DEFAULT_WIDTH_SCALE + 0.2f * UI_UNIT_X; } - UI_ThemeColor4(TH_TEXT); + UI_GetThemeColor4ubv(TH_TEXT, text_col); if (file_selflag & FILE_SEL_EDITING) { uiBut *but; @@ -676,7 +678,7 @@ void file_draw_list(const bContext *C, ARegion *ar) if (!(file_selflag& FILE_SEL_EDITING)) { int tpos = (FILE_IMGDISPLAY == params->display) ? sy - layout->tile_h + layout->textheight : sy; - file_draw_string(sx + 1, tpos, file->name, (float)textwidth, textheight, align); + file_draw_string(sx + 1, tpos, file->name, (float)textwidth, textheight, align, text_col); } sx += (int)layout->column_widths[COLUMN_NAME] + column_space; @@ -688,7 +690,8 @@ void file_draw_list(const bContext *C, ARegion *ar) BLI_filelist_entry_size_to_string(NULL, file->entry->size, small_size, file->entry->size_str); } file_draw_string( - sx, sy, file->entry->size_str, layout->column_widths[COLUMN_SIZE], layout->tile_h, align); + sx, sy, file->entry->size_str, layout->column_widths[COLUMN_SIZE], layout->tile_h, + align, text_col); } sx += (int)layout->column_widths[COLUMN_SIZE] + column_space; } @@ -699,10 +702,12 @@ void file_draw_list(const bContext *C, ARegion *ar) NULL, file->entry->time, small_size, file->entry->time_str, file->entry->date_str); } file_draw_string( - sx, sy, file->entry->date_str, layout->column_widths[COLUMN_DATE], layout->tile_h, align); + sx, sy, file->entry->date_str, layout->column_widths[COLUMN_DATE], layout->tile_h, + align, text_col); sx += (int)layout->column_widths[COLUMN_DATE] + column_space; file_draw_string( - sx, sy, file->entry->time_str, layout->column_widths[COLUMN_TIME], layout->tile_h, align); + sx, sy, file->entry->time_str, layout->column_widths[COLUMN_TIME], layout->tile_h, + align, text_col); sx += (int)layout->column_widths[COLUMN_TIME] + column_space; } else { @@ -717,7 +722,8 @@ void file_draw_list(const bContext *C, ARegion *ar) BLI_filelist_entry_size_to_string(NULL, file->entry->size, small_size, file->entry->size_str); } file_draw_string( - sx, sy, file->entry->size_str, layout->column_widths[COLUMN_SIZE], layout->tile_h, align); + sx, sy, file->entry->size_str, layout->column_widths[COLUMN_SIZE], layout->tile_h, + align, text_col); } sx += (int)layout->column_widths[COLUMN_SIZE] + column_space; } diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index d3c8fed5fc1..8ee488ac591 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -200,17 +200,15 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str immUnbindProgram(); } - glColor3ubv(fg); - /* last part needs no clipping */ BLF_position(cdc->font_id, cdc->xy[0], cdc->lofs + cdc->xy[1], 0); + BLF_color3ubv(cdc->font_id, fg); BLF_draw_mono(cdc->font_id, s, len, cdc->cwidth); if (cdc->sel[0] != cdc->sel[1]) { console_step_sel(cdc, -initial_offset); // glColor4ub(255, 0, 0, 96); // debug console_draw_sel(s, cdc->sel, cdc->xy, len, cdc->cwidth, cdc->lheight, bg_sel); - glColor3ubv(fg); } cdc->xy[1] += cdc->lheight; @@ -226,7 +224,6 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str console_step_sel(cdc, len); // glColor4ub(0, 255, 0, 96); // debug console_draw_sel(s, cdc->sel, cdc->xy, len, cdc->cwidth, cdc->lheight, bg_sel); - glColor3ubv(fg); } cdc->xy[1] += cdc->lheight; @@ -254,8 +251,6 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str immUnbindProgram(); } - glColor3ubv(fg); - BLF_position(cdc->font_id, cdc->xy[0], cdc->lofs + cdc->xy[1], 0); BLF_draw_mono(cdc->font_id, str, str_len, cdc->cwidth); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index fee2c3de42d..d15c3d67d45 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1352,17 +1352,20 @@ static void outliner_draw_tree_element( /* name */ if ((tselem->flag & TSE_TEXTBUT) == 0) { + unsigned char text_col[4]; + if (active == OL_DRAWSEL_NORMAL) { - UI_ThemeColor(TH_TEXT_HI); + UI_GetThemeColor4ubv(TH_TEXT_HI, text_col); } else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) { - UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); + UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.75f, text_col); + text_col[3] = 255; } else { - UI_ThemeColor(TH_TEXT); + UI_GetThemeColor4ubv(TH_TEXT, text_col); } - UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name); + UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name, text_col); } offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name)); diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 85a313b3f81..2d1dcd7f3c9 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -361,8 +361,8 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) drag_rect_minmax(rect, x, y, x + w, y + iconsize); } else { - glColor4ub(255, 255, 255, 255); - UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag)); + const unsigned char col[] = {255, 255, 255, 255}; + UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), col); } /* operator name with roundbox */ -- cgit v1.2.3