diff options
author | Germano <germano.costa@ig.com.br> | 2018-05-10 22:29:14 +0300 |
---|---|---|
committer | Germano <germano.costa@ig.com.br> | 2018-05-10 22:29:14 +0300 |
commit | 15580470fd2d9d0355557c6b85987a9cc09a7d9d (patch) | |
tree | 9e0ff6714b63c86060038dd03ddf7c2acff4b311 /source/blender/editors/sculpt_paint | |
parent | 3f3326af1ce079b1526c407dbc11dd12c4a1bb79 (diff) |
Paint Stroke: Fix strokes drawing.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_stroke.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 861015375cb..3ded6326c67 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -149,13 +149,18 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); + ARegion *ar = stroke->vc.ar; + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4ubv(paint->paint_cursor_col); immBegin(GWN_PRIM_LINES, 2); immVertex2f(pos, x, y); - immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); + immVertex2f(pos, + stroke->last_mouse_position[0] + ar->winrct.xmin, + stroke->last_mouse_position[1] + ar->winrct.ymin); + immEnd(); immUnbindProgram(); @@ -187,12 +192,22 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) immBegin(GWN_PRIM_LINES, 2); + ARegion *ar = stroke->vc.ar; + if (stroke->constrain_line) { - immVertex2f(shdr_pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); - immVertex2f(shdr_pos, stroke->constrained_pos[0], stroke->constrained_pos[1]); + immVertex2f(shdr_pos, + stroke->last_mouse_position[0] + ar->winrct.xmin, + stroke->last_mouse_position[1] + ar->winrct.ymin); + + immVertex2f(shdr_pos, + stroke->constrained_pos[0] + ar->winrct.xmin, + stroke->constrained_pos[1] + ar->winrct.ymin); } else { - immVertex2f(shdr_pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]); + immVertex2f(shdr_pos, + stroke->last_mouse_position[0] + ar->winrct.xmin, + stroke->last_mouse_position[1] + ar->winrct.ymin); + immVertex2f(shdr_pos, x, y); } |