diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-04-13 20:03:14 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-04-13 20:03:14 +0400 |
commit | 6f153046e0ffec912883ab24b9fda823e9fbeb38 (patch) | |
tree | 9a0d2705acdfe2a920eeaaeb0a0924cc9bf65e37 /source/blender/editors/sculpt_paint/paint_cursor.c | |
parent | 5d79c2662e043c35feeb4a31f3c5eb288e93c9c1 (diff) |
Reduce overhead when sampling texture images for brushes. The tests can
be cached and reused.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 97c1a994629..b1e4696cd02 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -162,7 +162,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima if (refresh) { struct ImagePool *pool = NULL; bool convert_to_linear = false; - ImBuf *tex_ibuf; + struct ColorSpace *colorspace; /* stencil is rotated later */ const float rotation = (mtex->brush_map_mode != MTEX_MAP_MODE_STENCIL) ? -mtex->rot : 0; @@ -223,10 +223,11 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima #endif if (mtex->tex->type == TEX_IMAGE && mtex->tex->ima) { - tex_ibuf = BKE_image_pool_acquire_ibuf(mtex->tex->ima, &mtex->tex->iuser, pool); + ImBuf *tex_ibuf = BKE_image_pool_acquire_ibuf(mtex->tex->ima, &mtex->tex->iuser, pool); /* For consistency, sampling always returns color in linear space */ if (tex_ibuf && tex_ibuf->rect_float == NULL) { convert_to_linear = true; + colorspace = tex_ibuf->rect_colorspace; } BKE_image_pool_release_ibuf(mtex->tex->ima, tex_ibuf, pool); } @@ -270,7 +271,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima if (col) { float rgba[4]; - paint_get_tex_pixel_col(mtex, x, y, rgba, pool, thread_num, convert_to_linear, tex_ibuf); + paint_get_tex_pixel_col(mtex, x, y, rgba, pool, thread_num, convert_to_linear, colorspace); buffer[index * 4] = rgba[0] * 255; buffer[index * 4 + 1] = rgba[1] * 255; |