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:
authorCampbell Barton <ideasman42@gmail.com>2016-05-05 13:57:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-05-05 13:57:54 +0300
commitf5dcb137f1fb90d80b03ce4db8217be13232dfa5 (patch)
tree9baf0cc49b7277c4a05c541170c2cd34bab9a932 /source/blender/editors/sculpt_paint/paint_image_proj.c
parent9b8bf57361483fa655b1151ec14b64dd8fdabb08 (diff)
Fix project paint using uninitialized edit-region
First stroke always had the minimum rectangle set to 0,0 which could cause a largre region of pixels to be unnecessarily updated.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_image_proj.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index bce3b46010b..3df6750f792 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -107,6 +107,8 @@
#include "paint_intern.h"
+static void partial_redraw_array_init(ImagePaintPartialRedraw *pr);
+
/* Defines and Structs */
/* FTOCHAR as inline function */
BLI_INLINE unsigned char f_to_char(const float val)
@@ -3647,7 +3649,7 @@ static void project_paint_build_proj_ima(
projIma->ibuf = BKE_image_acquire_ibuf(projIma->ima, NULL, NULL);
size = sizeof(void **) * IMAPAINT_TILE_NUMBER(projIma->ibuf->x) * IMAPAINT_TILE_NUMBER(projIma->ibuf->y);
projIma->partRedrawRect = BLI_memarena_alloc(arena, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);
- memset(projIma->partRedrawRect, 0, sizeof(ImagePaintPartialRedraw) * PROJ_BOUNDBOX_SQUARED);
+ partial_redraw_array_init(projIma->partRedrawRect);
projIma->undoRect = (volatile void **) BLI_memarena_alloc(arena, size);
memset((void *)projIma->undoRect, 0, size);
projIma->maskRect = BLI_memarena_alloc(arena, size);
@@ -3998,8 +4000,8 @@ static void project_paint_end(ProjPaintState *ps)
/* 1 = an undo, -1 is a redo. */
static void partial_redraw_single_init(ImagePaintPartialRedraw *pr)
{
- pr->x1 = 10000000;
- pr->y1 = 10000000;
+ pr->x1 = INT_MAX;
+ pr->y1 = INT_MAX;
pr->x2 = -1;
pr->y2 = -1;
@@ -5360,9 +5362,6 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
float lastpos[2] = {0.0, 0.0};
int a;
- for (a = 0; a < ps.image_tot; a++)
- partial_redraw_array_init(ps.projImages[a].partRedrawRect);
-
project_paint_op(&ps, lastpos, pos);
project_image_refresh_tagged(&ps);