diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-31 17:58:19 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-04 12:54:59 +0300 |
commit | 3d55d80c59d97ce12d1e5f344e7f1aaf1c9c2a4f (patch) | |
tree | d59f5b7adcd2cd8bbf52f9c1791be5385a05616a /source/blender/editors/mask | |
parent | a81108ae74bde032c004b6a9bfb116d8e43f9283 (diff) |
Masking: Cleanup, indentation level
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 4e75d49987e..bcca7f8b35f 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -799,36 +799,38 @@ void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra const float framelen = ar->winx / (float)(efra - sfra + 1); MaskLayer *mask_layer = BKE_mask_layer_active(mask); + if (mask_layer == NULL) { + return; + } - if (mask_layer) { - unsigned int num_lines = BLI_listbase_count(&mask_layer->splines_shapes); + unsigned int num_lines = BLI_listbase_count(&mask_layer->splines_shapes); + if (num_lines == 0) { + return; + } - if (num_lines > 0) { - /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ - const rcti *rect_visible = ED_region_visible_rect(ar); - const int region_bottom = rect_visible->ymin; + /* Local coordinate visible rect inside region, to accommodate overlapping ui. */ + const rcti *rect_visible = ED_region_visible_rect(ar); + const int region_bottom = rect_visible->ymin; - uint pos = GPU_vertformat_attr_add( - immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); + uint pos = GPU_vertformat_attr_add( + immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformColor4ub(255, 175, 0, 255); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + immUniformColor4ub(255, 175, 0, 255); - immBegin(GPU_PRIM_LINES, 2 * num_lines); + immBegin(GPU_PRIM_LINES, 2 * num_lines); - for (MaskLayerShape *mask_layer_shape = mask_layer->splines_shapes.first; - mask_layer_shape != NULL; - mask_layer_shape = mask_layer_shape->next) { - int frame = mask_layer_shape->frame; + for (MaskLayerShape *mask_layer_shape = mask_layer->splines_shapes.first; + mask_layer_shape != NULL; + mask_layer_shape = mask_layer_shape->next) { + int frame = mask_layer_shape->frame; - /* draw_keyframe(i, CFRA, sfra, framelen, 1); */ - int height = (frame == cfra) ? 22 : 10; - int x = (frame - sfra) * framelen; - immVertex2i(pos, x, region_bottom); - immVertex2i(pos, x, region_bottom + height * UI_DPI_FAC); - } - immEnd(); - immUnbindProgram(); - } + /* draw_keyframe(i, CFRA, sfra, framelen, 1); */ + int height = (frame == cfra) ? 22 : 10; + int x = (frame - sfra) * framelen; + immVertex2i(pos, x, region_bottom); + immVertex2i(pos, x, region_bottom + height * UI_DPI_FAC); } + immEnd(); + immUnbindProgram(); } |