[Bf-blender-cvs] [6861ea7cdd2] greasepencil-object: Cleanup: Use BLI_rect functions instead of inlining boundbox range checks

Joshua Leung noreply at git.blender.org
Tue Feb 6 15:05:43 CET 2018


Commit: 6861ea7cdd2eb21d0dff10b4e9f9402fce48e8c9
Author: Joshua Leung
Date:   Tue Feb 6 21:17:43 2018 +1300
Branches: greasepencil-object
https://developer.blender.org/rB6861ea7cdd2eb21d0dff10b4e9f9402fce48e8c9

Cleanup: Use BLI_rect functions instead of inlining boundbox range checks

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

M	source/blender/editors/gpencil/gpencil_colorpick.c

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

diff --git a/source/blender/editors/gpencil/gpencil_colorpick.c b/source/blender/editors/gpencil/gpencil_colorpick.c
index 3b571e5ae1f..eb8b48846e8 100644
--- a/source/blender/editors/gpencil/gpencil_colorpick.c
+++ b/source/blender/editors/gpencil/gpencil_colorpick.c
@@ -34,6 +34,7 @@
 #include "BLI_utildefines.h"
 #include "BLI_blenlib.h"
 #include "BLI_math.h"
+#include "BLI_rect.h"
 #include "BLI_stack.h"
 
 #include "BLT_translation.h"
@@ -471,17 +472,13 @@ static int gpencil_colorpick_invoke(bContext *C, wmOperator *op, const wmEvent *
 static bool set_color(const wmEvent *event, tGPDpick *tgpk)
 {
 	tGPDpickColor *tcol = tgpk->colors;
-	/* if click out of panel end */
-	if ((event->mval[0] <= tgpk->panel.xmin) || (event->mval[0] >= tgpk->panel.xmax) ||
-		(event->mval[1] <= tgpk->panel.ymin) || (event->mval[1] >= tgpk->panel.ymax))
-	{
+	/* if click out of panel, end */
+	if (!BLI_rcti_isect_pt_v(&tgpk->panel, event->mval)) {
 		return true;
 	}
 
 	for (int i = 0; i < tgpk->totcolor; i++, tcol++) {
-		if ((event->mval[0] >= tcol->rect.xmin) && (event->mval[0] <= tcol->rect.xmax) &&
-			(event->mval[1] >= tcol->rect.ymin) && (event->mval[1] <= tcol->rect.ymax))
-		{
+		if (BLI_rcti_isect_pt_v(&tcol->rect, event->mval)) {
 			tgpk->palette->active_color = tcol->index;
 			return true;
 		}



More information about the Bf-blender-cvs mailing list