diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-17 17:20:33 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-17 17:20:33 +0300 |
commit | dd38dce7f0ae604396d1e96bc49500369fdedf29 (patch) | |
tree | 2b32e776f0bb972705d2c884cb6d5ec77deaf714 /source/blender/editors | |
parent | 42aac45d7f0e0f43725093e97ebb8175a95aa247 (diff) |
Part 2 of D1082 by Troy Sobotka, remove our functions that do luma
calculations and use the OCIO one instead.
Diffstat (limited to 'source/blender/editors')
7 files changed, 15 insertions, 12 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 07d580b9138..414903fa194 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1453,7 +1453,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti glEnd(); } else if (cumap->cur == 3) { - float lum = rgb_to_bw(cumap->sample); + float lum = IMB_colormanagement_get_luminance(cumap->sample); glColor3ub(240, 240, 240); glBegin(GL_LINES); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index 6e5f6af3c5f..adcd615368b 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -237,8 +237,8 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) /* find the brightness difference between background and text colors */ - tone_bg = rgb_to_grayscale(background_color); - /* tone_fg = rgb_to_grayscale(main_color); */ + tone_bg = IMB_colormanagement_get_luminance(background_color); + /* tone_fg = IMB_colormanagement_get_luminance(main_color); */ /* mix the colors */ rgb_tint(value_color, 0.0f, 0.0f, tone_bg, 0.2f); /* light grey */ @@ -261,7 +261,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) /* override text-style */ fstyle_header.shadow = 1; - fstyle_header.shadowcolor = rgb_to_luma(tip_colors[UI_TIP_LC_MAIN]); + fstyle_header.shadowcolor = IMB_colormanagement_get_luminance(tip_colors[UI_TIP_LC_MAIN]); fstyle_header.shadx = fstyle_header.shady = 0; fstyle_header.shadowalpha = 1.0f; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 91186a14b49..9020522bb59 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -56,6 +56,7 @@ #include "UI_interface.h" #include "UI_interface_icons.h" +#include "IMB_colormanagement.h" #include "interface_intern.h" @@ -3027,7 +3028,7 @@ static void widget_swatch(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat float width = rect->xmax - rect->xmin; float height = rect->ymax - rect->ymin; /* find color luminance and change it slightly */ - float bw = rgb_to_bw(col); + float bw = IMB_colormanagement_get_luminance(col); bw += (bw < 0.5f) ? 0.5f : -0.5f; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index eb96d1d20d5..4f71bea7cd2 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -889,7 +889,7 @@ static void paint_2d_lift_soften(ImagePaintState *s, ImBuf *ibuf, ImBuf *ibufb, /* now rgba_ub contains the edge result, but this should be converted to luminance to avoid * colored speckles appearing in final image, and also to check for threshold */ - outrgb[0] = outrgb[1] = outrgb[2] = rgb_to_grayscale(outrgb); + outrgb[0] = outrgb[1] = outrgb[2] = IMB_colormanagement_get_luminance(outrgb); if (fabsf(outrgb[0]) > threshold) { float mask = BKE_brush_alpha_get(s->scene, s->brush); float alpha = rgba[3]; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 098f0d04d78..805c271f2d1 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4207,7 +4207,7 @@ static void do_projectpaint_soften_f(ProjPaintState *ps, ProjPixel *projPixel, f /* now rgba_ub contains the edge result, but this should be converted to luminance to avoid * colored speckles appearing in final image, and also to check for threshold */ - rgba[0] = rgba[1] = rgba[2] = rgb_to_grayscale(rgba); + rgba[0] = rgba[1] = rgba[2] = IMB_colormanagement_get_luminance(rgba); if (fabsf(rgba[0]) > ps->brush->sharp_threshold) { float alpha = projPixel->pixel.f_pt[3]; projPixel->pixel.f_pt[3] = rgba[3] = mask; @@ -4268,7 +4268,7 @@ static void do_projectpaint_soften(ProjPaintState *ps, ProjPixel *projPixel, flo sub_v3_v3v3(rgba, rgba_pixel, rgba); /* now rgba_ub contains the edge result, but this should be converted to luminance to avoid * colored speckles appearing in final image, and also to check for threshold */ - rgba[0] = rgba[1] = rgba[2] = rgb_to_grayscale(rgba); + rgba[0] = rgba[1] = rgba[2] = IMB_colormanagement_get_luminance(rgba); if (fabsf(rgba[0]) > ps->brush->sharp_threshold) { float alpha = rgba_pixel[3]; rgba[3] = rgba_pixel[3] = mask; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index e87dd6c2810..9bca0fd2976 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -37,6 +37,7 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +#include "IMB_colormanagement.h" #include "DNA_armature_types.h" #include "DNA_mesh_types.h" @@ -768,7 +769,7 @@ BLI_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int f /* See if are lighter, if so mix, else don't do anything. * if the paint col is darker then the original, then ignore */ - if (rgb_to_grayscale_byte(cp1) > rgb_to_grayscale_byte(cp2)) { + if (IMB_colormanagement_get_luminance_byte(cp1) > IMB_colormanagement_get_luminance_byte(cp2)) { return col1; } @@ -801,7 +802,7 @@ BLI_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fa /* See if were darker, if so mix, else don't do anything. * if the paint col is brighter then the original, then ignore */ - if (rgb_to_grayscale_byte(cp1) < rgb_to_grayscale_byte(cp2)) { + if (IMB_colormanagement_get_luminance_byte(cp1) < IMB_colormanagement_get_luminance_byte(cp2)) { return col1; } diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 24b3776da6d..b4bcfb4eb07 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -32,6 +32,7 @@ #include "BLI_math_color.h" #include "BLI_utildefines.h" +#include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" #include "IMB_imbuf.h" @@ -167,7 +168,7 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) for (x = 0; x < ibuf->x; x++) { const unsigned char *rgb = src + 4 * (ibuf->x * y + x); - float v = (float)rgb_to_luma_byte(rgb) / 255.0f; + float v = (float)IMB_colormanagement_get_luminance_byte(rgb) / 255.0f; unsigned char *p = tgt; p += 4 * (w * ((int) (v * (h - 3)) + 1) + x + 1); @@ -207,7 +208,7 @@ static ImBuf *make_waveform_view_from_ibuf_float(ImBuf *ibuf) for (x = 0; x < ibuf->x; x++) { const float *rgb = src + 4 * (ibuf->x * y + x); - float v = rgb_to_luma(rgb); + float v = IMB_colormanagement_get_luminance(rgb); unsigned char *p = tgt; CLAMP(v, 0.0f, 1.0f); |