Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-03-15 16:01:30 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-03-15 16:04:03 +0300
commitc10fbc002b8968232ab4bfab19fe977f90744fba (patch)
treebaeaf237d9aed37cefb22a9e729aba54ac3cd751 /source/blender/windowmanager/intern/wm_gesture.c
parentc16796089ce60f0fe5ca2f5b0c8266e7bcef2dfc (diff)
Correct assert failure in debug mode with lasso select
Just do early output and don't bother with any GLSL program bind when there is not enough points of lasso to draw. This could have happened at the very beginning of the stroke.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_gesture.c')
-rw-r--r--source/blender/windowmanager/intern/wm_gesture.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 74dd9914c30..da490f793bb 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -400,6 +400,16 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
draw_filled_lasso(win, gt);
}
+ numverts = gt->points;
+ if (gt->type == WM_GESTURE_LASSO) {
+ numverts++;
+ }
+
+ /* Nothing to drawe, do early output. */
+ if(numverts < 2) {
+ return;
+ }
+
VertexFormat* format = immVertexFormat();
unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
@@ -415,11 +425,6 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
immUniform1f("dash_width", 2.0f);
immUniform1f("dash_width_on", 1.0f);
- numverts = gt->points;
- if (gt->type == WM_GESTURE_LASSO) {
- numverts++;
- }
-
immBegin(PRIM_LINE_STRIP, numverts);
for (i = 0; i < gt->points; i++, lasso += 2) {
@@ -441,7 +446,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
}
immEnd();
-
+
immUnbindProgram();
}