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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-09-24 15:56:07 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-09-24 15:56:07 +0400
commit9e3e12fa4e2b9038314e3f2f690a908042b835fa (patch)
tree4f5178f7e7ff7b8ff6a6ebd74459621f146adaf2 /source/blender/makesrna/intern/rna_image_api.c
parent5a5b37a4fadee5ce2c44b097a50986e0b70ca898 (diff)
Proper fix for #32626: TIFF renders are limited to 8 bit even when we choose 16.
Color management would be applied on both of float and byte buffers on image save in cases if file format doesn't require linear float buffer and if image is saving as render result. This solves both initial report issue and TODO marked in previous fix. Also de-duplicated image buffer color managing code and gave some more meaningful names for few functions. Also wrote documentation around this function, so current assumptions about spaces should be clear enough. Made regression tests by saving EXR/PNG images to all supported format and rendering OpenGL/Normal animation, in all cases seems everything is fine, but more tests for sure would be welcome.
Diffstat (limited to 'source/blender/makesrna/intern/rna_image_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index c66c0085763..cb7844c50e3 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -81,9 +81,10 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image");
}
else {
- ImBuf *write_ibuf = IMB_dupImBuf(ibuf);
+ ImBuf *write_ibuf;
- IMB_display_buffer_to_imbuf_rect(write_ibuf, &scene->view_settings, &scene->display_settings);
+ write_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings,
+ &scene->display_settings, &scene->r.im_format);
write_ibuf->planes = scene->r.im_format.planes;
write_ibuf->dither = scene->r.dither_intensity;
@@ -91,7 +92,9 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
}
- IMB_freeImBuf(write_ibuf);
+
+ if (write_ibuf != ibuf)
+ IMB_freeImBuf(write_ibuf);
}
BKE_image_release_ibuf(image, lock);