From 3560f5c1e64e89d345fb2640bb502a433348e4b7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 6 Feb 2021 13:33:18 +1100 Subject: [PATCH] Cleanup: compare with zero for flag checks This is done almost everywhere already, use this more straightforward convention. --- source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp | 6 +++--- source/blender/draw/engines/eevee/eevee_renderpasses.c | 4 ++-- source/blender/draw/engines/overlay/overlay_antialiasing.c | 4 ++-- source/blender/draw/engines/overlay/overlay_edit_uv.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp index 3c2bf0aad07..92b334fddb9 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cpp @@ -32,9 +32,9 @@ void ColorCorrectionNode::convertToOperations(NodeConverter &converter, ColorCorrectionOperation *operation = new ColorCorrectionOperation(); operation->setData((NodeColorCorrection *)editorNode->storage); - operation->setRedChannelEnabled((editorNode->custom1 & 1) > 0); - operation->setGreenChannelEnabled((editorNode->custom1 & 2) > 0); - operation->setBlueChannelEnabled((editorNode->custom1 & 4) > 0); + operation->setRedChannelEnabled((editorNode->custom1 & 1) != 0); + operation->setGreenChannelEnabled((editorNode->custom1 & 2) != 0); + operation->setBlueChannelEnabled((editorNode->custom1 & 4) != 0); converter.addOperation(operation); converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); diff --git a/source/blender/draw/engines/eevee/eevee_renderpasses.c b/source/blender/draw/engines/eevee/eevee_renderpasses.c index 52160248d75..9dec551e4b9 100644 --- a/source/blender/draw/engines/eevee/eevee_renderpasses.c +++ b/source/blender/draw/engines/eevee/eevee_renderpasses.c @@ -449,8 +449,8 @@ void EEVEE_renderpasses_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) (stl->g_data->render_passes & EEVEE_RENDERPASSES_LIGHT_PASS) : stl->g_data->render_passes; - bool is_valid = (render_pass & EEVEE_RENDERPASSES_ALL) > 0; - bool needs_color_transfer = (render_pass & EEVEE_RENDERPASSES_COLOR_PASS) > 0 && + bool is_valid = (render_pass & EEVEE_RENDERPASSES_ALL) != 0; + bool needs_color_transfer = (render_pass & EEVEE_RENDERPASSES_COLOR_PASS) != 0 && DRW_state_is_opengl_render(); UNUSED_VARS(needs_color_transfer); diff --git a/source/blender/draw/engines/overlay/overlay_antialiasing.c b/source/blender/draw/engines/overlay/overlay_antialiasing.c index c602e536f79..b263254696c 100644 --- a/source/blender/draw/engines/overlay/overlay_antialiasing.c +++ b/source/blender/draw/engines/overlay/overlay_antialiasing.c @@ -80,7 +80,7 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata) bool need_wire_expansion = (G_draw.block.sizePixel > 1.0f); pd->antialiasing.enabled = need_wire_expansion || - ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0); + ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0); GPUTexture *color_tex = NULL; GPUTexture *line_tex = NULL; @@ -127,7 +127,7 @@ void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata) if (pd->antialiasing.enabled) { /* `antialiasing.enabled` is also enabled for wire expansion. Check here if * anti aliasing is needed. */ - const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0; + const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0; DRW_PASS_CREATE(psl->antialiasing_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL); diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c index 22433905b75..97dcf934c11 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.c +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c @@ -161,7 +161,7 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata) pd->edit_uv.do_tiled_image_border_overlay = is_image_type && is_tiled_image; pd->edit_uv.dash_length = 4.0f * UI_DPI_FAC; pd->edit_uv.line_style = edit_uv_line_style_from_space_image(sima); - pd->edit_uv.do_smooth_wire = ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0); + pd->edit_uv.do_smooth_wire = ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0); pd->edit_uv.do_stencil_overlay = show_overlays && do_stencil_overlay; pd->edit_uv.draw_type = sima->dt_uvstretch;