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)
This commit is contained in:
Dalai Felinto
2017-05-16 16:25:57 +02:00
parent b11168c8f1
commit 3826e77593
2 changed files with 2 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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);