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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-15 18:16:21 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-08-15 18:16:21 +0300
commit38e08ec66bb4d05d530cc57f1a9a7c79470000b0 (patch)
tree607a4673a204f33abb35b4eb372361d85f594d70 /source/blender/editors/sculpt_paint/paint_cursor.c
parent9bac3ffd3f691a9bb1280694668e643c6ed3bb18 (diff)
Fix T56012: brush stencil overlay draws in the wrong location.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 997fe1282f9..36568632ffa 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -634,14 +634,10 @@ static void paint_draw_tex_overlay(
}
if (ups->draw_anchored) {
- float aim[2] = {
- ups->anchored_initial_mouse[0] + vc->ar->winrct.xmin,
- ups->anchored_initial_mouse[1] + vc->ar->winrct.ymin,
- };
- quad.xmin = aim[0] - ups->anchored_size;
- quad.ymin = aim[1] - ups->anchored_size;
- quad.xmax = aim[0] + ups->anchored_size;
- quad.ymax = aim[1] + ups->anchored_size;
+ quad.xmin = ups->anchored_initial_mouse[0] - ups->anchored_size;
+ quad.ymin = ups->anchored_initial_mouse[1] - ups->anchored_size;
+ quad.xmax = ups->anchored_initial_mouse[0] + ups->anchored_size;
+ quad.ymax = ups->anchored_initial_mouse[1] + ups->anchored_size;
}
else {
const int radius = BKE_brush_size_get(vc->scene, brush) * zoom;
@@ -738,15 +734,11 @@ static void paint_draw_cursor_overlay(
glDepthFunc(GL_ALWAYS);
if (ups->draw_anchored) {
- float aim[2] = {
- ups->anchored_initial_mouse[0] + vc->ar->winrct.xmin,
- ups->anchored_initial_mouse[1] + vc->ar->winrct.ymin,
- };
- copy_v2_v2(center, aim);
- quad.xmin = aim[0] - ups->anchored_size;
- quad.ymin = aim[1] - ups->anchored_size;
- quad.xmax = aim[0] + ups->anchored_size;
- quad.ymax = aim[1] + ups->anchored_size;
+ copy_v2_v2(center, ups->anchored_initial_mouse);
+ quad.xmin = ups->anchored_initial_mouse[0] - ups->anchored_size;
+ quad.ymin = ups->anchored_initial_mouse[1] - ups->anchored_size;
+ quad.xmax = ups->anchored_initial_mouse[0] + ups->anchored_size;
+ quad.ymax = ups->anchored_initial_mouse[1] + ups->anchored_size;
}
else {
const int radius = BKE_brush_size_get(vc->scene, brush) * zoom;
@@ -763,7 +755,6 @@ static void paint_draw_cursor_overlay(
if (ups->stroke_active && BKE_brush_use_size_pressure(vc->scene, brush)) {
do_pop = true;
GPU_matrix_push();
- GPU_matrix_identity_set();
GPU_matrix_translate_2fv(center);
GPU_matrix_scale_1f(ups->size_pressure_value);
GPU_matrix_translate_2f(-center[0], -center[1]);
@@ -809,6 +800,12 @@ static void paint_draw_alpha_overlay(
eOverlayControlFlags flags = BKE_paint_get_overlay_flags();
gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_BLEND_BIT);
+ /* Translate to region. */
+ GPU_matrix_push();
+ GPU_matrix_translate_2f(vc->ar->winrct.xmin, vc->ar->winrct.ymin);
+ x -= vc->ar->winrct.xmin;
+ y -= vc->ar->winrct.ymin;
+
/* coloured overlay should be drawn separately */
if (col) {
if (!(flags & PAINT_OVERLAY_OVERRIDE_PRIMARY))
@@ -825,6 +822,7 @@ static void paint_draw_alpha_overlay(
paint_draw_cursor_overlay(ups, brush, vc, x, y, zoom);
}
+ GPU_matrix_pop();
gpuPopAttrib();
}