diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index 5488ab82f15..fc62b4b9141 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -415,10 +415,7 @@ void BKE_camera_params_compute_viewplane( /* the window matrix is used for clipping, and not changed during OSA steps */ /* using an offset of +0.5 here would give clip errors on edges */ - viewplane.xmin *= pixsize; - viewplane.xmax *= pixsize; - viewplane.ymin *= pixsize; - viewplane.ymax *= pixsize; + BLI_rctf_mul(&viewplane, pixsize); /* Used for rendering (offset by near-clip with perspective views), passed to RE_SetPixelSize. * For viewport drawing 'RegionView3D.pixsize'. */ diff --git a/source/blender/blenkernel/intern/vfont.c b/source/blender/blenkernel/intern/vfont.c index 35cace72fea..8c98564eade 100644 --- a/source/blender/blenkernel/intern/vfont.c +++ b/source/blender/blenkernel/intern/vfont.c @@ -21,6 +21,7 @@ #include "BLI_math.h" #include "BLI_math_base_safe.h" #include "BLI_path_util.h" +#include "BLI_rect.h" #include "BLI_string.h" #include "BLI_string_utf8.h" #include "BLI_threads.h" @@ -1398,10 +1399,7 @@ static bool vfont_to_curve(Object *ob, char_idx_offset += line->char_nr + 1; } /* Move the bounds into a space compatible with `cursor_location`. */ - bounds->xmin *= font_size; - bounds->xmax *= font_size; - bounds->ymin *= font_size; - bounds->ymax *= font_size; + BLI_rctf_mul(bounds, font_size); char_beg_next = tb_bounds->char_index_last + 1; } diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index 8c3df200bd8..0cccdcc7905 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -70,6 +70,8 @@ void BLI_rctf_transform_calc_m4_pivot_min(const rctf *dst, const rctf *src, floa void BLI_rctf_translate(struct rctf *rect, float x, float y); void BLI_rcti_translate(struct rcti *rect, int x, int y); +void BLI_rctf_mul(struct rctf *rect, float factor); +void BLI_rcti_mul(struct rcti *rect, int factor); void BLI_rcti_recenter(struct rcti *rect, int x, int y); void BLI_rctf_recenter(struct rctf *rect, float x, float y); void BLI_rcti_resize(struct rcti *rect, int x, int y); diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c index aef289a5718..8611b2c82ce 100644 --- a/source/blender/blenlib/intern/rct.c +++ b/source/blender/blenlib/intern/rct.c @@ -572,6 +572,21 @@ void BLI_rctf_translate(rctf *rect, float x, float y) rect->ymax += y; } +void BLI_rcti_mul(rcti *rect, const int factor) +{ + rect->xmin *= factor; + rect->ymin *= factor; + rect->xmax *= factor; + rect->ymax *= factor; +} +void BLI_rctf_mul(rctf *rect, const float factor) +{ + rect->xmin *= factor; + rect->ymin *= factor; + rect->xmax *= factor; + rect->ymax *= factor; +} + void BLI_rcti_recenter(rcti *rect, int x, int y) { const int dx = x - BLI_rcti_cent_x(rect);