diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-07-12 20:07:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-07-12 20:19:04 +0300 |
commit | 5e1702e7a593851b2354bca5db3044e7aa639312 (patch) | |
tree | 15e5748f8370d2a7107bd7a6067d4fb08304aa55 /intern | |
parent | 2a41ab5e6ca48c7ae2392c567c74162e34a74c9b (diff) |
Fix T87844: Cycles losing 1 bit of precision when loading packed byte images
This could lead to colors that are supposed to be exactly white to be slightly
darker.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/blender_image.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_image.cpp b/intern/cycles/blender/blender_image.cpp index 3a9d159e461..f27275bd457 100644 --- a/intern/cycles/blender/blender_image.cpp +++ b/intern/cycles/blender/blender_image.cpp @@ -137,9 +137,9 @@ bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata, /* Premultiply, byte images are always straight for Blender. */ unsigned char *cp = (unsigned char *)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; + cp[0] = (cp[0] * cp[3]) / 255; + cp[1] = (cp[1] * cp[3]) / 255; + cp[2] = (cp[2] * cp[3]) / 255; } } } |