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>2013-12-19 15:17:40 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-12-19 15:20:12 +0400
commitb0c4133c67ce5fca7c3aa5abbd5a745c3d812525 (patch)
tree0c2374259ba7dc9033ffceb16bd7872c0142ab35 /source/blender
parent01745d359eda2f81f25aa23d76000af9e58f761b (diff)
Followup for fix T37718: image was not saving with proper settings second time
This was actually a regression after color management re-implementation, need to copy settings from saved image buffer to an original one since they might be modified during save. Also noticed image format planes detection didn't work properly from an image buffer. Made it so save operator works fine now, but also marked a TODO in BKE_imbuf_to_image_format() which needs to be investigated further.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/image.c6
-rw-r--r--source/blender/editors/space_image/image_ops.c15
2 files changed, 18 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 74e32d9f53c..3d59b719ca0 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1497,6 +1497,12 @@ void BKE_imbuf_to_image_format(struct ImageFormatData *im_format, const ImBuf *i
}
/* planes */
+ /* TODO(sergey): Channels doesn't correspond actual planes used for image buffer
+ * For example byte buffer will have 4 channels but it might easily
+ * be BW or RGB image.
+ *
+ * Need to use im_format->planes = imbuf->planes instead?
+ */
switch (imbuf->channels) {
case 0:
case 4: im_format->planes = R_IMF_PLANES_RGBA;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index a2f49af1730..7120a699f02 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1233,8 +1233,6 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
Image *ima = sima->image;
short is_depth_set = FALSE;
- simopts->im_format.planes = ibuf->planes;
-
if (ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
/* imtype */
simopts->im_format = scene->r.im_format;
@@ -1250,6 +1248,9 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
}
simopts->im_format.quality = ibuf->ftype & 0xff;
}
+
+ simopts->im_format.planes = ibuf->planes;
+
//simopts->subimtype = scene->r.subimtype; /* XXX - this is lame, we need to make these available too! */
BLI_strncpy(simopts->filepath, ibuf->name, sizeof(simopts->filepath));
@@ -1430,8 +1431,16 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
WM_cursor_wait(0);
- if (colormanaged_ibuf != ibuf)
+ if (colormanaged_ibuf != ibuf) {
+ /* This guys might be modified by image buffer write functions,
+ * need to copy them back from color managed image buffer to an
+ * original one, so file type of image is being properly updated.
+ */
+ ibuf->ftype = colormanaged_ibuf->ftype;
+ ibuf->planes = colormanaged_ibuf->planes;
+
IMB_freeImBuf(colormanaged_ibuf);
+ }
}
ED_space_image_release_buffer(sima, ibuf, lock);