diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-24 23:10:13 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-24 23:12:13 +0300 |
commit | a4fe338dd8c6822d27b8858bae5fa9a54972719c (patch) | |
tree | 9a6b671702a7cf41e98efef72e78c7cc54974111 /source/blender/draw/engines/gpencil | |
parent | b1f3a86d999b6742d783de5a11d7de0c54cf5891 (diff) |
Cleanup: add missing braces to draw manager
Diffstat (limited to 'source/blender/draw/engines/gpencil')
6 files changed, 29 insertions, 15 deletions
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c index 59a8a5f73e1..0cc835b8d4e 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@ -156,8 +156,9 @@ static bool gpencil_can_draw_stroke( const bool onion, const bool is_mat_preview) { /* skip stroke if it doesn't have any valid data */ - if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL)) + if ((gps->points == NULL) || (gps->totpoints < 1) || (gp_style == NULL)) { return false; + } /* if mat preview render always visible */ if (is_mat_preview) { @@ -1130,8 +1131,9 @@ void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps) } else { /* No triangles needed - Free anything allocated previously */ - if (gps->triangles) + if (gps->triangles) { MEM_freeN(gps->triangles); + } gps->triangles = NULL; } @@ -1496,8 +1498,9 @@ void DRW_gpencil_populate_multiedit( /* draw strokes */ for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { /* don't draw layer if hidden */ - if (gpl->flag & GP_LAYER_HIDE) + if (gpl->flag & GP_LAYER_HIDE) { continue; + } /* list of frames to draw */ if (!playing) { @@ -1603,8 +1606,9 @@ void DRW_gpencil_populate_datablock( } gpf = BKE_gpencil_layer_getframe(gpl, remap_cfra, GP_GETFRAME_USE_PREV); - if (gpf == NULL) + if (gpf == NULL) { continue; + } /* if solo mode, display only frames with keyframe in the current frame */ if ((is_solomode) && (gpf->framenum != remap_cfra)) { diff --git a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c index 925eaebab1f..1f47be0c34a 100644 --- a/source/blender/draw/engines/gpencil/gpencil_shader_fx.c +++ b/source/blender/draw/engines/gpencil/gpencil_shader_fx.c @@ -92,13 +92,15 @@ static bool effect_is_active(bGPdata *gpd, ShaderFxData *fx, bool is_render) static bool get_normal_vector(bGPdata *gpd, float r_point[3], float r_normal[3]) { for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { - if (gpl->flag & GP_LAYER_HIDE) + if (gpl->flag & GP_LAYER_HIDE) { continue; + } /* get frame */ bGPDframe *gpf = gpl->actframe; - if (gpf == NULL) + if (gpf == NULL) { continue; + } for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { if (gps->totpoints >= 3) { bGPDspoint *pt = &gps->points[0]; diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl index 3dbab0297c4..04ab1557d07 100644 --- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_wave_frag.glsl @@ -38,6 +38,7 @@ void main() FragColor = outcolor; gl_FragDepth = stroke_depth; - if (outcolor.a < 0.02f) + if (outcolor.a < 0.02f) { discard; + } } diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl index f5696116eea..fdaad9890a0 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl @@ -79,10 +79,12 @@ vec4 get_blend_color(int mode, vec4 src_color, vec4 blend_color) float linearrgb_to_srgb(float c) { - if (c < 0.0031308) + if (c < 0.0031308) { return (c < 0.0) ? 0.0 : c * 12.92; - else + } + else { return 1.055 * pow(c, 1.0 / 2.4) - 0.055; + } } vec4 tone(vec4 stroke_color) diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl index db973056110..a1285029e4c 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl @@ -23,9 +23,10 @@ void main() float dist_squared = dot(centered, centered); const float rad_squared = 0.25; - // round point with jaggy edges - if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared)) + /* Round point with jaggy edges. */ + if ((mode != GPENCIL_MODE_BOX) && (dist_squared > rad_squared)) { discard; + } vec4 tmp_color = texture2D(myTexture, mTexCoord); diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl index f4b6201e503..eb64947999e 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_zdepth_mix_frag.glsl @@ -8,18 +8,22 @@ uniform int tonemapping; float srgb_to_linearrgb(float c) { - if (c < 0.04045) + if (c < 0.04045) { return (c < 0.0) ? 0.0 : c * (1.0 / 12.92); - else + } + else { return pow((c + 0.055) * (1.0 / 1.055), 2.4); + } } float linearrgb_to_srgb(float c) { - if (c < 0.0031308) + if (c < 0.0031308) { return (c < 0.0) ? 0.0 : c * 12.92; - else + } + else { return 1.055 * pow(c, 1.0 / 2.4) - 0.055; + } } void main() |