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.
This commit is contained in:
parent
c16796089c
commit
c10fbc002b
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue