Fix T64371
authorRichard Antalik <richardantalik@gmail.com>
Sun, 12 May 2019 22:21:38 +0000 (15:21 -0700)
committerRichard Antalik <richardantalik@gmail.com>
Sun, 12 May 2019 22:25:30 +0000 (15:25 -0700)
Variable stripe_offs used without been initialized

Reviewed by: brecht

Differential Revision: https://developer.blender.org/D4845

source/blender/editors/space_sequencer/sequencer_draw.c

index 7caad1d057e398d7e5b22ff8f7d1165331b68b3c..60bc320c02683018abba9df1c9bc06fe31123cec 100644 (file)
@@ -1922,10 +1922,14 @@ static void draw_cache_view(const bContext *C)
   uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
   immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
-  float stripe_bot, stripe_top, stripe_offs;
+  float stripe_bot, stripe_top;
+  float stripe_offs = UI_view2d_region_to_view_y(v2d, 1.0f) - v2d->cur.ymin;
   float stripe_ht = UI_view2d_region_to_view_y(v2d, 4.0f * UI_DPI_FAC * U.pixelsize) -
                     v2d->cur.ymin;
 
+  CLAMP_MAX(stripe_ht, 0.2f);
+  CLAMP_MIN(stripe_offs, stripe_ht / 2);
+
   if (scene->ed->cache_flag & SEQ_CACHE_VIEW_FINAL_OUT) {
     stripe_bot = UI_view2d_region_to_view_y(v2d, V2D_SCROLL_HEIGHT_HANDLES);
     stripe_top = stripe_bot + stripe_ht;
@@ -1944,10 +1948,6 @@ static void draw_cache_view(const bContext *C)
       continue;
     }
 
-    CLAMP_MAX(stripe_ht, 0.2f);
-    stripe_offs = UI_view2d_region_to_view_y(v2d, 1.0f) - v2d->cur.ymin;
-    CLAMP_MIN(stripe_offs, stripe_ht / 2);
-
     stripe_bot = seq->machine + SEQ_STRIP_OFSBOTTOM + stripe_offs;
     stripe_top = stripe_bot + stripe_ht;