diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-23 22:50:56 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-09-23 22:50:56 +0400 |
commit | a42ba82f638e481d7fd3c3ed2ba05c331ef6717e (patch) | |
tree | 81a2b9221799707b49b74a5df8bb3ff964ba78bd /source/blender/makesrna/intern/rna_image_api.c | |
parent | 7afbdff1b6c348227e652e1c3071ab7ba7c91c44 (diff) | |
parent | a73dd3476e7d180d3320afc04d218ce22f2f3bfc (diff) |
Merged changes in the trunk up to revision 50829.
Conflicts resolved:
source/blender/blenloader/intern/readfile.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c
Also addressed code inconsistency due to changes in the trunk revision 50628 (color
management with OCIO) and 50806 (UV project material). OCIO-related changes are marked
OCIO_TODO as in some other files modified in revision 50628.
Diffstat (limited to 'source/blender/makesrna/intern/rna_image_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_image_api.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index fa3f8d69c47..c66c0085763 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -50,6 +50,7 @@ #include "BKE_global.h" /* grr: G.main->name */ #include "IMB_imbuf.h" +#include "IMB_colormanagement.h" #include "BIF_gl.h" #include "GPU_draw.h" @@ -80,16 +81,17 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports BKE_reportf(reports, RPT_ERROR, "Couldn't acquire buffer from image"); } else { - /* temp swap out the color */ - const unsigned char imb_planes_back = ibuf->planes; - const float dither_back = ibuf->dither; - ibuf->planes = scene->r.im_format.planes; - ibuf->dither = scene->r.dither_intensity; - if (!BKE_imbuf_write(ibuf, path, &scene->r.im_format)) { + ImBuf *write_ibuf = IMB_dupImBuf(ibuf); + + IMB_display_buffer_to_imbuf_rect(write_ibuf, &scene->view_settings, &scene->display_settings); + + write_ibuf->planes = scene->r.im_format.planes; + write_ibuf->dither = scene->r.dither_intensity; + + if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) { BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path); } - ibuf->planes = imb_planes_back; - ibuf->dither = dither_back; + IMB_freeImBuf(write_ibuf); } BKE_image_release_ibuf(image, lock); @@ -118,6 +120,8 @@ static void rna_Image_save(Image *image, ReportList *reports) if (image->source == IMA_SRC_GENERATED) image->source = IMA_SRC_FILE; + IMB_colormanagment_colorspace_from_ibuf_ftype(&image->colorspace_settings, ibuf); + ibuf->userflags &= ~IB_BITMAPDIRTY; } else { |