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>2019-05-26 13:16:58 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-26 13:21:57 +0300
commit909b0ac16c26786f864a84e14ec7714c3308d8f0 (patch)
tree3b8d9839a0aa38d748ffc2ad8d0269328b45e043 /intern/cycles/blender/blender_session.cpp
parentf18373a9ab1ae1534f311af92e03b9c6db1a0cc8 (diff)
Fix Cycles packed images not handling channel packed alpha correctly
Diffstat (limited to 'intern/cycles/blender/blender_session.cpp')
-rw-r--r--intern/cycles/blender/blender_session.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 11b6a38c195..bb7c750078f 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -147,9 +147,9 @@ void BlenderSession::create_session()
scene->image_manager->builtin_image_info_cb = function_bind(
&BlenderSession::builtin_image_info, this, _1, _2, _3);
scene->image_manager->builtin_image_pixels_cb = function_bind(
- &BlenderSession::builtin_image_pixels, this, _1, _2, _3, _4, _5);
+ &BlenderSession::builtin_image_pixels, this, _1, _2, _3, _4, _5, _6);
scene->image_manager->builtin_image_float_pixels_cb = function_bind(
- &BlenderSession::builtin_image_float_pixels, this, _1, _2, _3, _4, _5);
+ &BlenderSession::builtin_image_float_pixels, this, _1, _2, _3, _4, _5, _6);
session->scene = scene;
@@ -1223,6 +1223,7 @@ bool BlenderSession::builtin_image_pixels(const string &builtin_name,
void *builtin_data,
unsigned char *pixels,
const size_t pixels_size,
+ const bool associate_alpha,
const bool free_cache)
{
if (!builtin_data) {
@@ -1272,12 +1273,14 @@ bool BlenderSession::builtin_image_pixels(const string &builtin_name,
b_image.buffers_free();
}
- /* Premultiply, byte images are always straight for Blender. */
- unsigned char *cp = pixels;
- for (size_t i = 0; i < num_pixels; i++, cp += channels) {
- cp[0] = (cp[0] * cp[3]) >> 8;
- cp[1] = (cp[1] * cp[3]) >> 8;
- cp[2] = (cp[2] * cp[3]) >> 8;
+ if (associate_alpha) {
+ /* Premultiply, byte images are always straight for Blender. */
+ unsigned char *cp = pixels;
+ for (size_t i = 0; i < num_pixels; i++, cp += channels) {
+ cp[0] = (cp[0] * cp[3]) >> 8;
+ cp[1] = (cp[1] * cp[3]) >> 8;
+ cp[2] = (cp[2] * cp[3]) >> 8;
+ }
}
return true;
}
@@ -1286,6 +1289,7 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
void *builtin_data,
float *pixels,
const size_t pixels_size,
+ const bool,
const bool free_cache)
{
if (!builtin_data) {