Cleanup: use const, correct arg names, spelling, use ELEMN(..)
This commit is contained in:
@@ -412,7 +412,7 @@ BLI_INLINE ft_pix blf_kerning(FontBLF *font, const GlyphBLF *g_prev, const Glyph
|
||||
|
||||
BLI_INLINE GlyphBLF *blf_glyph_from_utf8_and_step(FontBLF *font,
|
||||
GlyphCacheBLF *gc,
|
||||
GlyphBLF *g_prev,
|
||||
const GlyphBLF *g_prev,
|
||||
const char *str,
|
||||
size_t str_len,
|
||||
size_t *i_p,
|
||||
@@ -782,7 +782,7 @@ void blf_font_draw_buffer(FontBLF *font, const char *str, const size_t str_len,
|
||||
|
||||
static bool blf_font_width_to_strlen_glyph_process(FontBLF *font,
|
||||
GlyphCacheBLF *gc,
|
||||
GlyphBLF *g_prev,
|
||||
const GlyphBLF *g_prev,
|
||||
GlyphBLF *g,
|
||||
ft_pix *pen_x,
|
||||
const int width_i)
|
||||
@@ -817,7 +817,8 @@ static bool blf_font_width_to_strlen_glyph_process(FontBLF *font,
|
||||
size_t blf_font_width_to_strlen(
|
||||
FontBLF *font, const char *str, const size_t str_len, int width, int *r_width)
|
||||
{
|
||||
GlyphBLF *g, *g_prev;
|
||||
GlyphBLF *g;
|
||||
const GlyphBLF *g_prev;
|
||||
ft_pix pen_x;
|
||||
ft_pix width_new;
|
||||
size_t i, i_prev;
|
||||
@@ -897,7 +898,7 @@ static void blf_font_boundbox_ex(FontBLF *font,
|
||||
ResultBLF *r_info,
|
||||
ft_pix pen_y)
|
||||
{
|
||||
GlyphBLF *g = nullptr;
|
||||
const GlyphBLF *g = nullptr;
|
||||
ft_pix pen_x = 0;
|
||||
size_t i = 0;
|
||||
|
||||
@@ -1051,7 +1052,7 @@ void blf_font_boundbox_foreach_glyph(FontBLF *font,
|
||||
return;
|
||||
}
|
||||
|
||||
GlyphBLF *g = nullptr;
|
||||
const GlyphBLF *g = nullptr;
|
||||
ft_pix pen_x = 0;
|
||||
size_t i = 0;
|
||||
|
||||
@@ -1248,7 +1249,7 @@ static void blf_font_wrap_apply(FontBLF *font,
|
||||
void *userdata)
|
||||
{
|
||||
GlyphBLF *g = nullptr;
|
||||
GlyphBLF *g_prev = nullptr;
|
||||
const GlyphBLF *g_prev = nullptr;
|
||||
ft_pix pen_x = 0;
|
||||
ft_pix pen_y = 0;
|
||||
size_t i = 0;
|
||||
|
||||
@@ -83,7 +83,7 @@ static float from_16dot16(FT_Fixed value)
|
||||
/** \name Glyph Cache
|
||||
* \{ */
|
||||
|
||||
static GlyphCacheBLF *blf_glyph_cache_find(FontBLF *font)
|
||||
static GlyphCacheBLF *blf_glyph_cache_find(const FontBLF *font)
|
||||
{
|
||||
for (const std::unique_ptr<GlyphCacheBLF> &gc : font->cache) {
|
||||
if (gc->size == font->size && (gc->bold == ((font->flags & BLF_BOLD) != 0)) &&
|
||||
@@ -1044,7 +1044,7 @@ static const FT_Var_Axis *blf_var_axis_by_tag(const FT_MM_Var *variations,
|
||||
* \param value: New float value. Converted to 16.16 and clamped within allowed range.
|
||||
* \return success if able to set this value.
|
||||
*/
|
||||
static bool blf_glyph_set_variation_float(FontBLF *font,
|
||||
static bool blf_glyph_set_variation_float(const FontBLF *font,
|
||||
FT_Fixed coords[],
|
||||
uint32_t tag,
|
||||
float *value)
|
||||
@@ -1068,7 +1068,7 @@ static bool blf_glyph_set_variation_float(FontBLF *font,
|
||||
* \param weight: Weight class value (1-1000 allowed, 100-900 typical).
|
||||
* \return value set (could be clamped), or current weight if the axis does not exist.
|
||||
*/
|
||||
static float blf_glyph_set_variation_weight(FontBLF *font,
|
||||
static float blf_glyph_set_variation_weight(const FontBLF *font,
|
||||
FT_Fixed coords[],
|
||||
float current_weight,
|
||||
float target_weight)
|
||||
@@ -1087,7 +1087,7 @@ static float blf_glyph_set_variation_weight(FontBLF *font,
|
||||
* \param degrees: Slant in clockwise (opposite to spec) degrees.
|
||||
* \return value set (could be clamped), or current slant if the axis does not exist.
|
||||
*/
|
||||
static float blf_glyph_set_variation_slant(FontBLF *font,
|
||||
static float blf_glyph_set_variation_slant(const FontBLF *font,
|
||||
FT_Fixed coords[],
|
||||
float current_degrees,
|
||||
float target_degrees)
|
||||
@@ -1106,7 +1106,7 @@ static float blf_glyph_set_variation_slant(FontBLF *font,
|
||||
* \param width: Glyph width value. 1.0 is normal, as per spec (which uses percent).
|
||||
* \return value set (could be clamped), or current width if the axis does not exist.
|
||||
*/
|
||||
static float blf_glyph_set_variation_width(FontBLF *font,
|
||||
static float blf_glyph_set_variation_width(const FontBLF *font,
|
||||
FT_Fixed coords[],
|
||||
float current_width,
|
||||
float target_width)
|
||||
@@ -1125,7 +1125,7 @@ static float blf_glyph_set_variation_width(FontBLF *font,
|
||||
* \param spacing: Glyph spacing value. 0.0 is normal, as per spec.
|
||||
* \return value set (could be clamped), or current spacing if the axis does not exist.
|
||||
*/
|
||||
static float blf_glyph_set_variation_spacing(FontBLF *font,
|
||||
static float blf_glyph_set_variation_spacing(const FontBLF *font,
|
||||
FT_Fixed coords[],
|
||||
float current_spacing,
|
||||
float target_spacing)
|
||||
@@ -1144,7 +1144,7 @@ static float blf_glyph_set_variation_spacing(FontBLF *font,
|
||||
* \param points: Non-zero size in typographic points.
|
||||
* \return success if able to set this value.
|
||||
*/
|
||||
static bool blf_glyph_set_variation_optical_size(FontBLF *font,
|
||||
static bool blf_glyph_set_variation_optical_size(const FontBLF *font,
|
||||
FT_Fixed coords[],
|
||||
const float points)
|
||||
{
|
||||
@@ -1445,7 +1445,7 @@ GlyphBLF::~GlyphBLF()
|
||||
/** \name Glyph Bounds Calculation
|
||||
* \{ */
|
||||
|
||||
static void blf_glyph_calc_rect(GlyphBLF *g, const int x, const int y, rcti *r_rect)
|
||||
static void blf_glyph_calc_rect(const GlyphBLF *g, const int x, const int y, rcti *r_rect)
|
||||
{
|
||||
r_rect->xmin = x + g->pos[0];
|
||||
r_rect->xmax = r_rect->xmin + g->dims[0];
|
||||
@@ -1453,7 +1453,7 @@ static void blf_glyph_calc_rect(GlyphBLF *g, const int x, const int y, rcti *r_r
|
||||
r_rect->ymax = r_rect->ymin - g->dims[1];
|
||||
}
|
||||
|
||||
static void blf_glyph_calc_rect_test(GlyphBLF *g, const int x, const int y, rcti *r_rect)
|
||||
static void blf_glyph_calc_rect_test(const GlyphBLF *g, const int x, const int y, rcti *r_rect)
|
||||
{
|
||||
/* Intentionally check with `g->advance`, because this is the
|
||||
* width used by BLF_width. This allows that the text slightly
|
||||
@@ -1465,7 +1465,7 @@ static void blf_glyph_calc_rect_test(GlyphBLF *g, const int x, const int y, rcti
|
||||
}
|
||||
|
||||
static void blf_glyph_calc_rect_shadow(
|
||||
GlyphBLF *g, const int x, const int y, FontBLF *font, rcti *r_rect)
|
||||
const GlyphBLF *g, const int x, const int y, const FontBLF *font, rcti *r_rect)
|
||||
{
|
||||
blf_glyph_calc_rect(g, x + font->shadow_x, y + font->shadow_y, r_rect);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ size_t blf_str_offset_from_cursor_position(FontBLF *font,
|
||||
void blf_str_offset_to_glyph_bounds(FontBLF *font,
|
||||
const char *str,
|
||||
size_t str_offset,
|
||||
rcti *glyph_bounds);
|
||||
rcti *r_glyph_bounds);
|
||||
|
||||
blender::Vector<blender::Bounds<int>> blf_str_selection_boxes(
|
||||
FontBLF *font, const char *str, size_t str_len, size_t sel_start, size_t sel_length);
|
||||
|
||||
@@ -524,8 +524,8 @@ static bool bonedropper_poll(bContext *C)
|
||||
return false;
|
||||
}
|
||||
|
||||
StructRNA *type = RNA_property_pointer_type(&search_but->rnasearchpoin,
|
||||
search_but->rnasearchprop);
|
||||
const StructRNA *type = RNA_property_pointer_type(&search_but->rnasearchpoin,
|
||||
search_but->rnasearchprop);
|
||||
|
||||
return type == &RNA_Bone || type == &RNA_EditBone;
|
||||
}
|
||||
|
||||
@@ -1723,8 +1723,8 @@ static bool ui_but_icon_extra_is_visible_bone_eyedropper(uiBut *but)
|
||||
return false;
|
||||
}
|
||||
uiButSearch *search_but = (uiButSearch *)but;
|
||||
StructRNA *type = RNA_property_pointer_type(&search_but->rnasearchpoin,
|
||||
search_but->rnasearchprop);
|
||||
const StructRNA *type = RNA_property_pointer_type(&search_but->rnasearchpoin,
|
||||
search_but->rnasearchprop);
|
||||
return type == &RNA_Bone || type == &RNA_EditBone;
|
||||
}
|
||||
|
||||
|
||||
@@ -429,7 +429,7 @@ static bool ui_tooltip_period_needed(blender::StringRef tip)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Already ends with puncuation. */
|
||||
/* Already ends with punctuation. */
|
||||
if (ELEM(tip.back(), '.', '!', '?')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ static void test_constraint(
|
||||
}
|
||||
else {
|
||||
if (animrig::legacy::action_treat_as_legacy(*data->act)) {
|
||||
if (data->act->idroot != ID_OB && data->act->idroot != 0) {
|
||||
if (!ELEM(data->act->idroot, ID_OB, 0)) {
|
||||
/* Only object-rooted actions can be used. */
|
||||
data->act = nullptr;
|
||||
con->flag |= CONSTRAINT_DISABLE;
|
||||
|
||||
@@ -254,7 +254,7 @@ GPU_INLINE void *GPU_vertbuf_raw_step(GPUVertBufRaw *a)
|
||||
return (void *)data;
|
||||
}
|
||||
|
||||
GPU_INLINE uint GPU_vertbuf_raw_used(GPUVertBufRaw *a)
|
||||
GPU_INLINE uint GPU_vertbuf_raw_used(const GPUVertBufRaw *a)
|
||||
{
|
||||
return ((a->data - a->data_init) / a->stride);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ VKBuffer &VKImmediate::ensure_space(size_t bytes_needed)
|
||||
}
|
||||
|
||||
size_t alloc_size = new_buffer_size(bytes_needed);
|
||||
CLOG_INFO(&LOG, 2, "Allocate buffer (size=%d)", (int)alloc_size);
|
||||
CLOG_INFO(&LOG, 2, "Allocate buffer (size=%d)", int(alloc_size));
|
||||
buffer_offset_ = 0;
|
||||
active_buffers_.append(std::make_unique<VKBuffer>());
|
||||
VKBuffer &result = *active_buffers_.last();
|
||||
@@ -122,7 +122,7 @@ VKBuffer &VKImmediate::ensure_space(size_t bytes_needed)
|
||||
void VKImmediate::reset()
|
||||
{
|
||||
if (!recycling_buffers_.is_empty()) {
|
||||
CLOG_INFO(&LOG, 2, "Discarding %d unused buffers", (int)recycling_buffers_.size());
|
||||
CLOG_INFO(&LOG, 2, "Discarding %d unused buffers", int(recycling_buffers_.size()));
|
||||
recycling_buffers_.clear();
|
||||
}
|
||||
while (!active_buffers_.is_empty()) {
|
||||
|
||||
@@ -357,7 +357,7 @@ class Custom : public SocketDeclaration {
|
||||
|
||||
class CustomTypeBuilder : public SocketDeclarationBuilder<Custom> {
|
||||
public:
|
||||
CustomTypeBuilder &idname(const char *name);
|
||||
CustomTypeBuilder &idname(const char *idname);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user