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-19 03:56:12 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-05-19 15:36:42 +0300
commit3b23b5c638feae0ad6319440771b83a64a1f9ebe (patch)
tree16fbedd83ffa6a02904d3f93576c1de1674a0584 /intern/cycles/render/colorspace.cpp
parent7c78c20b6bf6f7dd00397c456fb9e2116febfca7 (diff)
Images: don't (un)premultipy non-color data
The previous behavior here was wrong for some specific combinations of settings, non-color RGB channels should never be affected by the alpha channel.
Diffstat (limited to 'intern/cycles/render/colorspace.cpp')
-rw-r--r--intern/cycles/render/colorspace.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/intern/cycles/render/colorspace.cpp b/intern/cycles/render/colorspace.cpp
index 7b57478ff51..f4c217bc9fb 100644
--- a/intern/cycles/render/colorspace.cpp
+++ b/intern/cycles/render/colorspace.cpp
@@ -82,6 +82,31 @@ ColorSpaceProcessor *ColorSpaceManager::get_processor(ustring colorspace)
#endif
}
+bool ColorSpaceManager::colorspace_is_data(ustring colorspace)
+{
+ if (colorspace == u_colorspace_auto || colorspace == u_colorspace_raw ||
+ colorspace == u_colorspace_srgb) {
+ return false;
+ }
+
+#ifdef WITH_OCIO
+ OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
+ if (!config) {
+ return false;
+ }
+
+ try {
+ OCIO::ConstColorSpaceRcPtr space = config->getColorSpace(colorspace.c_str());
+ return space && space->isData();
+ }
+ catch (OCIO::Exception &exception) {
+ return false;
+ }
+#else
+ return false;
+#endif
+}
+
ustring ColorSpaceManager::detect_known_colorspace(ustring colorspace,
const char *file_format,
bool is_float)