diff options
Diffstat (limited to 'source')
17 files changed, 113 insertions, 110 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 1a8aa13d861..43845638754 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -462,7 +462,7 @@ void BKE_sequencer_imbuf_to_sequencer_space(Scene *scene, ImBuf *ibuf, int make_ if (!STREQ(float_colorspace, to_colorspace)) { IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels, - from_colorspace, to_colorspace, TRUE); + from_colorspace, to_colorspace, true); } } } @@ -477,7 +477,7 @@ void BKE_sequencer_imbuf_from_sequencer_space(Scene *scene, ImBuf *ibuf) if (to_colorspace && to_colorspace[0] != '\0') { IMB_colormanagement_transform_threaded(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels, - from_colorspace, to_colorspace, TRUE); + from_colorspace, to_colorspace, true); } } diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index 89a56af6b15..cface29fdca 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -141,7 +141,7 @@ static void sampleImageAtLocation(ImBuf *ibuf, float x, float y, PixelSampler sa } rgba_uchar_to_float(color, byte_color); if (make_linear_rgb) { - IMB_colormanagement_colorspace_to_scene_linear_v4(color, FALSE, ibuf->rect_colorspace); + IMB_colormanagement_colorspace_to_scene_linear_v4(color, false, ibuf->rect_colorspace); } } } diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 15e5ab947d4..d0eadc5c4d1 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -138,7 +138,7 @@ void OutputSingleLayerOperation::deinitExecution() ibuf->mall |= IB_rectfloat; ibuf->dither = this->m_rd->dither_intensity; - IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, m_viewSettings, m_displaySettings, + IMB_colormanagement_imbuf_for_write(ibuf, true, false, m_viewSettings, m_displaySettings, this->m_format); BKE_makepicstring(filename, this->m_path, bmain->name, this->m_rd->cfra, this->m_format, diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index e9f083178e4..468aec64a56 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -173,7 +173,7 @@ void ViewerOperation::updateImage(rcti *rect) { IMB_partial_display_buffer_update(this->m_ibuf, this->m_outputBuffer, NULL, getWidth(), 0, 0, this->m_viewSettings, this->m_displaySettings, - rect->xmin, rect->ymin, rect->xmax, rect->ymax, FALSE); + rect->xmin, rect->ymin, rect->xmax, rect->ymax, false); this->updateDraw(); } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index dc8bc2352d3..188e2b5624b 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -164,7 +164,7 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat IMB_partial_display_buffer_update(ibuf, rectf, NULL, rr->rectx, rxmin, rymin, &scene->view_settings, &scene->display_settings, - rxmin, rymin, rxmin + xmax, rymin + ymax, TRUE); + rxmin, rymin, rxmin + xmax, rymin + ymax, true); } /* ****************************** render invoking ***************** */ @@ -1137,7 +1137,7 @@ void render_view3d_draw(RenderEngine *engine, const bContext *C) /* Try using GLSL display transform. */ if (force_fallback == false) { - if (IMB_colormanagement_setup_glsl_draw(NULL, &scene->display_settings, TRUE, FALSE)) { + if (IMB_colormanagement_setup_glsl_draw(NULL, &scene->display_settings, true, false)) { glEnable(GL_BLEND); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glaDrawPixelsTex(rres.xof, rres.yof, rres.rectx, rres.recty, GL_RGBA, GL_FLOAT, diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index e21e889d99d..57416a59aa1 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -591,7 +591,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) ibuf_save = ibuf; if (is_movie || !BKE_imtype_requires_linear_float(scene->r.im_format.imtype)) { - ibuf_save = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings, + ibuf_save = IMB_colormanagement_imbuf_for_write(ibuf, true, true, &scene->view_settings, &scene->display_settings, &scene->r.im_format); needs_free = TRUE; diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 785c21481c5..13befeceee9 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -1092,17 +1092,17 @@ void glaDrawImBuf_glsl(ImBuf *ibuf, float x, float y, int zoomfilter, if (ibuf->float_colorspace) { ok = IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, ibuf->float_colorspace, - TRUE, FALSE); + true, false); } else { ok = IMB_colormanagement_setup_glsl_draw(view_settings, display_settings, - TRUE, FALSE); + true, false); } } else { ok = IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, ibuf->rect_colorspace, - FALSE, FALSE); + false, false); } if (ok) { @@ -1181,7 +1181,7 @@ int glaBufferTransformFromRole_glsl(float *buffer, int width, int height, int ro GPU_offscreen_bind(ofs); - if (!IMB_colormanagement_setup_transform_from_role_glsl(role, TRUE)) { + if (!IMB_colormanagement_setup_transform_from_role_glsl(role, true)) { GPU_offscreen_unbind(ofs); GPU_offscreen_free(ofs); return FALSE; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 43377d2bb90..dfada683dda 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3883,7 +3883,7 @@ static void *do_projectpaint_thread(void *ph_v) float mask = ((float)projPixel->mask) * (1.0f / 65535.0f); straight_uchar_to_premul_float(newColor_f, projPixel->newColor.ch); - IMB_colormanagement_colorspace_to_scene_linear_v4(newColor_f, TRUE, ps->reproject_ibuf->rect_colorspace); + IMB_colormanagement_colorspace_to_scene_linear_v4(newColor_f, true, ps->reproject_ibuf->rect_colorspace); mul_v4_v4fl(newColor_f, newColor_f, mask); blend_color_mix_float(projPixel->pixel.f_pt, projPixel->origColor.f, diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 301b7b99f38..6a3259e030e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1336,7 +1336,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI const char *relbase = ID_BLEND_PATH(CTX_data_main(C), &ima->id); const short relative = (RNA_struct_find_property(op->ptr, "relative_path") && RNA_boolean_get(op->ptr, "relative_path")); const short save_copy = (RNA_struct_find_property(op->ptr, "copy") && RNA_boolean_get(op->ptr, "copy")); - const short save_as_render = (RNA_struct_find_property(op->ptr, "save_as_render") && RNA_boolean_get(op->ptr, "save_as_render")); + const bool save_as_render = (RNA_struct_find_property(op->ptr, "save_as_render") && RNA_boolean_get(op->ptr, "save_as_render")); ImageFormatData *imf = &simopts->im_format; short ok = FALSE; @@ -1362,7 +1362,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI } } - colormanaged_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, save_as_render, TRUE, &imf->view_settings, &imf->display_settings, imf); + colormanaged_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, save_as_render, true, &imf->view_settings, &imf->display_settings, imf); if (simopts->im_format.imtype == R_IMF_IMTYPE_MULTILAYER) { Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 68fd09f5fb7..ebec818bb36 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1086,10 +1086,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq type = GL_FLOAT; if (ibuf->float_colorspace) { - glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->float_colorspace, TRUE); + glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->float_colorspace, true); } else { - glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, TRUE); + glsl_used = IMB_colormanagement_setup_glsl_draw_ctx(C, true); } } else if (ibuf->rect) { @@ -1097,7 +1097,7 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq format = GL_RGBA; type = GL_UNSIGNED_BYTE; - glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, FALSE); + glsl_used = IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, ibuf->rect_colorspace, false); } else { format = GL_RGBA; diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index e2def417b95..1f1fdedfa40 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -31,6 +31,8 @@ #ifndef __IMB_COLORMANAGEMENT_H__ #define __IMB_COLORMANAGEMENT_H__ +#include "BLI_sys_types.h" + #define BCM_CONFIG_FILE "config.ocio" struct bContext; @@ -67,17 +69,17 @@ const char *IMB_colormanagement_get_rect_colorspace(struct ImBuf *ibuf); /* ** Color space transformation functions ** */ void IMB_colormanagement_transform(float *buffer, int width, int height, int channels, - const char *from_colorspace, const char *to_colorspace, int predivide); + const char *from_colorspace, const char *to_colorspace, bool predivide); void IMB_colormanagement_transform_threaded(float *buffer, int width, int height, int channels, - const char *from_colorspace, const char *to_colorspace, int predivide); + const char *from_colorspace, const char *to_colorspace, bool predivide); void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace); void IMB_colormanagement_colorspace_to_scene_linear_v3(float pixel[3], struct ColorSpace *colorspace); -void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predivide, struct ColorSpace *colorspace); +void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, struct ColorSpace *colorspace); void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], struct ColorSpace *colorspace); -void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide); +void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, bool predivide); void IMB_colormanagement_scene_linear_to_display_v3(float pixel[3], struct ColorManagedDisplay *display); void IMB_colormanagement_display_to_scene_linear_v3(float pixel[3], struct ColorManagedDisplay *display); @@ -91,7 +93,7 @@ void IMB_colormanagement_pixel_to_display_space_v3(float result[3], const float void IMB_colormanagement_imbuf_make_display_space(struct ImBuf *ibuf, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings); -struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf, int save_as_render, int allocate_result, +struct ImBuf *IMB_colormanagement_imbuf_for_write(struct ImBuf *ibuf, bool save_as_render, bool allocate_result, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, struct ImageFormatData *image_format_data); @@ -113,7 +115,7 @@ unsigned char *IMB_display_buffer_acquire_ctx(const struct bContext *C, struct I void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *linear_buffer, int width, int height, int channels, const struct ColorManagedViewSettings *view_settings, - const struct ColorManagedDisplaySettings *display_settings, int predivide); + const struct ColorManagedDisplaySettings *display_settings, bool predivide); void IMB_display_buffer_release(void *cache_handle); @@ -145,7 +147,7 @@ void IMB_partial_display_buffer_update(struct ImBuf *ibuf, const float *linear_b int stride, int offset_x, int offset_y, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, int xmin, int ymin, int xmax, int ymax, - int update_orig_byte_buffer); + bool update_orig_byte_buffer); void IMB_partial_display_buffer_update_delayed(struct ImBuf *ibuf, int xmin, int ymin, int xmax, int ymax); @@ -157,34 +159,34 @@ void IMB_colormanagement_processor_apply_v4(struct ColormanageProcessor *cm_proc void IMB_colormanagement_processor_apply_v4_predivide(struct ColormanageProcessor *cm_processor, float pixel[4]); void IMB_colormanagement_processor_apply_v3(struct ColormanageProcessor *cm_processor, float pixel[3]); void IMB_colormanagement_processor_apply(struct ColormanageProcessor *cm_processor, float *buffer, int width, int height, - int channels, int predivide); + int channels, bool predivide); void IMB_colormanagement_processor_free(struct ColormanageProcessor *cm_processor); /* ** OpenGL drawing routines using GLSL for color space transform ** */ /* Test if GLSL drawing is supported for combination of graphics card and this configuration */ -int IMB_colormanagement_support_glsl_draw(const struct ColorManagedViewSettings *view_settings, - int skip_curves); +bool IMB_colormanagement_support_glsl_draw(const struct ColorManagedViewSettings *view_settings, + bool skip_curves); /* Configures GLSL shader for conversion from scene linear to display space */ -int IMB_colormanagement_setup_glsl_draw(const struct ColorManagedViewSettings *view_settings, - const struct ColorManagedDisplaySettings *display_settings, - int predivide, - int skip_curves); +bool IMB_colormanagement_setup_glsl_draw(const struct ColorManagedViewSettings *view_settings, + const struct ColorManagedDisplaySettings *display_settings, + bool predivide, + bool skip_curves); /* Same as above, but display space conversion happens from a specified space */ -int IMB_colormanagement_setup_glsl_draw_from_space(const struct ColorManagedViewSettings *view_settings, - const struct ColorManagedDisplaySettings *display_settings, - struct ColorSpace *colorspace, - int predivide, - int skip_curves); +bool IMB_colormanagement_setup_glsl_draw_from_space(const struct ColorManagedViewSettings *view_settings, + const struct ColorManagedDisplaySettings *display_settings, + struct ColorSpace *colorspace, + bool predivide, + bool skip_curves); /* Same as setup_glsl_draw, but color management settings are guessing from a given context */ -int IMB_colormanagement_setup_glsl_draw_ctx(const struct bContext *C, int predivide); +bool IMB_colormanagement_setup_glsl_draw_ctx(const struct bContext *C, bool predivide); /* Same as setup_glsl_draw_from_space, but color management settings are guessing from a given context */ -int IMB_colormanagement_setup_glsl_draw_from_space_ctx(const struct bContext *C, struct ColorSpace *colorspace, int predivide); +bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const struct bContext *C, struct ColorSpace *colorspace, bool predivide); /* Finish GLSL-based display space conversion */ void IMB_colormanagement_finish_glsl_draw(void); /* Configures GLSL shader for conversion from space defined by role to scene linear space */ -int IMB_colormanagement_setup_transform_from_role_glsl(int role, int predivide); +bool IMB_colormanagement_setup_transform_from_role_glsl(int role, bool predivide); /* Finish GLSL-based color space conversion */ void IMB_colormanagement_finish_glsl_transform(void); diff --git a/source/blender/imbuf/intern/IMB_colormanagement_intern.h b/source/blender/imbuf/intern/IMB_colormanagement_intern.h index db9345d2e1e..3e201a2fc28 100644 --- a/source/blender/imbuf/intern/IMB_colormanagement_intern.h +++ b/source/blender/imbuf/intern/IMB_colormanagement_intern.h @@ -32,6 +32,7 @@ #define __IMB_COLORMANAGEMENT_INTERN_H__ #include "DNA_listBase.h" +#include "BLI_sys_types.h" struct OCIO_ConstProcessorRcPtr; struct ImBuf; @@ -48,8 +49,8 @@ typedef struct ColorSpace { struct OCIO_ConstProcessorRcPtr *to_scene_linear; struct OCIO_ConstProcessorRcPtr *from_scene_linear; - int is_invertible; - int is_data; + bool is_invertible; + bool is_data; } ColorSpace; typedef struct ColorManagedDisplay { @@ -87,7 +88,7 @@ struct ColorManagedView *colormanage_view_add(const char *name); struct ColorManagedView *colormanage_view_get_indexed(int index); struct ColorManagedView *colormanage_view_get_named(const char *name); -struct ColorSpace *colormanage_colorspace_add(const char *name, const char *description, int is_invertible, int is_data); +struct ColorSpace *colormanage_colorspace_add(const char *name, const char *description, bool is_invertible, bool is_data); struct ColorSpace *colormanage_colorspace_get_named(const char *name); struct ColorSpace *colormanage_colorspace_get_roled(int role); struct ColorSpace *colormanage_colorspace_get_indexed(int index); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 7c3a19a1ff1..a466074d06f 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -99,7 +99,7 @@ static pthread_mutex_t processor_lock = BLI_MUTEX_INITIALIZER; typedef struct ColormanageProcessor { OCIO_ConstProcessorRcPtr *processor; CurveMapping *curve_mapping; - int is_data_result; + bool is_data_result; } ColormanageProcessor; static struct global_glsl_state { @@ -470,7 +470,7 @@ static void colormanage_load_config(OCIO_ConstConfigRcPtr *config) for (index = 0 ; index < tot_colorspace; index++) { OCIO_ConstColorSpaceRcPtr *ocio_colorspace; const char *description; - int is_invertible, is_data; + bool is_invertible, is_data; name = OCIO_configGetColorSpaceNameByIndex(config, index); @@ -923,7 +923,7 @@ void colormanage_imbuf_make_linear(ImBuf *ibuf, const char *from_colorspace) imb_freerectImBuf(ibuf); IMB_colormanagement_transform(ibuf->rect_float, ibuf->x, ibuf->y, ibuf->channels, - from_colorspace, to_colorspace, TRUE); + from_colorspace, to_colorspace, true); } } @@ -1166,7 +1166,7 @@ typedef struct DisplayBufferThread { int channels; float dither; - int is_data; + bool is_data; const char *byte_colorspace; const char *float_colorspace; @@ -1195,7 +1195,7 @@ static void display_buffer_init_handle(void *handle_v, int start_line, int tot_l int channels = ibuf->channels; float dither = ibuf->dither; - int is_data = ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA; + bool is_data = (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) != 0; int offset = channels * start_line * ibuf->x; int display_buffer_byte_offset = DISPLAY_BUFFER_CHANNELS * start_line * ibuf->x; @@ -1239,8 +1239,8 @@ static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle int buffer_size = channels * width * height; - int is_data = handle->is_data; - int is_data_display = handle->cm_processor->is_data_result; + bool is_data = handle->is_data; + bool is_data_display = handle->cm_processor->is_data_result; linear_buffer = MEM_callocN(buffer_size * sizeof(float), "color conversion linear buffer"); @@ -1273,7 +1273,7 @@ static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle if (!is_data && !is_data_display) { /* convert float buffer to scene linear space */ IMB_colormanagement_transform(linear_buffer, width, height, channels, - from_colorspace, to_colorspace, FALSE); + from_colorspace, to_colorspace, false); } *is_straight_alpha = true; @@ -1292,7 +1292,7 @@ static float *display_buffer_apply_get_linear_buffer(DisplayBufferThread *handle if (!is_data && !is_data_display) { IMB_colormanagement_transform(linear_buffer, width, height, channels, - from_colorspace, to_colorspace, TRUE); + from_colorspace, to_colorspace, true); } *is_straight_alpha = false; @@ -1325,7 +1325,7 @@ static void *do_display_buffer_apply_thread(void *handle_v) int width = handle->width; int height = handle->tot_line; float dither = handle->dither; - int is_data = handle->is_data; + bool is_data = handle->is_data; if (cm_processor == NULL) { if (display_buffer_byte) { @@ -1418,8 +1418,8 @@ static void display_buffer_apply_threaded(ImBuf *ibuf, float *buffer, unsigned c display_buffer_init_handle, do_display_buffer_apply_thread); } -static int is_ibuf_rect_in_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings) +static bool is_ibuf_rect_in_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings) { if ((view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) == 0 && view_settings->exposure == 0.0f && @@ -1429,10 +1429,10 @@ static int is_ibuf_rect_in_display_space(ImBuf *ibuf, const ColorManagedViewSett const char *to_colorspace = display_transform_get_colorspace_name(view_settings, display_settings); if (to_colorspace && !strcmp(from_colorspace, to_colorspace)) - return TRUE; + return true; } - return FALSE; + return false; } static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_buffer, unsigned char *display_buffer_byte, @@ -1440,7 +1440,7 @@ static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_bu const ColorManagedDisplaySettings *display_settings) { ColormanageProcessor *cm_processor = NULL; - int skip_transform = FALSE; + bool skip_transform = false; /* if we're going to transform byte buffer, check whether transformation would * happen to the same color space as byte buffer itself is @@ -1451,7 +1451,7 @@ static void colormanage_display_buffer_process_ex(ImBuf *ibuf, float *display_bu skip_transform = is_ibuf_rect_in_display_space(ibuf, view_settings, display_settings); } - if (skip_transform == FALSE) + if (skip_transform == false) cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings); display_buffer_apply_threaded(ibuf, ibuf->rect_float, (unsigned char *) ibuf->rect, @@ -1477,7 +1477,7 @@ typedef struct ProcessorTransformThread { int start_line; int tot_line; int channels; - int predivide; + bool predivide; } ProcessorTransformThread; typedef struct ProcessorTransformInit { @@ -1486,7 +1486,7 @@ typedef struct ProcessorTransformInit { int width; int height; int channels; - int predivide; + bool predivide; } ProcessorTransformInitData; static void processor_transform_init_handle(void *handle_v, int start_line, int tot_line, void *init_data_v) @@ -1496,7 +1496,7 @@ static void processor_transform_init_handle(void *handle_v, int start_line, int int channels = init_data->channels; int width = init_data->width; - int predivide = init_data->predivide; + bool predivide = init_data->predivide; int offset = channels * start_line * width; @@ -1522,7 +1522,7 @@ static void *do_processor_transform_thread(void *handle_v) int channels = handle->channels; int width = handle->width; int height = handle->tot_line; - int predivide = handle->predivide; + bool predivide = handle->predivide; IMB_colormanagement_processor_apply(handle->cm_processor, buffer, width, height, channels, predivide); @@ -1530,7 +1530,7 @@ static void *do_processor_transform_thread(void *handle_v) } static void processor_transform_apply_threaded(float *buffer, int width, int height, int channels, - ColormanageProcessor *cm_processor, int predivide) + ColormanageProcessor *cm_processor, bool predivide) { ProcessorTransformInitData init_data; @@ -1549,7 +1549,7 @@ static void processor_transform_apply_threaded(float *buffer, int width, int hei /* convert the whole buffer from specified by name color space to another - internal implementation */ static void colormanagement_transform_ex(float *buffer, int width, int height, int channels, const char *from_colorspace, - const char *to_colorspace, int predivide, int do_threaded) + const char *to_colorspace, bool predivide, bool do_threaded) { ColormanageProcessor *cm_processor; @@ -1576,18 +1576,18 @@ static void colormanagement_transform_ex(float *buffer, int width, int height, i /* convert the whole buffer from specified by name color space to another */ void IMB_colormanagement_transform(float *buffer, int width, int height, int channels, - const char *from_colorspace, const char *to_colorspace, int predivide) + const char *from_colorspace, const char *to_colorspace, bool predivide) { - colormanagement_transform_ex(buffer, width, height, channels, from_colorspace, to_colorspace, predivide, FALSE); + colormanagement_transform_ex(buffer, width, height, channels, from_colorspace, to_colorspace, predivide, false); } /* convert the whole buffer from specified by name color space to another * will do threaded conversion */ void IMB_colormanagement_transform_threaded(float *buffer, int width, int height, int channels, - const char *from_colorspace, const char *to_colorspace, int predivide) + const char *from_colorspace, const char *to_colorspace, bool predivide) { - colormanagement_transform_ex(buffer, width, height, channels, from_colorspace, to_colorspace, predivide, TRUE); + colormanagement_transform_ex(buffer, width, height, channels, from_colorspace, to_colorspace, predivide, true); } void IMB_colormanagement_transform_v4(float pixel[4], const char *from_colorspace, const char *to_colorspace) @@ -1648,7 +1648,7 @@ void IMB_colormanagement_scene_linear_to_colorspace_v3(float pixel[3], ColorSpac OCIO_processorApplyRGB(processor, pixel); } -void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predivide, ColorSpace *colorspace) +void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], bool predivide, ColorSpace *colorspace) { OCIO_ConstProcessorRcPtr *processor; @@ -1668,7 +1668,7 @@ void IMB_colormanagement_colorspace_to_scene_linear_v4(float pixel[4], int predi } } -void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, int predivide) +void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, int width, int height, int channels, struct ColorSpace *colorspace, bool predivide) { OCIO_ConstProcessorRcPtr *processor; @@ -1747,7 +1747,7 @@ void IMB_colormanagement_pixel_to_display_space_v3(float result[3], const float } static void colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings, int make_byte) + const ColorManagedDisplaySettings *display_settings, bool make_byte) { if (!ibuf->rect && make_byte) imb_addrectImBuf(ibuf); @@ -1765,7 +1765,7 @@ static void colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorMan void IMB_colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings) { - colormanagement_imbuf_make_display_space(ibuf, view_settings, display_settings, FALSE); + colormanagement_imbuf_make_display_space(ibuf, view_settings, display_settings, false); } /* prepare image buffer to be saved on disk, applying color management if needed @@ -1779,14 +1779,14 @@ void IMB_colormanagement_imbuf_make_display_space(ImBuf *ibuf, const ColorManage * in image format write callback and if float_colorspace is not NULL, no color * space transformation should be applied on this buffer. */ -ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int allocate_result, const ColorManagedViewSettings *view_settings, +ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, bool save_as_render, bool allocate_result, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, ImageFormatData *image_format_data) { ImBuf *colormanaged_ibuf = ibuf; - int do_colormanagement; + bool do_colormanagement; bool is_movie = BKE_imtype_is_movie(image_format_data->imtype); - int requires_linear_float = BKE_imtype_requires_linear_float(image_format_data->imtype); - int do_alpha_under = image_format_data->planes != R_IMF_PLANES_RGBA; + bool requires_linear_float = BKE_imtype_requires_linear_float(image_format_data->imtype); + bool do_alpha_under = image_format_data->planes != R_IMF_PLANES_RGBA; do_colormanagement = save_as_render && (is_movie || !requires_linear_float); @@ -1842,7 +1842,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int } if (do_colormanagement) { - int make_byte = FALSE; + bool make_byte = false; ImFileType *type; /* for proper check whether byte buffer is required by a format or not @@ -1858,7 +1858,7 @@ ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf, int save_as_render, int for (type = IMB_FILE_TYPES; type->is_a; type++) { if (type->save && type->ftype(type, colormanaged_ibuf)) { if ((type->flag & IM_FTYPE_FLOAT) == 0) - make_byte = TRUE; + make_byte = true; break; } @@ -1893,7 +1893,7 @@ void IMB_colormanagement_buffer_make_display_space(float *buffer, unsigned char cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings); processor_transform_apply_threaded(display_buffer_float, width, height, channels, - cm_processor, TRUE); + cm_processor, true); IMB_buffer_byte_from_float(display_buffer, display_buffer_float, channels, dither, IB_PROFILE_SRGB, IB_PROFILE_SRGB, @@ -1979,7 +1979,7 @@ unsigned char *IMB_display_buffer_acquire(ImBuf *ibuf, const ColorManagedViewSet 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); + false); } BLI_rcti_init(&ibuf->invalid_rect, 0, 0, 0, 0); @@ -2034,7 +2034,7 @@ unsigned char *IMB_display_buffer_acquire_ctx(const bContext *C, ImBuf *ibuf, vo void IMB_display_buffer_transform_apply(unsigned char *display_buffer, float *linear_buffer, int width, int height, int channels, const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings, int predivide) + const ColorManagedDisplaySettings *display_settings, bool predivide) { if (global_tot_display == 0 || global_tot_view == 0) { IMB_buffer_byte_from_float(display_buffer, linear_buffer, channels, 0.0f, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, FALSE, @@ -2296,7 +2296,7 @@ static void colormanage_description_strip(char *description) } } -ColorSpace *colormanage_colorspace_add(const char *name, const char *description, int is_invertible, int is_data) +ColorSpace *colormanage_colorspace_add(const char *name, const char *description, bool is_invertible, bool is_data) { ColorSpace *colorspace, *prev_space; int counter = 1; @@ -2495,7 +2495,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe float *display_buffer_float = NULL; const int width = xmax - xmin; const int height = ymax - ymin; - int is_data = ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA; + bool is_data = (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) != 0; if (dither != 0.0f) { /* cm_processor is NULL in cases byte_buffer's space matches display @@ -2576,7 +2576,7 @@ static void partial_buffer_update_rect(ImBuf *ibuf, unsigned char *display_buffe void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer, const unsigned char *byte_buffer, int stride, int offset_x, int offset_y, const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, - int xmin, int ymin, int xmax, int ymax, int update_orig_byte_buffer) + int xmin, int ymin, int xmax, int ymax, bool update_orig_byte_buffer) { if ((ibuf->rect && ibuf->rect_float) || update_orig_byte_buffer) { /* update byte buffer created by legacy color management */ @@ -2623,7 +2623,7 @@ void IMB_partial_display_buffer_update(ImBuf *ibuf, const float *linear_buffer, if (display_buffer) { ColormanageProcessor *cm_processor = NULL; - int skip_transform = 0; + bool skip_transform = false; /* byte buffer is assumed to be in imbuf's rect space, so if byte buffer * is known we could skip display->linear->display conversion in case @@ -2688,7 +2688,7 @@ ColormanageProcessor *IMB_colormanagement_display_processor_new(const ColorManag if (applied_view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) { cm_processor->curve_mapping = curvemapping_copy(applied_view_settings->curve_mapping); - curvemapping_premultiply(cm_processor->curve_mapping, FALSE); + curvemapping_premultiply(cm_processor->curve_mapping, false); } return cm_processor; @@ -2737,7 +2737,7 @@ void IMB_colormanagement_processor_apply_v3(ColormanageProcessor *cm_processor, } void IMB_colormanagement_processor_apply(ColormanageProcessor *cm_processor, float *buffer, int width, int height, - int channels, int predivide) + int channels, bool predivide) { /* apply curve mapping */ if (cm_processor->curve_mapping) { @@ -2822,8 +2822,8 @@ static void update_glsl_display_processor(const ColorManagedViewSettings *view_s } } -int IMB_colormanagement_support_glsl_draw(const ColorManagedViewSettings *view_settings, - int skip_curves) +bool IMB_colormanagement_support_glsl_draw(const ColorManagedViewSettings *view_settings, + bool skip_curves) { /* curves not supported yet */ if (!skip_curves) @@ -2846,10 +2846,10 @@ int IMB_colormanagement_support_glsl_draw(const ColorManagedViewSettings *view_s * This is low-level function, use glaDrawImBuf_glsl_ctx if you * only need to display given image buffer */ -int IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings, - struct ColorSpace *from_colorspace, int predivide, - int skip_curves) +bool IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + struct ColorSpace *from_colorspace, bool predivide, + bool skip_curves) { ColorManagedViewSettings default_view_settings; const ColorManagedViewSettings *applied_view_settings; @@ -2869,7 +2869,7 @@ int IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSetting /* RGB curves mapping is not supported on GPU yet. */ if (!skip_curves) if (applied_view_settings->flag & COLORMANAGE_VIEW_USE_CURVES) - return FALSE; + return false; /* Make sure OCIO processor is up-to-date. */ update_glsl_display_processor(applied_view_settings, display_settings, @@ -2879,27 +2879,27 @@ int IMB_colormanagement_setup_glsl_draw_from_space(const ColorManagedViewSetting } /* Configures GLSL shader for conversion from scene linear to display space */ -int IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_settings, - const ColorManagedDisplaySettings *display_settings, - int predivide, int skip_curves) +bool IMB_colormanagement_setup_glsl_draw(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + bool predivide, bool skip_curves) { return IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, NULL, predivide, skip_curves); } /* Same as setup_glsl_draw_from_space, but color management settings are guessing from a given context */ -int IMB_colormanagement_setup_glsl_draw_from_space_ctx(const struct bContext *C, struct ColorSpace *from_colorspace, int predivide) +bool IMB_colormanagement_setup_glsl_draw_from_space_ctx(const struct bContext *C, struct ColorSpace *from_colorspace, bool predivide) { ColorManagedViewSettings *view_settings; ColorManagedDisplaySettings *display_settings; IMB_colormanagement_display_settings_from_ctx(C, &view_settings, &display_settings); - return IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, from_colorspace, predivide, FALSE); + return IMB_colormanagement_setup_glsl_draw_from_space(view_settings, display_settings, from_colorspace, predivide, false); } /* Same as setup_glsl_draw, but color management settings are guessing from a given context */ -int IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, int predivide) +bool IMB_colormanagement_setup_glsl_draw_ctx(const bContext *C, bool predivide) { return IMB_colormanagement_setup_glsl_draw_from_space_ctx(C, NULL, predivide); } @@ -2925,7 +2925,7 @@ void IMB_colormanagement_finish_glsl_draw(void) * When there's no need to apply transform on 2D textures, use * IMB_colormanagement_finish_glsl_transform(). */ -int IMB_colormanagement_setup_transform_from_role_glsl(int role, int predivide) +bool IMB_colormanagement_setup_transform_from_role_glsl(int role, bool predivide) { OCIO_ConstProcessorRcPtr *processor; ColorSpace *colorspace; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 76a5e98da7e..af9f7109106 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -565,7 +565,7 @@ void IMB_rect_from_float(ImBuf *ibuf) buffer = MEM_dupallocN(ibuf->rect_float); /* first make float buffer in byte space */ - IMB_colormanagement_transform(buffer, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, ibuf->rect_colorspace->name, TRUE); + IMB_colormanagement_transform(buffer, ibuf->x, ibuf->y, ibuf->channels, from_colorspace, ibuf->rect_colorspace->name, true); /* convert from float's premul alpha to byte's straight alpha */ IMB_unpremultiply_rect_float(buffer, ibuf->planes, ibuf->x, ibuf->y); @@ -657,7 +657,7 @@ void IMB_float_from_rect(ImBuf *ibuf) /* then make float be in linear space */ IMB_colormanagement_colorspace_to_scene_linear(rect_float, ibuf->x, ibuf->y, ibuf->channels, - ibuf->rect_colorspace, FALSE); + ibuf->rect_colorspace, false); /* byte buffer is straight alpha, float should always be premul */ IMB_premultiply_rect_float(rect_float, ibuf->channels, ibuf->x, ibuf->y); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index c1769f02974..f0322bac756 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -87,7 +87,7 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports else { ImBuf *write_ibuf; - write_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, TRUE, TRUE, &scene->view_settings, + write_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, true, true, &scene->view_settings, &scene->display_settings, &scene->r.im_format); write_ibuf->planes = scene->r.im_format.planes; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 00c31cce39f..8ac69b101f4 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2542,7 +2542,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie } - IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, + IMB_colormanagement_imbuf_for_write(ibuf, true, false, &scene->view_settings, &scene->display_settings, &scene->r.im_format); ok = mh->append_movie(&re->r, scene->r.sfra, scene->r.cfra, (int *) ibuf->rect, @@ -2573,7 +2573,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie else { ImBuf *ibuf = render_result_rect_to_ibuf(&rres, &scene->r); - IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, + IMB_colormanagement_imbuf_for_write(ibuf, true, false, &scene->view_settings, &scene->display_settings, &scene->r.im_format); ok = BKE_imbuf_write_stamp(scene, camera, ibuf, name, &scene->r.im_format); @@ -2593,7 +2593,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie BKE_add_image_extension(name, &imf); ibuf->planes = 24; - IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, + IMB_colormanagement_imbuf_for_write(ibuf, true, false, &scene->view_settings, &scene->display_settings, &imf); BKE_imbuf_write_stamp(scene, camera, ibuf, name, &imf); @@ -2935,7 +2935,7 @@ int RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env, return 0; } - IMB_colormanagement_imbuf_for_write(ibuf, TRUE, FALSE, &scene->view_settings, &scene->display_settings, &imf); + IMB_colormanagement_imbuf_for_write(ibuf, true, false, &scene->view_settings, &scene->display_settings, &imf); /* to save, we first get absolute path */ BLI_strncpy(filepath, relpath, sizeof(filepath)); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 1f740e3f483..37587d89ce0 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -1191,7 +1191,7 @@ void render_result_rect_get_pixels(RenderResult *rr, unsigned int *rect, int rec } else if (rr->rectf) { IMB_display_buffer_transform_apply((unsigned char *) rect, rr->rectf, rr->rectx, rr->recty, 4, - view_settings, display_settings, TRUE); + view_settings, display_settings, true); } else /* else fill with black */ |