diff options
-rw-r--r-- | source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_clip.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_image.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_node.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_eyedropper.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_editor.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_view.c | 10 |
8 files changed, 23 insertions, 37 deletions
diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 325ef83a529..aa58c0571cf 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -65,11 +65,11 @@ void DifferenceMatteOperation::executePixelSampled(float output[4], float x, flo difference = difference / 3.0f; /* make 100% transparent */ - if (difference < tolerance) { + if (difference <= tolerance) { output[0] = 0.0f; } /*in the falloff region, make partially transparent */ - else if (difference < falloff + tolerance) { + else if (difference <= falloff + tolerance) { difference = difference - tolerance; alpha = difference / falloff; /*only change if more transparent than before */ diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 5f8ebd87d19..91f8b39f7b9 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -63,7 +63,7 @@ int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc); struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc); struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle); -bool ED_space_clip_color_sample(struct Scene *scene, struct SpaceClip *sc, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_clip_color_sample(struct SpaceClip *sc, struct ARegion *ar, int mval[2], float r_col[3]); void ED_clip_update_frame(const struct Main *mainp, int cfra); bool ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, bool fit); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 283113f93d6..9de550a20ce 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -46,7 +46,7 @@ void ED_space_image_set(struct SpaceImage *sima, struct Scene *scene, s struct Mask *ED_space_image_get_mask(struct SpaceImage *sima); void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct Mask *mask); -bool ED_space_image_color_sample(struct Scene *scene, struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *ar, int mval[2], float r_col[3]); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock); void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock); bool ED_space_image_has_buffer(struct SpaceImage *sima); diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index f7b9d6b4f9e..e3c382382a9 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -107,7 +107,7 @@ void ED_node_composite_job(const struct bContext *C, struct bNodeTree *nodetree, void ED_operatormacros_node(void); /* node_view.c */ -bool ED_space_node_color_sample(struct Scene *scene, struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]); +bool ED_space_node_color_sample(struct SpaceNode *snode, struct ARegion *ar, int mval[2], float r_col[3]); #endif /* __ED_NODE_H__ */ diff --git a/source/blender/editors/interface/interface_eyedropper.c b/source/blender/editors/interface/interface_eyedropper.c index f3859154dfb..eab609ebe84 100644 --- a/source/blender/editors/interface/interface_eyedropper.c +++ b/source/blender/editors/interface/interface_eyedropper.c @@ -225,7 +225,7 @@ static bool eyedropper_init(bContext *C, wmOperator *op) return false; } - if (RNA_property_subtype(eye->prop) == PROP_COLOR) { + if (RNA_property_subtype(eye->prop) != PROP_COLOR) { const char *display_device; float col[4]; @@ -235,7 +235,7 @@ static bool eyedropper_init(bContext *C, wmOperator *op) /* store inital color */ RNA_property_float_get_array(&eye->ptr, eye->prop, col); if (eye->display) { - IMB_colormanagement_scene_linear_to_display_v3(col, eye->display); + IMB_colormanagement_display_to_scene_linear_v3(col, eye->display); } copy_v3_v3(eye->init_col, col); } @@ -266,6 +266,8 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int /* we could use some clever */ wmWindow *win = CTX_wm_window(C); ScrArea *sa = BKE_screen_find_area_xy(win->screen, SPACE_TYPE_ANY, mx, my); + const char *display_device = CTX_data_scene(C)->display_settings.display_device; + struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device); if (sa) { if (sa->spacetype == SPACE_IMAGE) { @@ -275,7 +277,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; - if (ED_space_image_color_sample(CTX_data_scene(C), sima, ar, mval, r_col)) { + if (ED_space_image_color_sample(sima, ar, mval, r_col)) { return; } } @@ -287,7 +289,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; - if (ED_space_node_color_sample(CTX_data_scene(C), snode, ar, mval, r_col)) { + if (ED_space_node_color_sample(snode, ar, mval, r_col)) { return; } } @@ -299,7 +301,7 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int int mval[2] = {mx - ar->winrct.xmin, my - ar->winrct.ymin}; - if (ED_space_clip_color_sample(CTX_data_scene(C), sc, ar, mval, r_col)) { + if (ED_space_clip_color_sample(sc, ar, mval, r_col)) { return; } } @@ -310,6 +312,8 @@ static void eyedropper_color_sample_fl(bContext *C, Eyedropper *UNUSED(eye), int glReadBuffer(GL_FRONT); glReadPixels(mx, my, 1, 1, GL_RGB, GL_FLOAT, r_col); glReadBuffer(GL_BACK); + + IMB_colormanagement_display_to_scene_linear_v3(r_col, display); } /* sets the sample color RGB, maintaining A */ @@ -320,10 +324,10 @@ static void eyedropper_color_set(bContext *C, Eyedropper *eye, const float col[3 /* to maintain alpha */ RNA_property_float_get_array(&eye->ptr, eye->prop, col_conv); - /* convert from display space to linear rgb space */ + /* convert from linear rgb space to display space */ if (eye->display) { copy_v3_v3(col_conv, col); - IMB_colormanagement_display_to_scene_linear_v3(col_conv, eye->display); + IMB_colormanagement_scene_linear_to_display_v3(col_conv, eye->display); } else { copy_v3_v3(col_conv, col); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 14d0f909d23..59dd755173f 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -259,11 +259,9 @@ ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale return NULL; } -/* Returns color in the display space, matching ED_space_image_color_sample(). */ -bool ED_space_clip_color_sample(Scene *scene, SpaceClip *sc, ARegion *ar, int mval[2], float r_col[3]) +/* Returns color in linear space, matching ED_space_image_color_sample(). */ +bool ED_space_clip_color_sample(SpaceClip *sc, ARegion *ar, int mval[2], float r_col[3]) { - const char *display_device = scene->display_settings.display_device; - struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device); ImBuf *ibuf; float fx, fy, co[2]; bool ret = false; @@ -299,11 +297,7 @@ bool ED_space_clip_color_sample(Scene *scene, SpaceClip *sc, ARegion *ar, int mv ret = true; } } - - if (ret) { - IMB_colormanagement_scene_linear_to_display_v3(r_col, display); - } - + IMB_freeImBuf(ibuf); return ret; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 324a3cb13b7..d00ebed5bcc 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2900,11 +2900,9 @@ static void image_sample_draw(const bContext *C, ARegion *ar, void *arg_info) } } -/* Returns color in the display space, matching ED_space_node_color_sample(). */ -bool ED_space_image_color_sample(Scene *scene, SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3]) +/* Returns color in linear space, matching ED_space_node_color_sample(). */ +bool ED_space_image_color_sample(SpaceImage *sima, ARegion *ar, int mval[2], float r_col[3]) { - const char *display_device = scene->display_settings.display_device; - struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device); void *lock; ImBuf *ibuf = ED_space_image_acquire_buffer(sima, &lock); float fx, fy; @@ -2938,10 +2936,6 @@ bool ED_space_image_color_sample(Scene *scene, SpaceImage *sima, ARegion *ar, in } } - if (ret) { - IMB_colormanagement_scene_linear_to_display_v3(r_col, display); - } - ED_space_image_release_buffer(sima, ibuf, lock); return ret; } diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 80934e7d0a0..9c73af12e3f 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -417,13 +417,11 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) } } -/* Returns color in the display space, matching ED_space_image_color_sample(). +/* Returns color in linear space, matching ED_space_image_color_sample(). * And here we've got recursion in the comments tips... */ -bool ED_space_node_color_sample(Scene *scene, SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3]) +bool ED_space_node_color_sample(SpaceNode *snode, ARegion *ar, int mval[2], float r_col[3]) { - const char *display_device = scene->display_settings.display_device; - struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device); void *lock; Image *ima; ImBuf *ibuf; @@ -471,10 +469,6 @@ bool ED_space_node_color_sample(Scene *scene, SpaceNode *snode, ARegion *ar, int } } - if (ret) { - IMB_colormanagement_scene_linear_to_display_v3(r_col, display); - } - BKE_image_release_ibuf(ima, ibuf, lock); return ret; |