diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-08-05 21:20:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-08-05 21:35:22 +0300 |
commit | b4a325f535e56e37f1a22c12f189b39552fd6ba7 (patch) | |
tree | 8cf0375dbd598546b7cee0891e578682bfd27646 /source | |
parent | 17f299c5d14f0435595afe51c4153ae4037bb81b (diff) |
Cleanup: use unsigned char for theme colors
Nearly all byte-color functions use 'uchar'
causing casts when then colors were passed in.
Declare as uchar to remove the need for casts.
Diffstat (limited to 'source')
17 files changed, 324 insertions, 320 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 984de700ce7..57a7379eeae 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -236,9 +236,9 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp) */ else if (grp->cs.solid[0] == 0) { /* define for setting colors in theme below */ - rgba_char_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255); - rgba_char_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255); - rgba_char_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255); + rgba_uchar_args_set(grp->cs.solid, 0xff, 0x00, 0x00, 255); + rgba_uchar_args_set(grp->cs.select, 0x81, 0xe6, 0x14, 255); + rgba_uchar_args_set(grp->cs.active, 0x18, 0xb6, 0xe0, 255); } } } diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 03eb2b890cf..3bc3be8b022 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -140,12 +140,18 @@ MINLINE void float_to_byte_dither_v3( #define rgba_float_args_set_ch(col, r, g, b, a) \ rgba_float_args_set(col, (r) / 255.0f, (g) / 255.0f, (b) / 255.0f, (a) / 255.0f) -MINLINE void rgba_char_args_set( - char col[4], const char r, const char g, const char b, const char a); +MINLINE void rgba_uchar_args_set(unsigned char col[4], + const unsigned char r, + const unsigned char g, + const unsigned char b, + const unsigned char a); MINLINE void rgba_float_args_set( float col[4], const float r, const float g, const float b, const float a); -MINLINE void rgba_char_args_test_set( - char col[4], const char r, const char g, const char b, const char a); +MINLINE void rgba_uchar_args_test_set(unsigned char col[4], + const unsigned char r, + const unsigned char g, + const unsigned char b, + const unsigned char a); MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack); void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, float max); diff --git a/source/blender/blenlib/intern/math_color_inline.c b/source/blender/blenlib/intern/math_color_inline.c index d7a2d681f33..f5aaddc0ea3 100644 --- a/source/blender/blenlib/intern/math_color_inline.c +++ b/source/blender/blenlib/intern/math_color_inline.c @@ -225,8 +225,8 @@ MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned srgb_to_linearrgb_predivide_v4(linear, fsrgb); } -MINLINE void rgba_char_args_set( - char col[4], const char r, const char g, const char b, const char a) +MINLINE void rgba_uchar_args_set( + uchar col[4], const uchar r, const uchar g, const uchar b, const uchar a) { col[0] = r; col[1] = g; @@ -243,8 +243,8 @@ MINLINE void rgba_float_args_set( col[3] = a; } -MINLINE void rgba_char_args_test_set( - char col[4], const char r, const char g, const char b, const char a) +MINLINE void rgba_uchar_args_test_set( + uchar col[4], const uchar r, const uchar g, const uchar b, const uchar a) { if (col[3] == 0) { col[0] = r; diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 44bb07d87f8..516cead37c1 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -9395,8 +9395,8 @@ static void do_versions_userdef(FileData *fd, BlendFileData *bfd) /* Themes for Node and Sequence editor were not using grid color, * but back. we copy this over then. */ for (btheme = user->themes.first; btheme; btheme = btheme->next) { - copy_v4_v4_char(btheme->space_node.grid, btheme->space_node.back); - copy_v4_v4_char(btheme->space_sequencer.grid, btheme->space_sequencer.back); + copy_v4_v4_uchar(btheme->space_node.grid, btheme->space_node.back); + copy_v4_v4_uchar(btheme->space_sequencer.grid, btheme->space_sequencer.back); } } diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index e42a9bc9f95..e987a623d0b 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -51,12 +51,12 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) memcpy(btheme, &U_theme_default, sizeof(*btheme)); } -#define FROM_DEFAULT_V4_UCHAR(member) copy_v4_v4_char(btheme->member, U_theme_default.member) +#define FROM_DEFAULT_V4_UCHAR(member) copy_v4_v4_uchar(btheme->member, U_theme_default.member) if (!USER_VERSION_ATLEAST(280, 25)) { - copy_v4_v4_char(btheme->space_action.anim_preview_range, btheme->space_action.anim_active); - copy_v4_v4_char(btheme->space_nla.anim_preview_range, btheme->space_nla.anim_active); - copy_v4_v4_char(btheme->space_graph.anim_preview_range, btheme->space_action.anim_active); + copy_v4_v4_uchar(btheme->space_action.anim_preview_range, btheme->space_action.anim_active); + copy_v4_v4_uchar(btheme->space_nla.anim_preview_range, btheme->space_nla.anim_active); + copy_v4_v4_uchar(btheme->space_graph.anim_preview_range, btheme->space_action.anim_active); } if (!USER_VERSION_ATLEAST(280, 26)) { @@ -102,8 +102,8 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) if (!USER_VERSION_ATLEAST(280, 40)) { FROM_DEFAULT_V4_UCHAR(space_preferences.navigation_bar); - copy_v4_v4_char(btheme->space_preferences.execution_buts, - btheme->space_preferences.navigation_bar); + copy_v4_v4_uchar(btheme->space_preferences.execution_buts, + btheme->space_preferences.navigation_bar); } if (!USER_VERSION_ATLEAST(280, 41)) { diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 30e51333f0f..865cfea14e3 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -694,17 +694,17 @@ static bool set_pchan_color(short colCode, uchar cp[4] = {255}; if (boneflag & BONE_DRAW_ACTIVE) { - copy_v3_v3_char((char *)cp, bcolor->active); + copy_v3_v3_uchar(cp, bcolor->active); if (!(boneflag & BONE_SELECTED)) { cp_shade_color3ub(cp, -80); } } else if (boneflag & BONE_SELECTED) { - copy_v3_v3_char((char *)cp, bcolor->select); + copy_v3_v3_uchar(cp, bcolor->select); } else { /* a bit darker than solid */ - copy_v3_v3_char((char *)cp, bcolor->solid); + copy_v3_v3_uchar(cp, bcolor->solid); cp_shade_color3ub(cp, -50); } @@ -742,16 +742,16 @@ static bool set_pchan_color(short colCode, if ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS)) { uchar cp[4]; if (constflag & PCHAN_HAS_TARGET) { - rgba_char_args_set((char *)cp, 255, 150, 0, 80); + rgba_uchar_args_set(cp, 255, 150, 0, 80); } else if (constflag & PCHAN_HAS_IK) { - rgba_char_args_set((char *)cp, 255, 255, 0, 80); + rgba_uchar_args_set(cp, 255, 255, 0, 80); } else if (constflag & PCHAN_HAS_SPLINEIK) { - rgba_char_args_set((char *)cp, 200, 255, 0, 80); + rgba_uchar_args_set(cp, 200, 255, 0, 80); } else if (constflag & PCHAN_HAS_CONST) { - rgba_char_args_set((char *)cp, 0, 255, 120, 80); + rgba_uchar_args_set(cp, 0, 255, 120, 80); } else { return false; @@ -768,13 +768,13 @@ static bool set_pchan_color(short colCode, uchar cp[4] = {255}; if (boneflag & BONE_DRAW_ACTIVE) { - copy_v3_v3_char((char *)cp, bcolor->active); + copy_v3_v3_uchar(cp, bcolor->active); } else if (boneflag & BONE_SELECTED) { - copy_v3_v3_char((char *)cp, bcolor->select); + copy_v3_v3_uchar(cp, bcolor->select); } else { - copy_v3_v3_char((char *)cp, bcolor->solid); + copy_v3_v3_uchar(cp, bcolor->solid); } rgb_uchar_to_float(fcolor, cp); @@ -798,15 +798,15 @@ static bool set_pchan_color(short colCode, uchar cp[4] = {255}; if (boneflag & BONE_DRAW_ACTIVE) { - copy_v3_v3_char((char *)cp, bcolor->active); + copy_v3_v3_uchar(cp, bcolor->active); cp_shade_color3ub(cp, 10); } else if (boneflag & BONE_SELECTED) { - copy_v3_v3_char((char *)cp, bcolor->select); + copy_v3_v3_uchar(cp, bcolor->select); cp_shade_color3ub(cp, -30); } else { - copy_v3_v3_char((char *)cp, bcolor->solid); + copy_v3_v3_uchar(cp, bcolor->solid); cp_shade_color3ub(cp, -30); } @@ -830,16 +830,16 @@ static bool set_pchan_color(short colCode, if ((constflag) && ((bcolor == NULL) || (bcolor->flag & TH_WIRECOLOR_CONSTCOLS))) { uchar cp[4]; if (constflag & PCHAN_HAS_TARGET) { - rgba_char_args_set((char *)cp, 255, 150, 0, 255); + rgba_uchar_args_set(cp, 255, 150, 0, 255); } else if (constflag & PCHAN_HAS_IK) { - rgba_char_args_set((char *)cp, 255, 255, 0, 255); + rgba_uchar_args_set(cp, 255, 255, 0, 255); } else if (constflag & PCHAN_HAS_SPLINEIK) { - rgba_char_args_set((char *)cp, 200, 255, 0, 255); + rgba_uchar_args_set(cp, 200, 255, 0, 255); } else if (constflag & PCHAN_HAS_CONST) { - rgba_char_args_set((char *)cp, 0, 255, 120, 255); + rgba_uchar_args_set(cp, 0, 255, 120, 255); } else if (constflag) { UI_GetThemeColor4ubv(TH_BONE_POSE, cp); @@ -849,7 +849,7 @@ static bool set_pchan_color(short colCode, } else { if (bcolor) { - const char *cp = bcolor->solid; + const uchar *cp = bcolor->solid; rgb_uchar_to_float(fcolor, (uchar *)cp); fcolor[3] = 204.f / 255.f; } diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 3d7178a4114..1649744ba8d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -206,16 +206,16 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa * - only use group colors if allowed to, and if actually feasible */ if (showGroupColors && (grp) && (grp->customCol)) { - unsigned char cp[3]; + uchar cp[3]; if (indent == 2) { - copy_v3_v3_char((char *)cp, grp->cs.solid); + copy_v3_v3_uchar(cp, grp->cs.solid); } else if (indent == 1) { - copy_v3_v3_char((char *)cp, grp->cs.select); + copy_v3_v3_uchar(cp, grp->cs.select); } else { - copy_v3_v3_char((char *)cp, grp->cs.active); + copy_v3_v3_uchar(cp, grp->cs.active); } /* copy the colors over, transforming from bytes to floats */ @@ -850,10 +850,10 @@ static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[ /* highlight only for active */ if (ale->flag & AGRP_ACTIVE) { - copy_v3_v3_char((char *)cp, agrp->cs.select); + copy_v3_v3_uchar(cp, agrp->cs.select); } else { - copy_v3_v3_char((char *)cp, agrp->cs.solid); + copy_v3_v3_uchar(cp, agrp->cs.solid); } /* copy the colors over, transforming from bytes to floats */ diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 1f15fa3bd4d..db8afccbe2d 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -75,7 +75,7 @@ void UI_icon_draw_ex(float x, float aspect, float alpha, float desaturate, - const char mono_color[4], + const uchar mono_color[4], const bool mono_border); void UI_icon_draw_desaturate(float x, diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 6a36bf364a3..aa5d392e08e 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1736,7 +1736,7 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec /* backdrop */ UI_draw_roundbox_corner_set(UI_CNR_ALL); UI_draw_roundbox_3ubAlpha( - true, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f, (uchar *)wcol->inner, 255); + true, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f, wcol->inner, 255); glCullFace(GL_BACK); glEnable(GL_CULL_FACE); @@ -1771,7 +1771,7 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor3ubv((uchar *)wcol->inner); + immUniformColor3ubv(wcol->inner); GPU_blend(true); GPU_line_smooth(true); @@ -1831,7 +1831,7 @@ static void gl_shaded_color_get_fl(const uchar *color, int shade, float r_color[ rgb_uchar_to_float(r_color, color_shaded); } -static void gl_shaded_color(uchar *color, int shade) +static void gl_shaded_color(const uchar *color, int shade) { uchar color_shaded[3]; gl_shaded_color_get(color, shade, color_shaded); @@ -1914,10 +1914,10 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons } else { if (cumap->flag & CUMA_DO_CLIP) { - gl_shaded_color_get_fl((uchar *)wcol->inner, -20, color_backdrop); + gl_shaded_color_get_fl(wcol->inner, -20, color_backdrop); immUniformColor3fv(color_backdrop); immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); - immUniformColor3ubv((uchar *)wcol->inner); + immUniformColor3ubv(wcol->inner); immRectf(pos, rect->xmin + zoomx * (cumap->clipr.xmin - offsx), rect->ymin + zoomy * (cumap->clipr.ymin - offsy), @@ -1925,19 +1925,19 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons rect->ymin + zoomy * (cumap->clipr.ymax - offsy)); } else { - rgb_uchar_to_float(color_backdrop, (const uchar *)wcol->inner); + rgb_uchar_to_float(color_backdrop, wcol->inner); immUniformColor3fv(color_backdrop); immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); } /* grid, every 0.25 step */ - gl_shaded_color((uchar *)wcol->inner, -16); + gl_shaded_color(wcol->inner, -16); ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.25f); /* grid, every 1.0 step */ - gl_shaded_color((uchar *)wcol->inner, -24); + gl_shaded_color(wcol->inner, -24); ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 1.0f); /* axes */ - gl_shaded_color((uchar *)wcol->inner, -50); + gl_shaded_color(wcol->inner, -50); immBegin(GPU_PRIM_LINES, 4); immVertex2f(pos, rect->xmin, rect->ymin + zoomy * (-offsy)); immVertex2f(pos, rect->xmax, rect->ymin + zoomy * (-offsy)); @@ -2026,7 +2026,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons GPU_blend(true); /* Curve filled. */ - immUniformColor3ubvAlpha((uchar *)wcol->item, 128); + immUniformColor3ubvAlpha(wcol->item, 128); GPU_polygon_smooth(true); immBegin(GPU_PRIM_TRI_STRIP, (CM_TABLE * 2 + 2) + 4); immVertex2f(pos, line_range.xmin, rect->ymin); @@ -2044,7 +2044,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons /* Curve line. */ GPU_line_width(1.0f); - immUniformColor3ubvAlpha((uchar *)wcol->item, 255); + immUniformColor3ubvAlpha(wcol->item, 255); GPU_line_smooth(true); immBegin(GPU_PRIM_LINE_STRIP, (CM_TABLE + 1) + 2); immVertex2f(pos, line_range.xmin, line_range.ymin); @@ -2099,7 +2099,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, const uiWidgetColors *wcol, cons pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor3ubv((uchar *)wcol->outline); + immUniformColor3ubv(wcol->outline); imm_draw_box_wire_2d(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); immUnbindProgram(); diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 7584a43a790..e9aa18394fa 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -403,7 +403,7 @@ static void vicon_handletype_auto_clamp_draw(int x, int y, int w, int h, float a static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNUSED(alpha)) { bTheme *btheme = UI_GetTheme(); - ThemeWireColor *cs = &btheme->tarm[index]; + const ThemeWireColor *cs = &btheme->tarm[index]; /* Draw three bands of color: One per color * x-----a-----b-----c @@ -420,15 +420,15 @@ static void vicon_colorset_draw(int index, int x, int y, int w, int h, float UNU /* XXX: Include alpha into this... */ /* normal */ - immUniformColor3ubv((uchar *)cs->solid); + immUniformColor3ubv(cs->solid); immRecti(pos, x, y, a, y + h); /* selected */ - immUniformColor3ubv((uchar *)cs->select); + immUniformColor3ubv(cs->select); immRecti(pos, a, y, b, y + h); /* active */ - immUniformColor3ubv((uchar *)cs->active); + immUniformColor3ubv(cs->active); immRecti(pos, b, y, c, y + h); immUnbindProgram(); @@ -1782,7 +1782,7 @@ static void icon_draw_size(float x, enum eIconSizes size, int draw_size, const float desaturate, - const char mono_rgba[4], + const uchar mono_rgba[4], const bool mono_border) { bTheme *btheme = UI_GetTheme(); @@ -2270,7 +2270,7 @@ void UI_icon_draw_ex(float x, float aspect, float alpha, float desaturate, - const char mono_color[4], + const uchar mono_color[4], const bool mono_border) { int draw_size = get_draw_size(ICON_SIZE_ICON); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 215b0c3c410..8adb82a22c8 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -721,7 +721,7 @@ void ui_draw_aligned_panel(uiStyle *style, (block->aspect * U.inv_dpi_fac), 1.0f, 0.0f, - (const char *)col_title, + col_title, false); GPU_blend(false); } diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index f10702f3f3b..5dd8b74aceb 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -174,10 +174,10 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) ui_draw_tooltip_background(UI_style_get(), NULL, &bbox); /* set background_color */ - rgb_uchar_to_float(background_color, (const uchar *)theme->inner); + rgb_uchar_to_float(background_color, theme->inner); /* calculate normal_color */ - rgb_uchar_to_float(main_color, (const uchar *)theme->text); + rgb_uchar_to_float(main_color, theme->text); copy_v3_v3(active_color, main_color); copy_v3_v3(normal_color, main_color); copy_v3_v3(python_color, main_color); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 55ec10b03dc..9c4d628cec5 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1135,7 +1135,7 @@ static void shape_preset_trias_from_rect_checkmark(uiWidgetTrias *tria, const rc /* prepares shade colors */ static void shadecolors4( - char coltop[4], char coldown[4], const char *color, short shadetop, short shadedown) + uchar coltop[4], uchar coldown[4], const uchar *color, short shadetop, short shadedown) { coltop[0] = CLAMPIS(color[0] + shadetop, 0, 255); coltop[1] = CLAMPIS(color[1] + shadetop, 0, 255); @@ -1149,8 +1149,8 @@ static void shadecolors4( } static void round_box_shade_col4_r(uchar r_col[4], - const char col1[4], - const char col2[4], + const uchar col1[4], + const uchar col2[4], const float fac) { const int faci = unit_float_to_uchar_clamp(fac); @@ -1352,15 +1352,14 @@ static void widgetbase_draw_ex(uiWidgetBase *wtb, if (wtb->draw_inner) { if (wcol->shaded == 0) { /* simple fill */ - inner_col1[0] = inner_col2[0] = (uchar)wcol->inner[0]; - inner_col1[1] = inner_col2[1] = (uchar)wcol->inner[1]; - inner_col1[2] = inner_col2[2] = (uchar)wcol->inner[2]; - inner_col1[3] = inner_col2[3] = (uchar)wcol->inner[3]; + inner_col1[0] = inner_col2[0] = wcol->inner[0]; + inner_col1[1] = inner_col2[1] = wcol->inner[1]; + inner_col1[2] = inner_col2[2] = wcol->inner[2]; + inner_col1[3] = inner_col2[3] = wcol->inner[3]; } else { /* gradient fill */ - shadecolors4( - (char *)inner_col1, (char *)inner_col2, wcol->inner, wcol->shadetop, wcol->shadedown); + shadecolors4(inner_col1, inner_col2, wcol->inner, wcol->shadetop, wcol->shadedown); } } @@ -1436,7 +1435,7 @@ static int ui_but_draw_menu_icon(const uiBut *but) /* icons have been standardized... and this call draws in untransformed coordinates */ static void widget_draw_icon( - const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, const char mono_color[4]) + const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, const uchar mono_color[4]) { float xs = 0.0f, ys = 0.0f; float aspect, height; @@ -1510,8 +1509,8 @@ static void widget_draw_icon( } /* Get theme color. */ - char color[4] = {mono_color[0], mono_color[1], mono_color[2], mono_color[3]}; - bool has_theme = UI_icon_get_theme_color(icon, (uchar *)color); + uchar color[4] = {mono_color[0], mono_color[1], mono_color[2], mono_color[3]}; + bool has_theme = UI_icon_get_theme_color(icon, color); /* to indicate draggable */ if (but->dragpoin && (but->flag & UI_ACTIVE)) { @@ -1548,7 +1547,7 @@ static void widget_draw_submenu_tria(const uiBut *but, float col[4]; rctf tria_rect; - rgba_uchar_to_float(col, (const uchar *)wcol->text); + rgba_uchar_to_float(col, wcol->text); col[3] *= 0.8f; BLI_rctf_init(&tria_rect, xs, xs + tria_width, ys, ys + tria_height); @@ -2099,7 +2098,7 @@ static void widget_draw_text(const uiFontStyle *fstyle, immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ubv((uchar *)wcol->item); + immUniformColor4ubv(wcol->item); immRecti(pos, rect->xmin + selsta_draw, rect->ymin + 2, @@ -2214,7 +2213,7 @@ static void widget_draw_text(const uiFontStyle *fstyle, UI_fontstyle_draw_ex(fstyle, rect, drawstr + but->ofs, - (uchar *)wcol->text, + wcol->text, &(struct uiFontStyleDraw_Params){ .align = align, }, @@ -2250,7 +2249,7 @@ static void widget_draw_text(const uiFontStyle *fstyle, rect->xmin + font_xofs + ul_advance, rect->ymin + font_yofs, 0.0f); - BLF_color4ubv(fstyle->uifont_id, (uchar *)wcol->text); + BLF_color4ubv(fstyle->uifont_id, wcol->text); BLF_draw(fstyle->uifont_id, "_", 2); if (fstyle->kerning == 1) { @@ -2263,8 +2262,8 @@ static void widget_draw_text(const uiFontStyle *fstyle, /* part text right aligned */ if (drawstr_right) { - char col[4]; - copy_v4_v4_char(col, wcol->text); + uchar col[4]; + copy_v4_v4_uchar(col, wcol->text); if (but->drawflag & UI_BUT_HAS_SHORTCUT) { col[3] *= 0.5f; } @@ -2273,7 +2272,7 @@ static void widget_draw_text(const uiFontStyle *fstyle, UI_fontstyle_draw(fstyle, rect, drawstr_right, - (const uchar *)col, + col, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_RIGHT, }); @@ -2476,7 +2475,7 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle, /* ************ button callbacks, state ***************** */ -static void widget_state_blend(char cp[3], const char cpstate[3], const float fac) +static void widget_state_blend(uchar cp[3], const uchar cpstate[3], const float fac) { if (fac != 0.0f) { cp[0] = (int)((1.0f - fac) * cp[0] + fac * cpstate[0]); @@ -2502,18 +2501,18 @@ static void ui_widget_color_disabled(uiWidgetType *wt) wt->wcol_theme = &wcol_theme_s; } -static void rgb_tint(char cp[3], int tint) +static void rgb_tint(uchar cp[3], int tint) { cp[0] = clamp_i(cp[0] + tint, 0, 255); cp[1] = clamp_i(cp[1] + tint, 0, 255); cp[2] = clamp_i(cp[2] + tint, 0, 255); } -static void rgb_ensure_contrast(char cp[3], const char cp_other[3], int contrast) +static void rgb_ensure_contrast(uchar cp[3], const uchar cp_other[3], int contrast) { BLI_assert(contrast > 0); - const int item_value = rgb_to_grayscale_byte((const uchar *)cp); - const int inner_value = rgb_to_grayscale_byte((const uchar *)cp_other); + const int item_value = rgb_to_grayscale_byte(cp); + const int inner_value = rgb_to_grayscale_byte(cp_other); const int delta = item_value - inner_value; if (delta >= 0) { if (contrast > delta) { @@ -2527,16 +2526,16 @@ static void rgb_ensure_contrast(char cp[3], const char cp_other[3], int contrast } } -static void widget_active_color(char cp[3]) +static void widget_active_color(uchar cp[3]) { cp[0] = cp[0] >= 240 ? 255 : cp[0] + 15; cp[1] = cp[1] >= 240 ? 255 : cp[1] + 15; cp[2] = cp[2] >= 240 ? 255 : cp[2] + 15; } -static const char *widget_color_blend_from_flags(const uiWidgetStateColors *wcol_state, - int state, - int drawflag) +static const uchar *widget_color_blend_from_flags(const uiWidgetStateColors *wcol_state, + int state, + int drawflag) { if (drawflag & UI_BUT_ANIMATED_CHANGED) { return wcol_state->inner_changed_sel; @@ -2573,15 +2572,15 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag) wt->wcol = *(wt->wcol_theme); - const char *color_blend = widget_color_blend_from_flags(wcol_state, state, drawflag); + const uchar *color_blend = widget_color_blend_from_flags(wcol_state, state, drawflag); if (state & UI_SELECT) { - copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel); if (color_blend != NULL) { widget_state_blend(wt->wcol.inner, color_blend, wcol_state->blend); } - copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); + copy_v3_v3_uchar(wt->wcol.text, wt->wcol.text_sel); if (state & UI_SELECT) { SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); @@ -2598,7 +2597,7 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag) } if (state & UI_BUT_REDALERT) { - char red[4] = {255, 0, 0}; + uchar red[4] = {255, 0, 0}; if (wt->draw) { widget_state_blend(wt->wcol.inner, red, 0.4f); } @@ -2609,13 +2608,13 @@ static void widget_state(uiWidgetType *wt, int state, int drawflag) if (state & UI_BUT_DRAG_MULTI) { /* the button isn't SELECT but we're editing this so draw with sel color */ - copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel); SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown); widget_state_blend(wt->wcol.text, wt->wcol.text_sel, 0.85f); } if (state & UI_BUT_NODE_ACTIVE) { - char blue[4] = {86, 128, 194}; + uchar blue[4] = {86, 128, 194}; widget_state_blend(wt->wcol.inner, blue, 0.3f); } } @@ -2628,13 +2627,12 @@ static void widget_state_numslider(uiWidgetType *wt, int state, int drawflag) /* call this for option button */ widget_state(wt, state, drawflag); - const char *color_blend = widget_color_blend_from_flags(wcol_state, state, drawflag); + const uchar *color_blend = widget_color_blend_from_flags(wcol_state, state, drawflag); if (color_blend != NULL) { /* Set the slider 'item' so that it reflects state settings too. * De-saturate so the color of the slider doesn't conflict with the blend color, * which can make the color hard to see when the slider is set to full (see T66102). */ - wt->wcol.item[0] = wt->wcol.item[1] = wt->wcol.item[2] = rgb_to_grayscale_byte( - (const uchar *)wt->wcol.item); + wt->wcol.item[0] = wt->wcol.item[1] = wt->wcol.item[2] = rgb_to_grayscale_byte(wt->wcol.item); widget_state_blend(wt->wcol.item, color_blend, wcol_state->blend); rgb_ensure_contrast(wt->wcol.item, wt->wcol.inner, 30); } @@ -2654,10 +2652,10 @@ static void widget_state_option_menu(uiWidgetType *wt, int state, int drawflag) /* if not selected we get theme from menu back */ if (state & UI_SELECT) { - copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text_sel); + copy_v3_v3_uchar(wt->wcol.text, btheme->tui.wcol_menu_back.text_sel); } else { - copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text); + copy_v3_v3_uchar(wt->wcol.text, btheme->tui.wcol_menu_back.text); } } @@ -2682,13 +2680,13 @@ static void widget_state_pie_menu_item(uiWidgetType *wt, int state, int UNUSED(d widget_state_blend(wt->wcol.text, wt->wcol.text_sel, 0.5f); /* draw the backdrop at low alpha, helps navigating with keys * when disabled items are active */ - copy_v4_v4_char(wt->wcol.inner, wt->wcol.item); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.item); wt->wcol.inner[3] = 64; } else { /* regular active */ if (state & (UI_SELECT | UI_ACTIVE)) { - copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); + copy_v3_v3_uchar(wt->wcol.text, wt->wcol.text_sel); } else if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { /* regular disabled */ @@ -2696,10 +2694,10 @@ static void widget_state_pie_menu_item(uiWidgetType *wt, int state, int UNUSED(d } if (state & UI_SELECT) { - copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel); } else if (state & UI_ACTIVE) { - copy_v4_v4_char(wt->wcol.inner, wt->wcol.item); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.item); } } } @@ -2714,13 +2712,13 @@ static void widget_state_menu_item(uiWidgetType *wt, int state, int UNUSED(drawf widget_state_blend(wt->wcol.text, wt->wcol.text_sel, 0.5f); /* draw the backdrop at low alpha, helps navigating with keys * when disabled items are active */ - copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel); wt->wcol.inner[3] = 64; } else { /* regular active */ if (state & UI_ACTIVE) { - copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel); + copy_v3_v3_uchar(wt->wcol.text, wt->wcol.text_sel); } else if (state & (UI_BUT_DISABLED | UI_BUT_INACTIVE)) { /* regular disabled */ @@ -2728,7 +2726,7 @@ static void widget_state_menu_item(uiWidgetType *wt, int state, int UNUSED(drawf } if (state & UI_ACTIVE) { - copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel); } } } @@ -2965,7 +2963,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const GPU_blend(true); GPU_line_smooth(true); - immUniformColor3ubv((uchar *)wcol->outline); + immUniformColor3ubv(wcol->outline); imm_draw_circle_wire_2d(pos, centx, centy, radius, tot); immUnbindProgram(); @@ -3347,7 +3345,7 @@ static void widget_numbut_draw( wtb_zone.draw_emboss = false; wcol_zone = *wcol; - copy_v3_v3_char(wcol_zone.item, wcol->text); + copy_v3_v3_uchar(wcol_zone.item, wcol->text); if (state & UI_STATE_ACTIVE_LEFT) { widget_active_color(wcol_zone.inner); } @@ -3367,7 +3365,7 @@ static void widget_numbut_draw( wtb_zone.tria1.type = ROUNDBOX_TRIA_ARROWS; wcol_zone = *wcol; - copy_v3_v3_char(wcol_zone.item, wcol->text); + copy_v3_v3_uchar(wcol_zone.item, wcol->text); if (state & UI_STATE_ACTIVE_RIGHT) { widget_active_color(wcol_zone.inner); } @@ -3386,7 +3384,7 @@ static void widget_numbut_draw( wtb_zone.draw_emboss = false; wcol_zone = *wcol; - copy_v3_v3_char(wcol_zone.item, wcol->text); + copy_v3_v3_uchar(wcol_zone.item, wcol->text); if (!(state & (UI_STATE_ACTIVE_LEFT | UI_STATE_ACTIVE_RIGHT))) { widget_active_color(wcol_zone.inner); } @@ -3466,7 +3464,7 @@ void UI_draw_widget_scroll(uiWidgetColors *wcol, const rcti *rect, const rcti *s else { SWAP(short, wcol->shadetop, wcol->shadedown); - copy_v4_v4_char(wcol->inner, wcol->item); + copy_v4_v4_uchar(wcol->inner, wcol->item); if (wcol->shadetop > wcol->shadedown) { wcol->shadetop += 20; /* XXX violates themes... */ @@ -3613,7 +3611,7 @@ static void widget_progressbar( widgetbase_draw(&wtb, wcol); /* "slider" bar color */ - copy_v3_v3_char(wcol->inner, wcol->item); + copy_v3_v3_uchar(wcol->inner, wcol->item); widgetbase_draw(&wtb_bar, wcol); /* raise text a bit */ @@ -3626,12 +3624,12 @@ static void widget_nodesocket( { uiWidgetBase wtb; int radi = 5; - char old_inner[3], old_outline[3]; + uchar old_inner[3], old_outline[3]; widget_init(&wtb); - copy_v3_v3_char(old_inner, wcol->inner); - copy_v3_v3_char(old_outline, wcol->outline); + copy_v3_v3_uchar(old_inner, wcol->inner); + copy_v3_v3_uchar(old_outline, wcol->outline); wcol->inner[0] = but->col[0]; wcol->inner[1] = but->col[1]; @@ -3652,8 +3650,8 @@ static void widget_nodesocket( round_box_edges(&wtb, UI_CNR_ALL, rect, (float)radi); widgetbase_draw(&wtb, wcol); - copy_v3_v3_char(wcol->inner, old_inner); - copy_v3_v3_char(wcol->outline, old_outline); + copy_v3_v3_uchar(wcol->inner, old_inner); + copy_v3_v3_uchar(wcol->outline, old_outline); } static void widget_numslider( @@ -3662,7 +3660,7 @@ static void widget_numslider( uiWidgetBase wtb, wtb1; rcti rect1; float offs, toffs; - char outline[3]; + uchar outline[3]; widget_init(&wtb); widget_init(&wtb1); @@ -3679,9 +3677,9 @@ static void widget_numslider( if (!(state & UI_STATE_TEXT_INPUT)) { int roundboxalign_slider = roundboxalign; - copy_v3_v3_char(outline, wcol->outline); - copy_v3_v3_char(wcol->outline, wcol->item); - copy_v3_v3_char(wcol->inner, wcol->item); + copy_v3_v3_uchar(outline, wcol->outline); + copy_v3_v3_uchar(wcol->outline, wcol->item); + copy_v3_v3_uchar(wcol->inner, wcol->item); if (!(state & UI_SELECT)) { SWAP(short, wcol->shadetop, wcol->shadedown); @@ -3723,7 +3721,7 @@ static void widget_numslider( widgetbase_set_uniform_discard_factor(&wtb1, factor_discard); widgetbase_draw(&wtb1, wcol); - copy_v3_v3_char(wcol->outline, outline); + copy_v3_v3_uchar(wcol->outline, outline); if (!(state & UI_SELECT)) { SWAP(short, wcol->shadetop, wcol->shadedown); @@ -3788,7 +3786,7 @@ static void widget_swatch( ui_block_cm_to_display_space_v3(but->block, col); } - rgba_float_to_uchar((uchar *)wcol->inner, col); + rgba_float_to_uchar(wcol->inner, col); const bool show_alpha_checkers = (wcol->inner[3] < 255); wcol->shaded = 0; @@ -3923,9 +3921,9 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int const float rad = wcol->roundness * U.widget_unit; if (state & UI_ACTIVE) { - copy_v4_v4_char(wcol->inner, wcol->inner_sel); - copy_v3_v3_char(wcol->text, wcol->text_sel); - copy_v3_v3_char(wcol->outline, wcol->inner); + copy_v4_v4_uchar(wcol->inner, wcol->inner_sel); + copy_v3_v3_uchar(wcol->text, wcol->text_sel); + copy_v3_v3_uchar(wcol->outline, wcol->inner); } else { wcol->inner[3] *= 1.0f - back[3]; @@ -4061,15 +4059,15 @@ static void widget_state_label(uiWidgetType *wt, int state, int drawflag) /* call this for option button */ widget_state(wt, state, drawflag); if (state & UI_SELECT) { - UI_GetThemeColor3ubv(TH_TEXT_HI, (uchar *)wt->wcol.text); + UI_GetThemeColor3ubv(TH_TEXT_HI, wt->wcol.text); } else { - UI_GetThemeColor3ubv(TH_TEXT, (uchar *)wt->wcol.text); + UI_GetThemeColor3ubv(TH_TEXT, wt->wcol.text); } } if (state & UI_BUT_REDALERT) { - char red[4] = {255, 0, 0}; + uchar red[4] = {255, 0, 0}; widget_state_blend(wt->wcol.text, red, 0.4f); } } @@ -4092,11 +4090,11 @@ static void widget_box( { uiWidgetBase wtb; float rad; - char old_col[3]; + uchar old_col[3]; widget_init(&wtb); - copy_v3_v3_char(old_col, wcol->inner); + copy_v3_v3_uchar(old_col, wcol->inner); /* abuse but->hsv - if it's non-zero, use this color as the box's background */ if (but->col[3]) { @@ -4111,7 +4109,7 @@ static void widget_box( widgetbase_draw(&wtb, wcol); - copy_v3_v3_char(wcol->inner, old_col); + copy_v3_v3_uchar(wcol->inner, old_col); } static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) @@ -4175,12 +4173,10 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox #ifdef USE_TAB_SHADED_HIGHLIGHT /* create outline highlight colors */ if (is_active) { - interp_v3_v3v3_uchar( - theme_col_tab_highlight, (uchar *)wcol->inner_sel, (uchar *)wcol->outline, 0.2f); + interp_v3_v3v3_uchar(theme_col_tab_highlight, wcol->inner_sel, wcol->outline, 0.2f); } else { - interp_v3_v3v3_uchar( - theme_col_tab_highlight, (uchar *)wcol->inner, (uchar *)wcol->outline, 0.12f); + interp_v3_v3v3_uchar(theme_col_tab_highlight, wcol->inner, wcol->outline, 0.12f); } #endif @@ -4202,7 +4198,7 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox #ifdef USE_TAB_SHADED_HIGHLIGHT /* draw outline (3d look) */ - ui_draw_but_TAB_outline(rect, rad, theme_col_tab_highlight, (uchar *)wcol->inner); + ui_draw_but_TAB_outline(rect, rad, theme_col_tab_highlight, wcol->inner); #endif #ifndef USE_TAB_SHADED_HIGHLIGHT @@ -4819,7 +4815,7 @@ void ui_draw_but(const bContext *C, ARegion *ar, uiStyle *style, uiBut *but, rct uiWidgetType wt_back = *wt; uiWidgetType *wt_temp = widget_type(UI_WTYPE_MENU_ITEM); wt_temp->state(wt_temp, state, drawflag); - copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel); + copy_v4_v4_uchar(wt->wcol.inner, wt->wcol.inner_sel); wt->wcol.inner[3] = 128; wt->wcol.roundness = 0.5f; ui_draw_roundbox(&rect_orig, @@ -4845,7 +4841,7 @@ static void ui_draw_clip_tri(uiBlock *block, rcti *rect, uiWidgetType *wt) { if (block) { float draw_color[4]; - uchar *color = (uchar *)wt->wcol.text; + const uchar *color = wt->wcol.text; draw_color[0] = ((float)color[0]) / 255.0f; draw_color[1] = ((float)color[1]) / 255.0f; @@ -4913,7 +4909,7 @@ 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((uchar *)wcol->inner); + immUniformColor4ubv(wcol->inner); GPU_blend(true); immBegin(GPU_PRIM_TRIS, 3); if (direction == UI_DIR_DOWN) { @@ -4958,8 +4954,8 @@ static void draw_disk_shaded(float start, float radius_int, float radius_ext, int subd, - const char col1[4], - const char col2[4], + const uchar col1[4], + const uchar col2[4], bool shaded) { const float radius_ext_scale = (0.5f / radius_ext); /* 1 / (2 * radius_ext) */ @@ -4979,7 +4975,7 @@ static void draw_disk_shaded(float start, } else { immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ubv((uchar *)col1); + immUniformColor4ubv(col1); } immBegin(GPU_PRIM_TRI_STRIP, subd * 2); @@ -5032,7 +5028,7 @@ void ui_draw_pie_center(uiBlock *block) GPU_blend(true); if (btheme->tui.wcol_pie_menu.shaded) { - char col1[4], col2[4]; + uchar col1[4], col2[4]; shadecolors4(col1, col2, btheme->tui.wcol_pie_menu.inner, @@ -5060,7 +5056,7 @@ void ui_draw_pie_center(uiBlock *block) if (!(block->pie_data.flags & UI_PIE_INVALID_DIR)) { if (btheme->tui.wcol_pie_menu.shaded) { - char col1[4], col2[4]; + uchar col1[4], col2[4]; shadecolors4(col1, col2, btheme->tui.wcol_pie_menu.inner_sel, @@ -5090,7 +5086,7 @@ void ui_draw_pie_center(uiBlock *block) GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ubv((uchar *)btheme->tui.wcol_pie_menu.outline); + immUniformColor4ubv(btheme->tui.wcol_pie_menu.outline); imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, pie_radius_internal, subd); imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, pie_radius_external, subd); @@ -5102,7 +5098,7 @@ void ui_draw_pie_center(uiBlock *block) float pie_confirm_radius = U.dpi_fac * (pie_radius_internal + U.pie_menu_confirm); float pie_confirm_external = U.dpi_fac * (pie_radius_internal + U.pie_menu_confirm + 7.0f); - const char col[4] = {UNPACK3(btheme->tui.wcol_pie_menu.text_sel), 64}; + const uchar col[4] = {UNPACK3(btheme->tui.wcol_pie_menu.text_sel), 64}; draw_disk_shaded(angle - range / 2.0f, range, pie_confirm_radius, @@ -5144,7 +5140,7 @@ static void ui_draw_widget_back_color(uiWidgetTypeEnum type, rcti rect_copy = *rect; wt->state(wt, 0, 0); if (color) { - rgba_float_to_uchar((uchar *)wt->wcol.inner, color); + rgba_float_to_uchar(wt->wcol.inner, color); } wt->draw(&wt->wcol, &rect_copy, 0, UI_CNR_ALL); } @@ -5222,7 +5218,7 @@ void ui_draw_menu_item( UI_fontstyle_draw(fstyle, rect, drawstr, - (uchar *)wt->wcol.text, + wt->wcol.text, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_LEFT, }); @@ -5235,7 +5231,7 @@ void ui_draw_menu_item( UI_fontstyle_draw(fstyle, rect, cpoin + 1, - (uchar *)wt->wcol.text, + wt->wcol.text, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_RIGHT, }); @@ -5303,7 +5299,7 @@ void ui_draw_preview_item( UI_fontstyle_draw(fstyle, &trect, drawstr, - (uchar *)wt->wcol.text, + wt->wcol.text, &(struct uiFontStyleDraw_Params){ .align = UI_STYLE_TEXT_CENTER, }); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 25116934b06..c31de60c7ed 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -83,12 +83,12 @@ void ui_resources_free(void) const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) { ThemeSpace *ts = NULL; - static char error[4] = {240, 0, 240, 255}; - static char alert[4] = {240, 60, 60, 255}; - static char headerdesel[4] = {0, 0, 0, 255}; - static char back[4] = {0, 0, 0, 255}; - static char setting = 0; - const char *cp = error; + static uchar error[4] = {240, 0, 240, 255}; + static uchar alert[4] = {240, 60, 60, 255}; + static uchar headerdesel[4] = {0, 0, 0, 255}; + static uchar back[4] = {0, 0, 0, 255}; + static uchar setting = 0; + const uchar *cp = error; /* ensure we're not getting a color after running BKE_blender_userdef_free */ BLI_assert(BLI_findindex(&U.themes, theme_active) != -1); @@ -186,7 +186,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) cp = ts->button; } - copy_v4_v4_char(back, cp); + copy_v4_v4_uchar(back, cp); if (!ED_region_is_overlap(spacetype, theme_regionid)) { back[3] = 255; } @@ -903,7 +903,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid) break; case TH_ICON_FUND: { /* Development fund icon color is not part of theme. */ - static const char red[4] = {204, 48, 72, 255}; + static const uchar red[4] = {204, 48, 72, 255}; cp = red; break; } diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 8c36d4ae2bd..e4881a6f13d 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2407,9 +2407,9 @@ static void tselem_draw_layer_collection_enable_icon( /* restrict column clip... it has been coded by simply overdrawing, * doesn't work for buttons */ - char color[4]; + uchar color[4]; int icon = RNA_property_ui_icon(exclude_prop); - if (UI_icon_get_theme_color(icon, (uchar *)color)) { + if (UI_icon_get_theme_color(icon, color)) { UI_icon_draw_ex(x, y, icon, U.inv_dpi_fac, alpha, 0.0f, color, true); } else { @@ -2467,8 +2467,8 @@ static void tselem_draw_icon(uiBlock *block, /* restrict column clip... it has been coded by simply overdrawing, * doesn't work for buttons */ - char color[4]; - if (UI_icon_get_theme_color(data.icon, (uchar *)color)) { + uchar color[4]; + if (UI_icon_get_theme_color(data.icon, color)) { UI_icon_draw_ex(x, y, data.icon, U.inv_dpi_fac, alpha, 0.0f, color, true); } else { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index b90f1fd16df..ad3cbaeea46 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -116,37 +116,37 @@ typedef struct uiStyle { } uiStyle; typedef struct uiWidgetColors { - char outline[4]; - char inner[4]; - char inner_sel[4]; - char item[4]; - char text[4]; - char text_sel[4]; - char shaded; + unsigned char outline[4]; + unsigned char inner[4]; + unsigned char inner_sel[4]; + unsigned char item[4]; + unsigned char text[4]; + unsigned char text_sel[4]; + unsigned char shaded; char _pad0[7]; short shadetop, shadedown; float roundness; } uiWidgetColors; typedef struct uiWidgetStateColors { - char inner_anim[4]; - char inner_anim_sel[4]; - char inner_key[4]; - char inner_key_sel[4]; - char inner_driven[4]; - char inner_driven_sel[4]; - char inner_overridden[4]; - char inner_overridden_sel[4]; - char inner_changed[4]; - char inner_changed_sel[4]; + unsigned char inner_anim[4]; + unsigned char inner_anim_sel[4]; + unsigned char inner_key[4]; + unsigned char inner_key_sel[4]; + unsigned char inner_driven[4]; + unsigned char inner_driven_sel[4]; + unsigned char inner_overridden[4]; + unsigned char inner_overridden_sel[4]; + unsigned char inner_changed[4]; + unsigned char inner_changed_sel[4]; float blend; char _pad0[4]; } uiWidgetStateColors; typedef struct uiPanelColors { - char header[4]; - char back[4]; - char sub_back[4]; + unsigned char header[4]; + unsigned char back[4]; + unsigned char sub_back[4]; char _pad0[4]; } uiPanelColors; @@ -160,13 +160,13 @@ typedef struct ThemeUI { uiWidgetStateColors wcol_state; - char widget_emboss[4]; + unsigned char widget_emboss[4]; /* fac: 0 - 1 for blend factor, width in pixels */ float menu_shadow_fac; short menu_shadow_width; - char editor_outline[4]; + unsigned char editor_outline[4]; char _pad0[2]; float icon_alpha; @@ -174,28 +174,28 @@ typedef struct ThemeUI { char _pad[4]; /* Axis Colors */ - char xaxis[4], yaxis[4], zaxis[4]; + unsigned char xaxis[4], yaxis[4], zaxis[4]; /* Gizmo Colors. */ - char gizmo_hi[4]; - char gizmo_primary[4]; - char gizmo_secondary[4]; - char gizmo_a[4]; - char gizmo_b[4]; + unsigned char gizmo_hi[4]; + unsigned char gizmo_primary[4]; + unsigned char gizmo_secondary[4]; + unsigned char gizmo_a[4]; + unsigned char gizmo_b[4]; /* Icon Colors. */ /** Scene items. */ - char icon_scene[4]; + unsigned char icon_scene[4]; /** Collection items. */ - char icon_collection[4]; + unsigned char icon_collection[4]; /** Object items. */ - char icon_object[4]; + unsigned char icon_object[4]; /** Object data items. */ - char icon_object_data[4]; + unsigned char icon_object_data[4]; /** Modifier and constraint items. */ - char icon_modifier[4]; + unsigned char icon_modifier[4]; /** Shading related items. */ - char icon_shading[4]; + unsigned char icon_shading[4]; /** Intensity of the border icons. >0 will render an border around themed * icons. */ float icon_border_intensity; @@ -206,216 +206,218 @@ typedef struct ThemeUI { */ typedef struct ThemeSpace { /* main window colors */ - char back[4]; - char back_grad[4]; + unsigned char back[4]; + unsigned char back_grad[4]; char show_back_grad; char _pad0[3]; /** Panel title. */ - char title[4]; - char text[4]; - char text_hi[4]; + unsigned char title[4]; + unsigned char text[4]; + unsigned char text_hi[4]; /* header colors */ /** Region background. */ - char header[4]; + unsigned char header[4]; /** Unused. */ - char header_title[4]; - char header_text[4]; - char header_text_hi[4]; + unsigned char header_title[4]; + unsigned char header_text[4]; + unsigned char header_text_hi[4]; /* region tabs */ - char tab_active[4]; - char tab_inactive[4]; - char tab_back[4]; - char tab_outline[4]; + unsigned char tab_active[4]; + unsigned char tab_inactive[4]; + unsigned char tab_back[4]; + unsigned char tab_outline[4]; /* button/tool regions */ /** Region background. */ - char button[4]; + unsigned char button[4]; /** Panel title. */ - char button_title[4]; - char button_text[4]; - char button_text_hi[4]; + unsigned char button_title[4]; + unsigned char button_text[4]; + unsigned char button_text_hi[4]; /* listview regions */ /** Region background. */ - char list[4]; + unsigned char list[4]; /** Panel title. */ - char list_title[4]; - char list_text[4]; - char list_text_hi[4]; + unsigned char list_title[4]; + unsigned char list_text[4]; + unsigned char list_text_hi[4]; /* navigation bar regions */ /** Region background. */ - char navigation_bar[4]; + unsigned char navigation_bar[4]; /** Region background. */ - char execution_buts[4]; + unsigned char execution_buts[4]; /* note, cannot use name 'panel' because of DNA mapping old files */ uiPanelColors panelcolors; - char shade1[4]; - char shade2[4]; + unsigned char shade1[4]; + unsigned char shade2[4]; - char hilite[4]; - char grid[4]; + unsigned char hilite[4]; + unsigned char grid[4]; - char view_overlay[4]; + unsigned char view_overlay[4]; - char wire[4], wire_edit[4], select[4]; - char lamp[4], speaker[4], empty[4], camera[4]; - char active[4], group[4], group_active[4], transform[4]; - char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4]; - char edge[4], edge_select[4]; - char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4]; + unsigned char wire[4], wire_edit[4], select[4]; + unsigned char lamp[4], speaker[4], empty[4], camera[4]; + unsigned char active[4], group[4], group_active[4], transform[4]; + unsigned char vertex[4], vertex_select[4], vertex_bevel[4], vertex_unreferenced[4]; + unsigned char edge[4], edge_select[4]; + unsigned char edge_seam[4], edge_sharp[4], edge_facesel[4], edge_crease[4], edge_bevel[4]; /** Solid faces. */ - char face[4], face_select[4]; + unsigned char face[4], face_select[4]; /** selected color. */ - char face_dot[4]; - char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4]; - char normal[4]; - char vertex_normal[4]; - char loop_normal[4]; - char bone_solid[4], bone_pose[4], bone_pose_active[4]; - char strip[4], strip_select[4]; - char cframe[4]; - char time_keyframe[4], time_gp_keyframe[4]; - char freestyle_edge_mark[4], freestyle_face_mark[4]; - char time_scrub_background[4]; + unsigned char face_dot[4]; + unsigned char extra_edge_len[4], extra_edge_angle[4], extra_face_angle[4], extra_face_area[4]; + unsigned char normal[4]; + unsigned char vertex_normal[4]; + unsigned char loop_normal[4]; + unsigned char bone_solid[4], bone_pose[4], bone_pose_active[4]; + unsigned char strip[4], strip_select[4]; + unsigned char cframe[4]; + unsigned char time_keyframe[4], time_gp_keyframe[4]; + unsigned char freestyle_edge_mark[4], freestyle_face_mark[4]; + unsigned char time_scrub_background[4]; char _pad5[4]; - char nurb_uline[4], nurb_vline[4]; - char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4]; + unsigned char nurb_uline[4], nurb_vline[4]; + unsigned char act_spline[4], nurb_sel_uline[4], nurb_sel_vline[4], lastsel_point[4]; - char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4], handle_auto_clamped[4]; - char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], + unsigned char handle_free[4], handle_auto[4], handle_vect[4], handle_align[4], + handle_auto_clamped[4]; + unsigned char handle_sel_free[4], handle_sel_auto[4], handle_sel_vect[4], handle_sel_align[4], handle_sel_auto_clamped[4]; /** Dopesheet. */ - char ds_channel[4], ds_subchannel[4], ds_ipoline[4]; + unsigned char ds_channel[4], ds_subchannel[4], ds_ipoline[4]; /** Keytypes. */ - char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4], + unsigned char keytype_keyframe[4], keytype_extreme[4], keytype_breakdown[4], keytype_jitter[4], keytype_movehold[4]; /** Keytypes. */ - char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], + unsigned char keytype_keyframe_select[4], keytype_extreme_select[4], keytype_breakdown_select[4], keytype_jitter_select[4], keytype_movehold_select[4]; - char keyborder[4], keyborder_select[4]; + unsigned char keyborder[4], keyborder_select[4]; char _pad4[3]; - char console_output[4], console_input[4], console_info[4], console_error[4]; - char console_cursor[4], console_select[4]; + unsigned char console_output[4], console_input[4], console_info[4], console_error[4]; + unsigned char console_cursor[4], console_select[4]; - char vertex_size, outline_width, obcenter_dia, facedot_size; - char noodle_curving; + unsigned char vertex_size, outline_width, obcenter_dia, facedot_size; + unsigned char noodle_curving; /* syntax for textwindow and nodes */ - char syntaxl[4], syntaxs[4]; // in nodespace used for backdrop matte - char syntaxb[4], syntaxn[4]; // in nodespace used for color input - char syntaxv[4], syntaxc[4]; // in nodespace used for converter group - char syntaxd[4], syntaxr[4]; // in nodespace used for distort + unsigned char syntaxl[4], syntaxs[4]; // in nodespace used for backdrop matte + unsigned char syntaxb[4], syntaxn[4]; // in nodespace used for color input + unsigned char syntaxv[4], syntaxc[4]; // in nodespace used for converter group + unsigned char syntaxd[4], syntaxr[4]; // in nodespace used for distort - char nodeclass_output[4], nodeclass_filter[4]; - char nodeclass_vector[4], nodeclass_texture[4]; - char nodeclass_shader[4], nodeclass_script[4]; - char nodeclass_pattern[4], nodeclass_layout[4]; + unsigned char nodeclass_output[4], nodeclass_filter[4]; + unsigned char nodeclass_vector[4], nodeclass_texture[4]; + unsigned char nodeclass_shader[4], nodeclass_script[4]; + unsigned char nodeclass_pattern[4], nodeclass_layout[4]; /** For sequence editor. */ - char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4]; - char effect[4], transition[4], meta[4], text_strip[4]; + unsigned char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4]; + unsigned char effect[4], transition[4], meta[4], text_strip[4]; /** For dopesheet - scale factor for size of keyframes (i.e. height of channels). */ float keyframe_scale_fac; - char editmesh_active[4]; + unsigned char editmesh_active[4]; - char handle_vertex[4]; - char handle_vertex_select[4]; + unsigned char handle_vertex[4]; + unsigned char handle_vertex_select[4]; - char handle_vertex_size; + unsigned char handle_vertex_size; - char clipping_border_3d[4]; + unsigned char clipping_border_3d[4]; - char marker_outline[4], marker[4], act_marker[4], sel_marker[4], dis_marker[4], lock_marker[4]; - char bundle_solid[4]; - char path_before[4], path_after[4]; - char camera_path[4]; - char _pad1[2]; + unsigned char marker_outline[4], marker[4], act_marker[4], sel_marker[4], dis_marker[4], + lock_marker[4]; + unsigned char bundle_solid[4]; + unsigned char path_before[4], path_after[4]; + unsigned char camera_path[4]; + unsigned char _pad1[2]; - char gp_vertex_size; - char gp_vertex[4], gp_vertex_select[4]; + unsigned char gp_vertex_size; + unsigned char gp_vertex[4], gp_vertex_select[4]; - char preview_back[4]; - char preview_stitch_face[4]; - char preview_stitch_edge[4]; - char preview_stitch_vert[4]; - char preview_stitch_stitchable[4]; - char preview_stitch_unstitchable[4]; - char preview_stitch_active[4]; + unsigned char preview_back[4]; + unsigned char preview_stitch_face[4]; + unsigned char preview_stitch_edge[4]; + unsigned char preview_stitch_vert[4]; + unsigned char preview_stitch_stitchable[4]; + unsigned char preview_stitch_unstitchable[4]; + unsigned char preview_stitch_active[4]; /** Two uses, for uvs with modifier applied on mesh and uvs during painting. */ - char uv_shadow[4]; + unsigned char uv_shadow[4]; /** Uvs of other objects. */ - char uv_others[4]; + unsigned char uv_others[4]; /** Outliner - filter match. */ - char match[4]; + unsigned char match[4]; /** Outliner - selected item. */ - char selected_highlight[4]; + unsigned char selected_highlight[4]; /** Outliner - selected object. */ - char selected_object[4]; + unsigned char selected_object[4]; /** Outliner - active object. */ - char active_object[4]; + unsigned char active_object[4]; /** Outliner - edited object. */ - char edited_object[4]; + unsigned char edited_object[4]; /** Outliner - row color difference. */ - char row_alternate[4]; + unsigned char row_alternate[4]; /** Skin modifier root color. */ - char skin_root[4]; + unsigned char skin_root[4]; /* NLA */ /** Active Action + Summary Channel. */ - char anim_active[4]; + unsigned char anim_active[4]; /** Active Action = NULL. */ - char anim_non_active[4]; + unsigned char anim_non_active[4]; /** Preview range overlay. */ - char anim_preview_range[4]; + unsigned char anim_preview_range[4]; /** NLA 'Tweaking' action/strip. */ - char nla_tweaking[4]; + unsigned char nla_tweaking[4]; /** NLA - warning color for duplicate instances of tweaking strip. */ - char nla_tweakdupli[4]; + unsigned char nla_tweakdupli[4]; /** NLA "Transition" strips. */ - char nla_transition[4], nla_transition_sel[4]; + unsigned char nla_transition[4], nla_transition_sel[4]; /** NLA "Meta" strips. */ - char nla_meta[4], nla_meta_sel[4]; + unsigned char nla_meta[4], nla_meta_sel[4]; /** NLA "Sound" strips. */ - char nla_sound[4], nla_sound_sel[4]; + unsigned char nla_sound[4], nla_sound_sel[4]; /* info */ - char info_selected[4], info_selected_text[4]; - char info_error[4], info_error_text[4]; - char info_warning[4], info_warning_text[4]; - char info_info[4], info_info_text[4]; - char info_debug[4], info_debug_text[4]; + unsigned char info_selected[4], info_selected_text[4]; + unsigned char info_error[4], info_error_text[4]; + unsigned char info_warning[4], info_warning_text[4]; + unsigned char info_info[4], info_info_text[4]; + unsigned char info_debug[4], info_debug_text[4]; - char paint_curve_pivot[4]; - char paint_curve_handle[4]; + unsigned char paint_curve_pivot[4]; + unsigned char paint_curve_handle[4]; - char metadatabg[4]; - char metadatatext[4]; + unsigned char metadatabg[4]; + unsigned char metadatatext[4]; char _pad2[4]; } ThemeSpace; /* set of colors for use as a custom color set for Objects/Bones wire drawing */ typedef struct ThemeWireColor { - char solid[4]; - char select[4]; - char active[4]; + unsigned char solid[4]; + unsigned char select[4]; + unsigned char active[4]; /** #eWireColor_Flags. */ short flag; diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 6b3bd1ea24e..ba6a0c4ebe1 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -403,7 +403,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) /* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */ GPU_blend(true); for (drag = wm->drags.first; drag; drag = drag->next) { - const char text_col[] = {255, 255, 255, 255}; + const uchar text_col[] = {255, 255, 255, 255}; int iconsize = UI_DPI_ICON_SIZE; int padding = 4 * UI_DPI_FAC; @@ -461,7 +461,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) drag_rect_minmax(rect, x, y, x + w, y + iconsize); } else { - UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), (uchar *)text_col); + UI_fontstyle_draw_simple(fstyle, x, y, wm_drag_name(drag), text_col); } /* operator name with roundbox */ |