stule cleanup for rct.c and fix for error in last commit.

This commit is contained in:
Campbell Barton 2012-03-13 01:55:25 +00:00
parent 8646bb4464
commit a97825dfd7
2 changed files with 66 additions and 76 deletions

View File

@ -1,12 +1,4 @@
/* /*
*
* rct.c
*
* april 95
*
*
* A minimalist lib for functions doing stuff with rectangle structs.
*
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -36,6 +28,8 @@
/** \file blender/blenlib/intern/rct.c /** \file blender/blenlib/intern/rct.c
* \ingroup bli * \ingroup bli
*
* A minimalist lib for functions doing stuff with rectangle structs.
*/ */
#include <stdio.h> #include <stdio.h>
@ -46,19 +40,16 @@
int BLI_rcti_is_empty(rcti * rect) int BLI_rcti_is_empty(rcti * rect)
{ {
return ((rect->xmax<=rect->xmin) || return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
(rect->ymax<=rect->ymin));
} }
int BLI_rctf_is_empty(rctf * rect) int BLI_rctf_is_empty(rctf * rect)
{ {
return ((rect->xmax<=rect->xmin) || return ((rect->xmax <= rect->xmin) || (rect->ymax <= rect->ymin));
(rect->ymax<=rect->ymin));
} }
int BLI_in_rcti(rcti * rect, int x, int y) int BLI_in_rcti(rcti * rect, int x, int y)
{ {
if (x < rect->xmin) return 0; if (x < rect->xmin) return 0;
if (x > rect->xmax) return 0; if (x > rect->xmax) return 0;
if (y < rect->ymin) return 0; if (y < rect->ymin) return 0;
@ -68,7 +59,6 @@ int BLI_in_rcti(rcti * rect, int x, int y)
int BLI_in_rctf(rctf *rect, float x, float y) int BLI_in_rctf(rctf *rect, float x, float y)
{ {
if (x < rect->xmin) return 0; if (x < rect->xmin) return 0;
if (x > rect->xmax) return 0; if (x > rect->xmax) return 0;
if (y < rect->ymin) return 0; if (y < rect->ymin) return 0;
@ -78,7 +68,6 @@ int BLI_in_rctf(rctf *rect, float x, float y)
void BLI_union_rctf(rctf *rct1, rctf *rct2) void BLI_union_rctf(rctf *rct1, rctf *rct2)
{ {
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin; if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax; if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin; if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin;
@ -87,7 +76,6 @@ void BLI_union_rctf(rctf *rct1, rctf *rct2)
void BLI_union_rcti(rcti *rct1, rcti *rct2) void BLI_union_rcti(rcti *rct1, rcti *rct2)
{ {
if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin; if (rct1->xmin > rct2->xmin) rct1->xmin = rct2->xmin;
if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax; if (rct1->xmax < rct2->xmax) rct1->xmax = rct2->xmax;
if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin; if (rct1->ymin > rct2->ymin) rct1->ymin = rct2->ymin;
@ -240,10 +228,12 @@ void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
void print_rctf(const char *str, rctf *rect) void print_rctf(const char *str, rctf *rect)
{ {
printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin); printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f (%.3fx%.3f)\n", str,
rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
} }
void print_rcti(const char *str, rcti *rect) void print_rcti(const char *str, rcti *rect)
{ {
printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin); printf("%s: xmin %d, xmax %d, ymin %d, ymax %d (%dx%d)\n", str,
rect->xmin, rect->xmax, rect->ymin, rect->ymax, rect->xmax - rect->xmin, rect->ymax - rect->ymin);
} }

View File

@ -4447,7 +4447,7 @@ static int mesh_bevel_exec(bContext *C, wmOperator *op)
BMIter iter; BMIter iter;
BMEdge *eed; BMEdge *eed;
BMOperator bmop; BMOperator bmop;
float factor = RNA_float_get(op->ptr, "percent"), /*, dfac */ /* UNUSED */, df, s; float factor = RNA_float_get(op->ptr, "percent") /*, dfac */ /* UNUSED */, df, s;
int i, recursion = RNA_int_get(op->ptr, "recursion"); int i, recursion = RNA_int_get(op->ptr, "recursion");
const int use_even = RNA_boolean_get(op->ptr, "use_even"); const int use_even = RNA_boolean_get(op->ptr, "use_even");
const int use_dist = RNA_boolean_get(op->ptr, "use_dist"); const int use_dist = RNA_boolean_get(op->ptr, "use_dist");