[Bf-blender-cvs] [3826e77593e] blender2.8: Draw Manager: Small cleanup on bool and bitwise

Dalai Felinto noreply at git.blender.org
Tue May 16 16:26:51 CEST 2017


Commit: 3826e77593e44b441dc4f4162083c4a3ae6fe044
Author: Dalai Felinto
Date:   Tue May 16 16:25:57 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB3826e77593e44b441dc4f4162083c4a3ae6fe044

Draw Manager: Small cleanup on bool and bitwise

We should avoid casting from an int to a flag.

In this case it is probably fine, but if the OB_MODE_SCULPT
was too high it can overflow the bool.

(also adding explicit parenthesis to a flag check)

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

M	source/blender/draw/engines/clay/clay_engine.c
M	source/blender/draw/modes/object_mode.c

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

diff --git a/source/blender/draw/engines/clay/clay_engine.c b/source/blender/draw/engines/clay/clay_engine.c
index 113f8dd157b..c4cca1f537b 100644
--- a/source/blender/draw/engines/clay/clay_engine.c
+++ b/source/blender/draw/engines/clay/clay_engine.c
@@ -726,7 +726,7 @@ static void CLAY_cache_populate(void *vedata, Object *ob)
 	if (!DRW_object_is_renderable(ob))
 		return;
 
-	bool sculpt_mode = ob->mode & OB_MODE_SCULPT;
+	bool sculpt_mode = (ob->mode & OB_MODE_SCULPT) != 0;
 
 	struct Batch *geom = DRW_cache_object_surface_get(ob);
 	if (geom) {
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 7fe6ce20608..fce3db61226 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -1192,7 +1192,7 @@ static void OBJECT_cache_populate(void *vedata, Object *ob)
 
 	if (do_outlines) {
 		Object *obedit = scene->obedit;
-		if (ob != obedit && !(OBACT_NEW == ob && ob->mode & OB_MODE_ALL_PAINT)) {
+		if (ob != obedit && !(OBACT_NEW == ob && (ob->mode & OB_MODE_ALL_PAINT))) {
 			struct Batch *geom = DRW_cache_object_surface_get(ob);
 			if (geom) {
 				theme_id = DRW_object_wire_theme_get(ob, sl, NULL);




More information about the Bf-blender-cvs mailing list