Cleanup: compare with zero for flag checks

This is done almost everywhere already,
use this more straightforward convention.
This commit is contained in:
Campbell Barton 2021-02-06 13:33:18 +11:00
parent f10825d573
commit 3560f5c1e6
4 changed files with 8 additions and 8 deletions

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

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

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

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