From 85d9ba5cbb8d98acd13fd8fe294db00af5d3bdae Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 25 Oct 2012 15:25:28 +0000 Subject: Fix issue after commit 50282: float texture painting non-color data textures did not do correct partial updates, now it remembers if the opengl texture is a non-color data texture or not and takes that into account for the update. Also includes some renaming ncd => is_data for consistency with color space terminology used elsewhere. --- source/blender/imbuf/intern/divers.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'source/blender/imbuf/intern/divers.c') diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 95b085dc982..55c1b02e90b 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -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; -- cgit v1.2.3