diff options
Diffstat (limited to 'source/blender/editors/interface')
18 files changed, 168 insertions, 75 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a0a3d0a3b85..3d8c0da78ea 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -366,7 +366,7 @@ void UI_block_translate(uiBlock *block, int x, int y) static void ui_block_bounds_calc_text(uiBlock *block, float offset) { - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); uiBut *bt, *init_col_bt, *col_bt; int i = 0, j, x1addval = offset; @@ -4439,6 +4439,48 @@ uiBut *uiDefBut(uiBlock *block, return but; } +uiBut *uiDefButImage( + uiBlock *block, void *imbuf, int x, int y, short width, short height, const uchar color[4]) +{ + uiBut *but = ui_def_but( + block, UI_BTYPE_IMAGE, 0, "", x, y, width, height, imbuf, 0, 0, 0, 0, ""); + if (color) { + copy_v4_v4_uchar(but->col, color); + } + else { + but->col[0] = 255; + but->col[1] = 255; + but->col[2] = 255; + but->col[3] = 255; + } + ui_but_update(but); + return but; +} + +uiBut *uiDefButAlert(uiBlock *block, int icon, int x, int y, short width, short height) +{ + struct ImBuf *ibuf = UI_alert_image(icon); + + if (icon == ALERT_ICON_BLENDER) { + return uiDefButImage(block, ibuf, x, y, width, height, NULL); + } + else { + uchar icon_color[4]; + ThemeColorID color_id = TH_INFO_WARNING; + if (icon == ALERT_ICON_ERROR) { + color_id = TH_INFO_ERROR; + } + else if (icon == ALERT_ICON_INFO) { + color_id = TH_INFO_INFO; + } + else if (icon == ALERT_ICON_QUESTION) { + color_id = TH_INFO_PROPERTY; + } + UI_GetThemeColorType4ubv(color_id, SPACE_INFO, icon_color); + return uiDefButImage(block, ibuf, x, y, width, height, icon_color); + } +} + /** * if \a _x_ is a power of two (only one bit) return the power, * otherwise return -1. diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index c9a46e00520..f6da9663daf 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -169,7 +169,7 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg) wmKeyMapItem *kmi; PointerRNA ptr; uiLayout *layout; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); IDProperty *prop; const char *idname = shortcut_get_operator_property(C, but, &prop); @@ -225,7 +225,7 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg) wmKeyMapItem *kmi; PointerRNA ptr; uiLayout *layout; - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); int kmi_id; IDProperty *prop; const char *idname = shortcut_get_operator_property(C, but, &prop); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index e8e74e77425..2800d808889 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -707,9 +707,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), return; } - float facx = 1.0f; - float facy = 1.0f; - int w = BLI_rcti_size_x(rect); int h = BLI_rcti_size_y(rect); @@ -722,10 +719,18 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), # endif GPU_blend(true); + /* Combine with premultiplied alpha. */ + GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); if (w != ibuf->x || h != ibuf->y) { - facx = (float)w / (float)ibuf->x; - facy = (float)h / (float)ibuf->y; + /* We scale the bitmap, rather than have OGL do a worse job. */ + IMB_scaleImBuf(ibuf, w, h); + } + + float col[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + if (but->col[3] != 0) { + /* Optionally use uiBut's col to recolor the image. */ + rgba_uchar_to_float(col, but->col); } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); @@ -738,11 +743,14 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect, - facx, - facy, - NULL); + 1.0f, + 1.0f, + col); GPU_blend(false); + /* Reset default. */ + GPU_blend_set_func_separate( + GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); # if 0 // restore scissortest diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 833631f871d..f4dd114c312 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -58,6 +58,7 @@ #include "BKE_unit.h" #include "BKE_paint.h" #include "BKE_curveprofile.h" +#include "BKE_movieclip.h" #include "IMB_colormanagement.h" @@ -2847,10 +2848,9 @@ static bool ui_textedit_delete_selection(uiBut *but, uiHandleButtonData *data) */ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, const float x) { - uiStyle *style = UI_style_get(); // XXX pass on as arg - uiFontStyle *fstyle = &style->widget; + /* XXX pass on as arg. */ + uiFontStyle fstyle = UI_style_get()->widget; const float aspect = but->block->aspect; - const short fstyle_points_prev = fstyle->points; float startx = but->rect.xmin; float starty_dummy = 0.0f; @@ -2860,13 +2860,13 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con ui_block_to_window_fl(data->region, but->block, &startx, &starty_dummy); - ui_fontscale(&fstyle->points, aspect); + ui_fontscale(&fstyle.points, aspect); - UI_fontstyle_set(fstyle); + UI_fontstyle_set(&fstyle); - if (fstyle->kerning == 1) { + if (fstyle.kerning == 1) { /* for BLF_width */ - BLF_enable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + BLF_enable(fstyle.uifont_id, BLF_KERNING_DEFAULT); } ui_but_text_password_hide(password_str, but, false); @@ -2888,7 +2888,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con while (i > 0) { if (BLI_str_cursor_step_prev_utf8(str, but->ofs, &i)) { /* 0.25 == scale factor for less sensitivity */ - if (BLF_width(fstyle->uifont_id, str + i, (str_last - str) - i) > (startx - x) * 0.25f) { + if (BLF_width(fstyle.uifont_id, str + i, (str_last - str) - i) > (startx - x) * 0.25f) { break; } } @@ -2912,7 +2912,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con but->pos = pos_prev = ((str_last - str) - but->ofs); while (true) { - cdist = startx + BLF_width(fstyle->uifont_id, str + but->ofs, (str_last - str) - but->ofs); + cdist = startx + BLF_width(fstyle.uifont_id, str + but->ofs, (str_last - str) - but->ofs); /* check if position is found */ if (cdist < x) { @@ -2944,13 +2944,11 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, con } } - if (fstyle->kerning == 1) { - BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT); + if (fstyle.kerning == 1) { + BLF_disable(fstyle.uifont_id, BLF_KERNING_DEFAULT); } ui_but_text_password_hide(password_str, but, true); - - fstyle->points = fstyle_points_prev; } static void ui_textedit_set_cursor_select(uiBut *but, uiHandleButtonData *data, const float x) @@ -7339,8 +7337,10 @@ static bool ui_numedit_but_TRACKPREVIEW( } if (!scopes->track_locked) { - if (scopes->marker->framenr != scopes->framenr) { - scopes->marker = BKE_tracking_marker_ensure(scopes->track, scopes->framenr); + const MovieClip *clip = CTX_data_edit_movieclip(C); + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scopes->framenr); + if (scopes->marker->framenr != clip_framenr) { + scopes->marker = BKE_tracking_marker_ensure(scopes->track, clip_framenr); } scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 3e07023e52d..a37b49f5b6e 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -177,6 +177,30 @@ static const IconType icontypes[] = { # include "UI_icons.h" }; +/* ********** Alert Icons ********** */ + +# define ALERT_IMG_SIZE 256 + +ImBuf *UI_alert_image(eAlertIcon icon) +{ +# ifdef WITH_HEADLESS + return NULL +# else + ImBuf *ibuf; + icon = MIN2(icon, ALERT_ICON_MAX - 1); + const int left = icon * ALERT_IMG_SIZE; + const rcti crop = {left, left + ALERT_IMG_SIZE - 1, 0, ALERT_IMG_SIZE - 1}; + ibuf = IMB_ibImageFromMemory((const uchar *)datatoc_alert_icons_png, + datatoc_alert_icons_png_size, + IB_rect, + NULL, + "alert_icon"); + IMB_rect_crop(ibuf, &crop); + IMB_premultiply_alpha(ibuf); + return ibuf; +# endif +} + /* **************************************************** */ static DrawInfo *def_internal_icon( diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index a2e239884a3..e2b4e8f2958 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -839,7 +839,7 @@ const struct uiWidgetColors *ui_tooltip_get_theme(void); void ui_draw_widget_menu_back_color(const rcti *rect, bool use_shadow, const float color[4]); void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow); -void ui_draw_tooltip_background(struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect); +void ui_draw_tooltip_background(const struct uiStyle *UNUSED(style), uiBlock *block, rcti *rect); extern void ui_draw_but( const struct bContext *C, ARegion *region, struct uiStyle *style, uiBut *but, rcti *rect); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 1aa2670942f..64ff9d02cdc 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -91,7 +91,7 @@ typedef struct uiLayoutRoot { uiMenuHandleFunc handlefunc; void *argv; - uiStyle *style; + const uiStyle *style; uiBlock *block; uiLayout *layout; } uiLayoutRoot; @@ -499,7 +499,7 @@ static void ui_item_array(uiLayout *layout, bool compact, bool show_text) { - uiStyle *style = layout->root->style; + const uiStyle *style = layout->root->style; uiBut *but; PropertyType type; PropertySubType subtype; @@ -3707,7 +3707,7 @@ static void ui_litem_layout_root(uiLayout *litem) /* box layout */ static void ui_litem_estimate_box(uiLayout *litem) { - uiStyle *style = litem->root->style; + const uiStyle *style = litem->root->style; ui_litem_estimate_column(litem, true); @@ -3722,7 +3722,7 @@ static void ui_litem_estimate_box(uiLayout *litem) static void ui_litem_layout_box(uiLayout *litem) { uiLayoutItemBx *box = (uiLayoutItemBx *)litem; - uiStyle *style = litem->root->style; + const uiStyle *style = litem->root->style; uiBut *but; int w, h; @@ -3767,7 +3767,7 @@ static void ui_litem_layout_box(uiLayout *litem) /* multi-column layout, automatically flowing to the next */ static void ui_litem_estimate_column_flow(uiLayout *litem) { - uiStyle *style = litem->root->style; + const uiStyle *style = litem->root->style; uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem; uiItem *item; int col, x, y, emh, emy, miny, itemw, itemh, maxw = 0; @@ -3832,7 +3832,7 @@ static void ui_litem_estimate_column_flow(uiLayout *litem) static void ui_litem_layout_column_flow(uiLayout *litem) { - uiStyle *style = litem->root->style; + const uiStyle *style = litem->root->style; uiLayoutItemFlow *flow = (uiLayoutItemFlow *)litem; uiItem *item; int col, x, y, w, emh, emy, miny, itemw, itemh; @@ -4071,7 +4071,7 @@ static void ui_litem_grid_flow_compute(ListBase *items, static void ui_litem_estimate_grid_flow(uiLayout *litem) { - uiStyle *style = litem->root->style; + const uiStyle *style = litem->root->style; uiLayoutItemGridFlow *gflow = (uiLayoutItemGridFlow *)litem; const int space_x = style->columnspace; @@ -4199,7 +4199,7 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem) static void ui_litem_layout_grid_flow(uiLayout *litem) { int i; - uiStyle *style = litem->root->style; + const uiStyle *style = litem->root->style; uiLayoutItemGridFlow *gflow = (uiLayoutItemGridFlow *)litem; uiItem *item; @@ -5092,8 +5092,15 @@ static void ui_layout_add_padding_button(uiLayoutRoot *root) } } -uiLayout *UI_block_layout( - uiBlock *block, int dir, int type, int x, int y, int size, int em, int padding, uiStyle *style) +uiLayout *UI_block_layout(uiBlock *block, + int dir, + int type, + int x, + int y, + int size, + int em, + int padding, + const uiStyle *style) { uiLayout *layout; uiLayoutRoot *root; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 70d64ff26ab..1f5855aed9e 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -434,7 +434,7 @@ void UI_panel_end( static void ui_offset_panel_block(uiBlock *block) { - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); /* compute bounds and offset */ ui_block_bounds_calc(block); @@ -1938,7 +1938,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) // #define USE_FLAT_INACTIVE const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT); View2D *v2d = ®ion->v2d; - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); const uiFontStyle *fstyle = &style->widget; const int fontid = fstyle->uifont_id; short fstyle_points = fstyle->points; diff --git a/source/blender/editors/interface/interface_region_menu_pie.c b/source/blender/editors/interface/interface_region_menu_pie.c index f75f4c054a3..062a8383061 100644 --- a/source/blender/editors/interface/interface_region_menu_pie.c +++ b/source/blender/editors/interface/interface_region_menu_pie.c @@ -104,13 +104,12 @@ static float ui_pie_menu_title_width(const char *name, int icon) uiPieMenu *UI_pie_menu_begin(struct bContext *C, const char *title, int icon, const wmEvent *event) { - uiStyle *style; + const uiStyle *style = UI_style_get_dpi(); uiPieMenu *pie; short event_type; wmWindow *win = CTX_wm_window(C); - style = UI_style_get_dpi(); pie = MEM_callocN(sizeof(*pie), "pie menu"); pie->block_radial = UI_block_begin(C, NULL, __func__, UI_EMBOSS); diff --git a/source/blender/editors/interface/interface_region_menu_popup.c b/source/blender/editors/interface/interface_region_menu_popup.c index 1d066b6bbb1..9ceb864b278 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.c +++ b/source/blender/editors/interface/interface_region_menu_popup.c @@ -310,7 +310,7 @@ uiPopupBlockHandle *ui_popup_menu_create( bContext *C, ARegion *butregion, uiBut *but, uiMenuCreateFunc menu_func, void *arg) { wmWindow *window = CTX_wm_window(C); - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); uiPopupBlockHandle *handle; uiPopupMenu *pup; @@ -380,7 +380,7 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, const char *block_name, int icon) { - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); uiPopupMenu *pup = MEM_callocN(sizeof(uiPopupMenu), "popup menu"); uiBut *but; diff --git a/source/blender/editors/interface/interface_region_popover.c b/source/blender/editors/interface/interface_region_popover.c index 4e4854c8209..d3cd1ebd837 100644 --- a/source/blender/editors/interface/interface_region_popover.c +++ b/source/blender/editors/interface/interface_region_popover.c @@ -94,7 +94,7 @@ static void ui_popover_create_block(bContext *C, uiPopover *pup, int opcontext) { BLI_assert(pup->ui_size_x != 0); - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); pup->block = UI_block_begin(C, NULL, __func__, UI_EMBOSS); UI_block_flag_enable(pup->block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_POPOVER); diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 4481ad54d1a..89eb0658d5e 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -498,7 +498,7 @@ static void ui_searchbox_region_free_cb(ARegion *region) ARegion *ui_searchbox_create_generic(bContext *C, ARegion *butregion, uiBut *but) { wmWindow *win = CTX_wm_window(C); - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); static ARegionType type; ARegion *region; uiSearchboxData *data; diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index c18c78c22a6..02c69e5cef6 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -1158,7 +1158,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C, wmWindow *win = CTX_wm_window(C); const int winx = WM_window_pixels_x(win); const int winy = WM_window_pixels_y(win); - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); static ARegionType type; ARegion *region; int fonth, fontw; diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 192571044b9..fa1f222d27f 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -351,7 +351,7 @@ void UI_fontstyle_draw_simple_backdrop(const uiFontStyle *fs, /* ************** helpers ************************ */ /* XXX: read a style configure */ -uiStyle *UI_style_get(void) +const uiStyle *UI_style_get(void) { #if 0 uiStyle *style = NULL; @@ -364,9 +364,9 @@ uiStyle *UI_style_get(void) } /* for drawing, scaled with DPI setting */ -uiStyle *UI_style_get_dpi(void) +const uiStyle *UI_style_get_dpi(void) { - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); static uiStyle _style; _style = *style; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index b752a1a1429..f11e3a1f5f0 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -591,11 +591,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) DEG_relations_tag_update(bmain); } else { - if (id) { - Main *bmain = CTX_data_main(C); - id_single_user(C, id, &template_ui->ptr, template_ui->prop); - DEG_relations_tag_update(bmain); - } + Main *bmain = CTX_data_main(C); + id_single_user(C, id, &template_ui->ptr, template_ui->prop); + DEG_relations_tag_update(bmain); } } break; @@ -1137,7 +1135,7 @@ static void template_ID_tabs(bContext *C, const int but_height = UI_UNIT_Y * 1.1; uiBlock *block = uiLayoutGetBlock(layout); - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); ListBase ordered; BKE_id_ordered_list(&ordered, template->idlb); @@ -3049,7 +3047,7 @@ static void colorband_tools_dofunc(bContext *C, void *coba_v, int event) static uiBlock *colorband_tools_func(bContext *C, ARegion *region, void *coba_v) { - uiStyle *style = UI_style_get_dpi(); + const uiStyle *style = UI_style_get_dpi(); ColorBand *coba = coba_v; uiBlock *block; short yco = 0, menuwidth = 10 * UI_UNIT_X; @@ -7135,7 +7133,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiLayout *ui_abs; uiBlock *block; uiBut *but; - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); int width; int icon; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 31a1c150b12..b61d54e6cff 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -4990,22 +4990,37 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, if (ELEM(direction, UI_DIR_UP, UI_DIR_DOWN)) { uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ubv(wcol->inner); + + const bool is_down = (direction == UI_DIR_DOWN); + const int sign = is_down ? 1 : -1; + float y = is_down ? rect->ymax : rect->ymin; + GPU_blend(true); immBegin(GPU_PRIM_TRIS, 3); - if (direction == UI_DIR_DOWN) { - const float y = rect->ymax; - immVertex2f(pos, cent_x - unit_half, y); - immVertex2f(pos, cent_x + unit_half, y); - immVertex2f(pos, cent_x, y + unit_half); - } - else { - const float y = rect->ymin; - immVertex2f(pos, cent_x - unit_half, y); - immVertex2f(pos, cent_x + unit_half, y); - immVertex2f(pos, cent_x, y - unit_half); - } + immUniformColor4ub(UNPACK3(wcol->outline), 166); + immVertex2f(pos, cent_x - unit_half, y); + immVertex2f(pos, cent_x + unit_half, y); + immVertex2f(pos, cent_x, y + sign * unit_half); immEnd(); + + y = y - sign * round(U.pixelsize * 1.41); + + GPU_blend(false); + immBegin(GPU_PRIM_TRIS, 3); + immUniformColor4ub(0, 0, 0, 0); + immVertex2f(pos, cent_x - unit_half, y); + immVertex2f(pos, cent_x + unit_half, y); + immVertex2f(pos, cent_x, y + sign * unit_half); + immEnd(); + + GPU_blend(true); + immBegin(GPU_PRIM_TRIS, 3); + immUniformColor4ubv(wcol->inner); + immVertex2f(pos, cent_x - unit_half, y); + immVertex2f(pos, cent_x + unit_half, y); + immVertex2f(pos, cent_x, y + sign * unit_half); + immEnd(); + immUnbindProgram(); } @@ -5235,7 +5250,7 @@ void ui_draw_widget_menu_back(const rcti *rect, bool use_shadow) ui_draw_widget_back_color(UI_WTYPE_MENU_BACK, use_shadow, rect, NULL); } -void ui_draw_tooltip_background(uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect) +void ui_draw_tooltip_background(const uiStyle *UNUSED(style), uiBlock *UNUSED(block), rcti *rect) { uiWidgetType *wt = widget_type(UI_WTYPE_TOOLTIP); wt->state(wt, 0, 0); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index af32143df33..ad2e32149d8 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -243,7 +243,7 @@ static void view2d_masks(View2D *v2d, bool check_scrollers, const rcti *mask_scr void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) { bool tot_changed = false, do_init; - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); do_init = (v2d->flag & V2D_IS_INITIALISED) == 0; @@ -2146,7 +2146,7 @@ static MemArena *g_v2d_strings_arena = NULL; static View2DString *g_v2d_strings = NULL; void UI_view2d_text_cache_add( - View2D *v2d, float x, float y, const char *str, size_t str_len, const char col[4]) + View2D *v2d, float x, float y, const char *str, size_t str_len, const uchar col[4]) { int mval[2]; @@ -2177,7 +2177,7 @@ void UI_view2d_text_cache_add( /* no clip (yet) */ void UI_view2d_text_cache_add_rectf( - View2D *v2d, const rctf *rect_view, const char *str, size_t str_len, const char col[4]) + View2D *v2d, const rctf *rect_view, const char *str, size_t str_len, const uchar col[4]) { rcti rect; diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 7eea9e6a697..2c9803d1dd3 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -2155,7 +2155,7 @@ static void VIEW2D_OT_scroller_activate(wmOperatorType *ot) static int reset_exec(bContext *C, wmOperator *UNUSED(op)) { - uiStyle *style = UI_style_get(); + const uiStyle *style = UI_style_get(); ARegion *region = CTX_wm_region(C); View2D *v2d = ®ion->v2d; int winx, winy; |