diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-10-25 19:25:28 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-10-25 19:25:28 +0400 |
commit | 85d9ba5cbb8d98acd13fd8fe294db00af5d3bdae (patch) | |
tree | 8d8d22578034d0123ab655a329b7f4dfd5e962e6 /source/blender/imbuf/intern | |
parent | e0a4ca00ac289152b5b9dd125cad514d2cd7bbdd (diff) |
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.
Diffstat (limited to 'source/blender/imbuf/intern')
-rw-r--r-- | source/blender/imbuf/intern/divers.c | 29 |
1 files changed, 21 insertions, 8 deletions
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; |