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:
authorAntony Riakiotakis <kalast@gmail.com>2013-04-23 15:02:36 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-04-23 15:02:36 +0400
commit47b172d39d3d3bb212f2d158848f33443a1277ab (patch)
tree4b1b396e9eef2206acc8097b58b412d29166d8ce /source/blender/editors/sculpt_paint
parenta992ef13be46ac0028b62ccb73828c2c08bbea4c (diff)
Fix issue reported by Campbell: Move texture existence check out of loop
and exit ovelay display early. Avoids possible garbage value reading. Thanks!
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_cursor.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 10e0e4c810a..f2ae7638cdc 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -124,9 +124,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
(overlay_flags & PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY);
target = (primary) ? &primary_snap : &secondary_snap;
-
- if (mtex->brush_map_mode != MTEX_MAP_MODE_VIEW && !mtex->tex) return 0;
-
+
refresh =
!target->overlay_texture ||
(invalid != 0) ||
@@ -175,8 +173,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
else
buffer = MEM_mallocN(sizeof(GLubyte) * size * size, "load_tex");
- if (mtex->tex)
- pool = BKE_image_pool_new();
+ pool = BKE_image_pool_new();
#pragma omp parallel for schedule(static)
for (j = 0; j < size; j++) {
@@ -228,8 +225,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
if (col) {
float rgba[4];
- if (mtex->tex)
- paint_get_tex_pixel_col(mtex, x, y, rgba, pool);
+ paint_get_tex_pixel_col(mtex, x, y, rgba, pool);
buffer[index * 4] = rgba[0] * 255;
buffer[index * 4 + 1] = rgba[1] * 255;
@@ -237,7 +233,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
buffer[index * 4 + 3] = rgba[3] * 255;
}
else {
- float avg = mtex->tex ? paint_get_tex_pixel(mtex, x, y, pool) : 1;
+ float avg = paint_get_tex_pixel(mtex, x, y, pool);
avg += br->texture_sample_bias;
@@ -530,9 +526,9 @@ static void paint_draw_tex_overlay(UnifiedPaintSettings *ups, Brush *brush,
(brush->overlay_flags & BRUSH_OVERLAY_SECONDARY) != 0;
int overlay_alpha = (primary) ? brush->texture_overlay_alpha : brush->mask_overlay_alpha;
- if (!((mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL && mtex->tex) ||
+ if (!(mtex->tex) || !((mtex->brush_map_mode == MTEX_MAP_MODE_STENCIL) ||
(valid &&
- ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED))))
+ ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED))))
{
return;
}