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/render/image.cpp
parentf18373a9ab1ae1534f311af92e03b9c6db1a0cc8 (diff)
Fix Cycles packed images not handling channel packed alpha correctly
Diffstat (limited to 'intern/cycles/render/image.cpp')
-rw-r--r--intern/cycles/render/image.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/intern/cycles/render/image.cpp b/intern/cycles/render/image.cpp
index 160e7d9ff1e..03ecc9bce52 100644
--- a/intern/cycles/render/image.cpp
+++ b/intern/cycles/render/image.cpp
@@ -494,6 +494,14 @@ void ImageManager::tag_reload_image(const string &filename,
}
}
+static bool image_associate_alpha(ImageManager::Image *img)
+{
+ /* For typical RGBA images we let OIIO convert to associated alpha,
+ * but some types we want to leave the RGB channels untouched. */
+ return !(ColorSpaceManager::colorspace_is_data(img->colorspace) ||
+ img->alpha_type == IMAGE_ALPHA_IGNORE || img->alpha_type == IMAGE_ALPHA_CHANNEL_PACKED);
+}
+
bool ImageManager::file_load_image_generic(Image *img, unique_ptr<ImageInput> *in)
{
if (img->filename == "")
@@ -514,13 +522,7 @@ bool ImageManager::file_load_image_generic(Image *img, unique_ptr<ImageInput> *i
ImageSpec spec = ImageSpec();
ImageSpec config = ImageSpec();
- /* For typical RGBA images we let OIIO convert to associated alpha,
- * but some types we want to leave the RGB channels untouched. */
- const bool associate_alpha = !(ColorSpaceManager::colorspace_is_data(img->colorspace) ||
- img->alpha_type == IMAGE_ALPHA_IGNORE ||
- img->alpha_type == IMAGE_ALPHA_CHANNEL_PACKED);
-
- if (!associate_alpha) {
+ if (!image_associate_alpha(img)) {
config.attribute("oiio:UnassociatedAlpha", 1);
}
@@ -630,6 +632,7 @@ bool ImageManager::file_load_image(Image *img,
img->builtin_data,
(float *)&pixels[0],
num_pixels * components,
+ image_associate_alpha(img),
img->metadata.builtin_free_cache);
}
else if (FileFormat == TypeDesc::UINT8) {
@@ -637,6 +640,7 @@ bool ImageManager::file_load_image(Image *img,
img->builtin_data,
(uchar *)&pixels[0],
num_pixels * components,
+ image_associate_alpha(img),
img->metadata.builtin_free_cache);
}
else {