diff options
4 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 31ad4d0380a..194b41f9aaa 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -961,7 +961,7 @@ void BKE_histogram_update_sample_line(Histogram *hist, ImBuf *ibuf, const short hist->channels = 3; hist->x_resolution = 256; hist->xmax = 1.0f; - hist->ymax = 1.0f; + /* hist->ymax = 1.0f; */ /* now do this on the operator _only_ */ if (ibuf->rect == NULL && ibuf->rect_float == NULL) return; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 1d88838ecc5..d8eb1b011bd 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -714,6 +714,8 @@ static void histogram_draw_one(float r, float g, float b, float alpha, } } +#define HISTOGRAM_TOT_GRID_LINES 4 + void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Histogram *hist = (Histogram *)but->poin; @@ -749,9 +751,16 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) glColor4f(1.f, 1.f, 1.f, 0.08f); /* draw grid lines here */ - for (i = 1; i < 4; i++) { - fdrawline(rect.xmin, rect.ymin + (i / 4.f) * h, rect.xmax, rect.ymin + (i / 4.f) * h); - fdrawline(rect.xmin + (i / 4.f) * w, rect.ymin, rect.xmin + (i / 4.f) * w, rect.ymax); + for (i = 1; i < (HISTOGRAM_TOT_GRID_LINES + 1); i++) { + const float fac = (float)i / (float)HISTOGRAM_TOT_GRID_LINES; + + /* so we can tell the 1.0 color point */ + if (i == HISTOGRAM_TOT_GRID_LINES) { + glColor4f(1.0f, 1.0f, 1.0f, 0.5f); + } + + fdrawline(rect.xmin, rect.ymin + fac * h, rect.xmax, rect.ymin + fac * h); + fdrawline(rect.xmin + fac * w, rect.ymin, rect.xmin + fac * w, rect.ymax); } if (hist->mode == HISTO_MODE_LUMA) { @@ -773,6 +782,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) draw_scope_end(&rect, scissor); } +#undef HISTOGRAM_TOT_GRID_LINES + void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti) { Scopes *scopes = (Scopes *)but->poin; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 32aef5d3939..15202760315 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3872,7 +3872,8 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx const float yfac = minf(powf(hist->ymax, 2.0f), 1.0f) * 0.5f; hist->ymax += dy * yfac; - CLAMP(hist->ymax, 1.f, 100.f); + /* 0.1 allows us to see HDR colors up to 10 */ + CLAMP(hist->ymax, 0.1f, 100.f); } data->draglastx = mx; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index c204d0dec31..95e43e2ab24 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -213,6 +213,10 @@ static int space_image_image_sample_poll(bContext *C) if (ED_space_image_show_uvedit(sima, obedit) && (toolsettings->use_uv_sculpt)) return 0; } + else if (sima->mode != SI_MODE_VIEW) { + return 0; + } + return space_image_main_area_poll(C); } /********************** view pan operator *********************/ @@ -2152,6 +2156,9 @@ static int image_sample_line_exec(bContext *C, wmOperator *op) BKE_histogram_update_sample_line(hist, ibuf, (scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) != 0); + /* reset y zoom */ + hist->ymax = 1.0f; + ED_space_image_release_buffer(sima, lock); ED_area_tag_redraw(CTX_wm_area(C)); |