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:
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r--source/blender/imbuf/intern/divers.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index aa236af3507..8d289de9970 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -62,7 +62,7 @@ void IMB_de_interlace(ImBuf *ibuf)
tbuf1 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
tbuf2 = IMB_allocImBuf(ibuf->x, ibuf->y / 2, 32, IB_rect);
- ibuf->x *= 2;
+ ibuf->x *= 2;
IMB_rectcpy(tbuf1, ibuf, 0, 0, 0, 0, ibuf->x, ibuf->y);
IMB_rectcpy(tbuf2, ibuf, 0, 0, tbuf2->x, 0, ibuf->x, ibuf->y);
@@ -561,7 +561,7 @@ void IMB_rect_from_float(ImBuf *ibuf)
}
/* converts from linear float to sRGB byte for part of the texture, buffer will hold the changed part */
-void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h)
+void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w, int h, int is_data)
{
float *rect_float;
uchar *rect_byte;
@@ -580,14 +580,27 @@ void IMB_partial_rect_from_float(ImBuf *ibuf, float *buffer, int x, int y, int w
rect_float = ibuf->rect_float + (x + y * ibuf->x) * ibuf->channels;
rect_byte = (uchar *)ibuf->rect + (x + y * ibuf->x) * 4;
- IMB_buffer_float_from_float(buffer, rect_float,
- ibuf->channels, IB_PROFILE_SRGB, profile_from, predivide,
- w, h, w, ibuf->x);
+ if (is_data) {
+ /* exception for non-color data, just copy float */
+ IMB_buffer_float_from_float(buffer, rect_float,
+ ibuf->channels, IB_PROFILE_LINEAR_RGB, IB_PROFILE_LINEAR_RGB, 0,
+ w, h, w, ibuf->x);
- /* XXX: need to convert to image buffer's rect space */
- IMB_buffer_byte_from_float(rect_byte, buffer,
- 4, ibuf->dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB, 0,
- w, h, ibuf->x, w);
+ /* and do color space conversion to byte */
+ IMB_buffer_byte_from_float(rect_byte, rect_float,
+ 4, ibuf->dither, IB_PROFILE_SRGB, profile_from, predivide,
+ w, h, ibuf->x, w);
+ }
+ else {
+ IMB_buffer_float_from_float(buffer, rect_float,
+ ibuf->channels, IB_PROFILE_SRGB, profile_from, predivide,
+ w, h, w, ibuf->x);
+
+ /* XXX: need to convert to image buffer's rect space */
+ IMB_buffer_byte_from_float(rect_byte, buffer,
+ 4, ibuf->dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB, 0,
+ w, h, ibuf->x, w);
+ }
/* ensure user flag is reset */
ibuf->userflags &= ~IB_RECT_INVALID;
@@ -710,7 +723,7 @@ void IMB_buffer_float_clamp(float *buf, int width, int height)
{
int i, total = width * height * 4;
for (i = 0; i < total; i++) {
- buf[i] = minf(1.0, buf[i]);
+ buf[i] = min_ff(1.0, buf[i]);
}
}