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:
authorJulian Eisel <eiseljulian@gmail.com>2020-01-14 21:04:27 +0300
committerJulian Eisel <eiseljulian@gmail.com>2020-01-14 21:08:51 +0300
commitc167e8ba18d5457135dce8d654fa8eda30c20786 (patch)
tree3ddedd0134ba47ecd1b3f58f9f2f440294b24196 /source/blender/blenlib
parente4bf08a363d98bf2bd3012349b314570e6e86dba (diff)
Cleanup: Use new BLI_rct utilities to ensure valid rectangles
Technically this does a slight change to the check in wm_window.c: The assert now also allows zero width/height rectangles.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/intern/rct.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 5fb33072231..8fab4ed8e6a 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -439,42 +439,22 @@ void BLI_rcti_union(rcti *rct1, const rcti *rct2)
void BLI_rctf_init(rctf *rect, float xmin, float xmax, float ymin, float ymax)
{
- if (xmin <= xmax) {
- rect->xmin = xmin;
- rect->xmax = xmax;
- }
- else {
- rect->xmax = xmin;
- rect->xmin = xmax;
- }
- if (ymin <= ymax) {
- rect->ymin = ymin;
- rect->ymax = ymax;
- }
- else {
- rect->ymax = ymin;
- rect->ymin = ymax;
- }
+ rect->xmin = xmin;
+ rect->xmax = xmax;
+ rect->ymin = ymin;
+ rect->ymax = ymax;
+
+ BLI_rctf_sanitize(rect);
}
void BLI_rcti_init(rcti *rect, int xmin, int xmax, int ymin, int ymax)
{
- if (xmin <= xmax) {
- rect->xmin = xmin;
- rect->xmax = xmax;
- }
- else {
- rect->xmax = xmin;
- rect->xmin = xmax;
- }
- if (ymin <= ymax) {
- rect->ymin = ymin;
- rect->ymax = ymax;
- }
- else {
- rect->ymax = ymin;
- rect->ymin = ymax;
- }
+ rect->xmin = xmin;
+ rect->xmax = xmax;
+ rect->ymin = ymin;
+ rect->ymax = ymax;
+
+ BLI_rcti_sanitize(rect);
}
/**