[Bf-blender-cvs] [571646ebc17] master: Cleanup: pass font drawing x/y offset arguments as int's

Campbell Barton noreply at git.blender.org
Tue Apr 14 10:52:42 CEST 2020


Commit: 571646ebc175877225c26a3dcf8869691cf70ba7
Author: Campbell Barton
Date:   Tue Apr 14 18:41:23 2020 +1000
Branches: master
https://developer.blender.org/rB571646ebc175877225c26a3dcf8869691cf70ba7

Cleanup: pass font drawing x/y offset arguments as int's

Internally these values are ints.

===================================================================

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_style.c
M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index eb134646649..1133f9e72c4 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -2415,8 +2415,8 @@ void UI_fontstyle_draw_ex(const struct uiFontStyle *fs,
                           const uchar col[4],
                           const struct uiFontStyleDraw_Params *fs_params,
                           size_t len,
-                          float *r_xofs,
-                          float *r_yofs);
+                          int *r_xofs,
+                          int *r_yofs);
 void UI_fontstyle_draw(const struct uiFontStyle *fs,
                        const struct rcti *rect,
                        const char *str,
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 63fc7825b26..a67d4f4ce83 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -147,8 +147,8 @@ void UI_fontstyle_draw_ex(const uiFontStyle *fs,
                           const uchar col[4],
                           const struct uiFontStyleDraw_Params *fs_params,
                           size_t len,
-                          float *r_xofs,
-                          float *r_yofs)
+                          int *r_xofs,
+                          int *r_yofs)
 {
   int xofs = 0, yofs;
   int font_flag = BLF_CLIPPING;
@@ -210,7 +210,7 @@ void UI_fontstyle_draw(const uiFontStyle *fs,
                        const uchar col[4],
                        const struct uiFontStyleDraw_Params *fs_params)
 {
-  float xofs, yofs;
+  int xofs, yofs;
 
   UI_fontstyle_draw_ex(fs, rect, str, col, fs_params, BLF_DRAW_STR_DUMMY_MAX, &xofs, &yofs);
 }
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index fa4a0a1e07d..88bc4c38fd3 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2300,7 +2300,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
 
   if (!use_right_only) {
     /* for underline drawing */
-    float font_xofs, font_yofs;
+    int font_xofs, font_yofs;
 
     int drawlen = (drawstr_left_len == INT_MAX) ? strlen(drawstr + but->ofs) :
                                                   (drawstr_left_len - but->ofs);
@@ -2342,7 +2342,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
           ul_advance = BLF_width(fstyle->uifont_id, fixedbuf, ul_index) + (1.0f * UI_DPI_FAC);
 
           BLF_position(fstyle->uifont_id,
-                       rect->xmin + font_xofs + ul_advance,
+                       rect->xmin + font_xofs + (int)ul_advance,
                        rect->ymin + font_yofs,
                        0.0f);
           BLF_color4ubv(fstyle->uifont_id, wcol->text);



More information about the Bf-blender-cvs mailing list