Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-25 11:30:50 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 11:31:10 +0300
commitc7b247a118e302a3afc6473797e53b6af28b69e2 (patch)
treed11149a165bfd8f3b3b791f24547499f041b133b /source/blender/editors/interface
parent891949cbb47143420f4324cb60efc05ef5d70b39 (diff)
Cleanup: replace static_casts with functional casts for numeric types
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_context_path.cc2
-rw-r--r--source/blender/editors/interface/interface_region_tooltip.cc24
2 files changed, 12 insertions, 14 deletions
diff --git a/source/blender/editors/interface/interface_context_path.cc b/source/blender/editors/interface/interface_context_path.cc
index 3b91ca79c00..e8f552e26a3 100644
--- a/source/blender/editors/interface/interface_context_path.cc
+++ b/source/blender/editors/interface/interface_context_path.cc
@@ -41,7 +41,7 @@ void context_path_add_generic(Vector<ContextPathItem> &path,
static_cast<BIFIconID>(RNA_struct_ui_icon(rna_ptr.type)) :
icon_override;
- path.append({name, static_cast<int>(icon)});
+ path.append({name, int(icon)});
}
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc
index 2c4d13e0717..b1621f1a040 100644
--- a/source/blender/editors/interface/interface_region_tooltip.cc
+++ b/source/blender/editors/interface/interface_region_tooltip.cc
@@ -109,8 +109,7 @@ struct uiTooltipData {
#define UI_TIP_LC_MAX 6
-BLI_STATIC_ASSERT(UI_TIP_LC_MAX == static_cast<int>(uiTooltipFormat::ColorID::Alert) + 1,
- "invalid lc-max");
+BLI_STATIC_ASSERT(UI_TIP_LC_MAX == int(uiTooltipFormat::ColorID::Alert) + 1, "invalid lc-max");
BLI_STATIC_ASSERT(sizeof(uiTooltipFormat) <= sizeof(int), "oversize");
static uiTooltipField *text_field_add_only(uiTooltipData *data)
@@ -168,12 +167,12 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
uchar drawcol[4] = {0, 0, 0, 255}; /* to store color in while drawing (alpha is always 255) */
/* The color from the theme. */
- float *main_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Main)];
- float *value_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Value)];
- float *active_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Active)];
- float *normal_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Normal)];
- float *python_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Python)];
- float *alert_color = tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Alert)];
+ float *main_color = tip_colors[int(uiTooltipFormat::ColorID::Main)];
+ float *value_color = tip_colors[int(uiTooltipFormat::ColorID::Value)];
+ float *active_color = tip_colors[int(uiTooltipFormat::ColorID::Active)];
+ float *normal_color = tip_colors[int(uiTooltipFormat::ColorID::Normal)];
+ float *python_color = tip_colors[int(uiTooltipFormat::ColorID::Python)];
+ float *alert_color = tip_colors[int(uiTooltipFormat::ColorID::Alert)];
float background_color[3];
@@ -224,7 +223,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
fs_params.word_wrap = true;
/* Draw header and active data (is done here to be able to change color). */
- rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Main)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(uiTooltipFormat::ColorID::Main)]);
UI_fontstyle_set(&data->fstyle);
UI_fontstyle_draw(&data->fstyle, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params);
@@ -235,8 +234,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
bbox.xmin += xofs;
bbox.ymax -= yofs;
- rgb_float_to_uchar(drawcol,
- tip_colors[static_cast<int>(uiTooltipFormat::ColorID::Active)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(uiTooltipFormat::ColorID::Active)]);
UI_fontstyle_draw(
&data->fstyle, &bbox, field->text_suffix, UI_TIP_STR_MAX, drawcol, &fs_params);
@@ -255,7 +253,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
UI_fontstyle_set(&fstyle_mono);
/* XXX: needed because we don't have mono in 'U.uifonts'. */
BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.dpi_fac);
- rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(field->format.color_id)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(field->format.color_id)]);
UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params);
}
else {
@@ -265,7 +263,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region
fs_params.word_wrap = true;
/* Draw remaining data. */
- rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(field->format.color_id)]);
+ rgb_float_to_uchar(drawcol, tip_colors[int(field->format.color_id)]);
UI_fontstyle_set(&data->fstyle);
UI_fontstyle_draw(&data->fstyle, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params);
}