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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenfont/BLF_api.h4
-rw-r--r--source/blender/blenfont/intern/blf.c11
-rw-r--r--source/blender/blenkernel/intern/image.c2
-rw-r--r--source/blender/blenkernel/intern/image_gen.c7
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c4
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_style.c6
-rw-r--r--source/blender/python/generic/blf_py_api.c10
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
9 files changed, 27 insertions, 21 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index e565ffe3cc1..1f38d64924c 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -153,7 +153,7 @@ void BLF_disable(int fontid, int option);
* the other argument are the rgba color.
* Take care that shadow need to be enable using BLF_enable!!!
*/
-void BLF_shadow(int fontid, int level, float r, float g, float b, float a);
+void BLF_shadow(int fontid, int level, const float rgba[4]) ATTR_NONNULL(3);
/* Set the offset for shadow text, this is the current cursor
* position plus this offset, don't need call BLF_position before
@@ -174,7 +174,7 @@ void BLF_shadow_offset(int fontid, int x, int y);
void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display);
/* Set the color to be used for text. */
-void BLF_buffer_col(int fontid, float r, float g, float b, float a);
+void BLF_buffer_col(int fontid, const float rgba[4]) ATTR_NONNULL(2);
/* Draw the string into the buffer, this function draw in both buffer, float and unsigned char _BUT_
* it's not necessary set both buffer, NULL is valid here.
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 977fa771014..132a0ec3808 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -849,16 +849,13 @@ void BLF_wordwrap(int fontid, int wrap_width)
}
}
-void BLF_shadow(int fontid, int level, float r, float g, float b, float a)
+void BLF_shadow(int fontid, int level, const float rgba[4])
{
FontBLF *font = blf_get(fontid);
if (font) {
font->shadow = level;
- font->shadow_col[0] = r;
- font->shadow_col[1] = g;
- font->shadow_col[2] = b;
- font->shadow_col[3] = a;
+ copy_v4_v4(font->shadow_col, rgba);
}
}
@@ -886,12 +883,12 @@ void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int
}
}
-void BLF_buffer_col(int fontid, float r, float g, float b, float a)
+void BLF_buffer_col(int fontid, const float rgba[4])
{
FontBLF *font = blf_get(fontid);
if (font) {
- ARRAY_SET_ITEMS(font->buf_info.col_init, r, g, b, a);
+ copy_v4_v4(font->buf_info.col_init, rgba);
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index cdb3d1afc29..340b406722f 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1992,7 +1992,7 @@ void BKE_image_stamp_buf(
BLF_wordwrap(mono, width - (BUFF_MARGIN_X * 2));
BLF_buffer(mono, rectf, rect, width, height, channels, display);
- BLF_buffer_col(mono, UNPACK4(scene->r.fg_stamp));
+ BLF_buffer_col(mono, scene->r.fg_stamp);
pad = BLF_width_max(mono);
/* use 'h_fixed' rather than 'h', aligns better */
diff --git a/source/blender/blenkernel/intern/image_gen.c b/source/blender/blenkernel/intern/image_gen.c
index 303d0c6adfc..10e7d46b315 100644
--- a/source/blender/blenkernel/intern/image_gen.c
+++ b/source/blender/blenkernel/intern/image_gen.c
@@ -297,6 +297,9 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
*/
BLF_buffer(mono, rect_float, rect, width, height, 4, NULL);
+ const float text_color[4] = {0.0, 0.0, 0.0, 1.0};
+ const float text_outline[4] = {1.0, 1.0, 1.0, 1.0};
+
for (y = 0; y < height; y += step) {
text[1] = '1';
@@ -306,7 +309,7 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
pen_y = y + 44;
/* terribly crappy outline font! */
- BLF_buffer_col(mono, 1.0, 1.0, 1.0, 1.0);
+ BLF_buffer_col(mono, text_outline);
BLF_position(mono, pen_x - outline, pen_y, 0.0);
BLF_draw_buffer(mono, text, 2);
@@ -326,7 +329,7 @@ static void checker_board_text(unsigned char *rect, float *rect_float, int width
BLF_position(mono, pen_x + outline, pen_y - outline, 0.0);
BLF_draw_buffer(mono, text, 2);
- BLF_buffer_col(mono, 0.0, 0.0, 0.0, 1.0);
+ BLF_buffer_col(mono, text_color);
BLF_position(mono, pen_x, pen_y, 0.0);
BLF_draw_buffer(mono, text, 2);
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 1b807adca4b..dfce931cbf4 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -3188,11 +3188,11 @@ static ImBuf *do_text_effect(const SeqRenderData *context, Sequence *seq, float
fontx = BLF_width_max(mono);
fonty = line_height;
BLF_position(mono, x + max_ii(fontx / 25, 1), y + max_ii(fonty / 25, 1), 0.0f);
- BLF_buffer_col(mono, 0.0f, 0.0f, 0.0f, 1.0f);
+ BLF_buffer_col(mono, (const float[4]){0.0f, 0.0f, 0.0f, 1.0f});
BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX);
}
BLF_position(mono, x, y, 0.0f);
- BLF_buffer_col(mono, 1.0f, 1.0f, 1.0f, 1.0f);
+ BLF_buffer_col(mono, (const float[4]){1.0f, 1.0f, 1.0f, 1.0f});
BLF_draw_buffer(mono, data->text, BLF_DRAW_STR_DUMMY_MAX);
BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 2fdd84b626b..62b373c58c8 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1679,7 +1679,7 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active)
BLF_size(fontid, fstyle_points, U.dpi);
BLF_enable(fontid, BLF_SHADOW);
- BLF_shadow(fontid, 3, 1.0f, 1.0f, 1.0f, 0.25f);
+ BLF_shadow(fontid, 3, (const float[4]){1.0f, 1.0f, 1.0f, 0.25f});
BLF_shadow_offset(fontid, -1, -1);
BLI_assert(UI_panel_category_is_visible(ar));
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index bfde02dbefd..423c48e5f55 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -160,7 +160,8 @@ void UI_fontstyle_draw_ex(
/* set the flag */
if (fs->shadow) {
font_flag |= BLF_SHADOW;
- BLF_shadow(fs->uifont_id, fs->shadow, fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha);
+ const float shadow_color[4] = {fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha};
+ BLF_shadow(fs->uifont_id, fs->shadow, shadow_color);
BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
}
if (fs->kerning == 1) {
@@ -251,7 +252,8 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const ch
if (fs->shadow) {
BLF_enable(fs->uifont_id, BLF_SHADOW);
- BLF_shadow(fs->uifont_id, fs->shadow, fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha);
+ const float shadow_color[4] = {fs->shadowcolor, fs->shadowcolor, fs->shadowcolor, fs->shadowalpha};
+ BLF_shadow(fs->uifont_id, fs->shadow, shadow_color);
BLF_shadow_offset(fs->uifont_id, fs->shadx, fs->shady);
}
diff --git a/source/blender/python/generic/blf_py_api.c b/source/blender/python/generic/blf_py_api.c
index 0dfff9b4a7b..69f1e297b43 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -332,17 +332,21 @@ PyDoc_STRVAR(py_blf_shadow_doc,
static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
{
int level, fontid;
- float r, g, b, a;
+ float rgba[4];
- if (!PyArg_ParseTuple(args, "iiffff:blf.shadow", &fontid, &level, &r, &g, &b, &a))
+ if (!PyArg_ParseTuple(
+ args, "iiffff:blf.shadow",
+ &fontid, &level, &rgba[0], &rgba[1], &rgba[2], &rgba[3]))
+ {
return NULL;
+ }
if (level != 0 && level != 3 && level != 5) {
PyErr_SetString(PyExc_TypeError, "blf.shadow expected arg to be in (0, 3, 5)");
return NULL;
}
- BLF_shadow(fontid, level, r, g, b, a);
+ BLF_shadow(fontid, level, rgba);
Py_RETURN_NONE;
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 8a15237078a..1d78bb8c072 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -3124,7 +3124,7 @@ static void radial_control_paint_cursor(bContext *C, int x, int y, void *customd
BLF_size(fontid, 1.5 * fstyle_points, 1.0f / U.dpi);
BLF_enable(fontid, BLF_SHADOW);
- BLF_shadow(fontid, 3, 0.0f, 0.0f, 0.0f, 0.5f);
+ BLF_shadow(fontid, 3, (const float[4]){0.0f, 0.0f, 0.0f, 0.5f});
BLF_shadow_offset(fontid, 1, -1);
/* draw value */