[Bf-blender-cvs] [15580470fd2] blender2.8: Paint Stroke: Fix strokes drawing.

Germano noreply at git.blender.org
Thu May 10 21:30:50 CEST 2018


Commit: 15580470fd2d9d0355557c6b85987a9cc09a7d9d
Author: Germano
Date:   Thu May 10 16:29:14 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB15580470fd2d9d0355557c6b85987a9cc09a7d9d

Paint Stroke: Fix strokes drawing.

===================================================================

M	source/blender/editors/sculpt_paint/paint_stroke.c

===================================================================

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);
 	}



More information about the Bf-blender-cvs mailing list