diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-11 17:24:35 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-02-11 17:24:35 +0400 |
commit | 7fcc1ac48b405f8f6ef0ab7b7cd3dba1f5c6b24d (patch) | |
tree | 0240cceba1b492da7c3712d56fab6803124fb306 /source/blender/imbuf/intern/colormanagement.c | |
parent | 30a18589e20206cee8ec5d7e54fcdce82feb09a7 (diff) |
Implemented delayed partial rect update for image buffers
Used by image painting mode, so every brush step would mark area
if affected on, but actual color space conversion would happen
later when actually displaying image.
Implemented as a rcti stored in ImBuf which is getting merged with
partial rect passed to IMB_partial_display_buffer_update_delayed.
This makes painting as fast as it currently possible and finally
solves #33935: Texture painting slow down with mouse, but not with tablet
Diffstat (limited to 'source/blender/imbuf/intern/colormanagement.c')
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index a516812eb53..ff297d70cc3 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -57,6 +57,7 @@ #include "BLI_path_util.h" #include "BLI_string.h" #include "BLI_threads.h" +#include "BLI_rect.h" #include "BKE_colortools.h" #include "BKE_context.h" @@ -1823,6 +1824,18 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet colormanage_view_settings_to_cache(&cache_view_settings, applied_view_settings); colormanage_display_settings_to_cache(&cache_display_settings, display_settings); + if (ibuf->invalid_rect.xmin != ibuf->invalid_rect.xmax) { + if ((ibuf->userflags & IB_DISPLAY_BUFFER_INVALID) == 0) { + IMB_partial_display_buffer_update(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect, + ibuf->x, 0, 0, applied_view_settings, display_settings, + ibuf->invalid_rect.xmin, ibuf->invalid_rect.ymin, + ibuf->invalid_rect.xmax, ibuf->invalid_rect.ymax, + FALSE); + } + + BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0); + } + BLI_lock_thread(LOCK_COLORMANAGE); /* ensure color management bit fields exists */ @@ -2488,6 +2501,18 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer, } } +void IMB_partial_display_buffer_update_delayed(ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax) +{ + if (ibuf->invalid_rect.xmin == ibuf->invalid_rect.xmax) { + BLI_rcti_init(&ibuf->invalid_rect, xmin, xmax, ymin, ymax); + } + else { + rcti rect; + BLI_rcti_init(&rect, xmin, xmax, ymin, ymax); + BLI_rcti_union(&ibuf->invalid_rect, &rect); + } +} + /*********************** Pixel processor functions *************************/ ColormanageProcessor *IMB_colormanagement_display_processor_new(const ColorManagedViewSettings *view_settings, |