diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-11-12 11:14:36 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-11-12 11:14:36 +0300 |
commit | 08452d995664f6e5605d282374746c305f28fa52 (patch) | |
tree | bae7ed9420d0ff051db866f326f92721f7184f5c /source/blender/editors | |
parent | cd2dfacfa574f99acb06c0d020d96b2be714aa20 (diff) | |
parent | c08827e659e5f48034b4f9d4612bd309ea63ff03 (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender/editors')
4 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 01040949a0a..4835d2118d9 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -58,7 +58,8 @@ void ED_space_image_set_mask(struct bContext *C, struct SpaceImage *sima, struct bool ED_space_image_color_sample(struct SpaceImage *sima, struct ARegion *region, int mval[2], - float r_col[3]); + float r_col[3], + bool *r_is_data); struct ImBuf *ED_space_image_acquire_buffer(struct SpaceImage *sima, void **r_lock, int tile); int ED_space_image_get_display_channel_mask(struct ImBuf *ibuf); void ED_space_image_release_buffer(struct SpaceImage *sima, struct ImBuf *ibuf, void *lock); diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index c86e35f91db..5af290db037 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -163,7 +163,7 @@ void eyedropper_color_sample_fl(bContext *C, int mx, int my, float r_col[3]) SpaceImage *sima = area->spacedata.first; int mval[2] = {mx - region->winrct.xmin, my - region->winrct.ymin}; - if (ED_space_image_color_sample(sima, region, mval, r_col)) { + if (ED_space_image_color_sample(sima, region, mval, r_col, NULL)) { return; } } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index beffb97bf3f..2484f382ed4 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -581,8 +581,12 @@ void paint_sample_color( /* Sample from the active image buffer. The sampled color is in * Linear Scene Reference Space. */ float rgba_f[3]; - if (ED_space_image_color_sample(sima, region, (int[2]){x, y}, rgba_f)) { - linearrgb_to_srgb_v3_v3(rgba_f, rgba_f); + bool is_data; + if (ED_space_image_color_sample(sima, region, (int[2]){x, y}, rgba_f, &is_data)) { + if (!is_data) { + linearrgb_to_srgb_v3_v3(rgba_f, rgba_f); + } + if (use_palette) { copy_v3_v3(color->rgb, rgba_f); } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 69e9c975bd1..0fa48059cdc 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -3037,8 +3037,12 @@ void IMAGE_OT_unpack(wmOperatorType *ot) * \{ */ /* Returns color in linear space, matching ED_space_node_color_sample(). */ -bool ED_space_image_color_sample(SpaceImage *sima, ARegion *region, int mval[2], float r_col[3]) +bool ED_space_image_color_sample( + SpaceImage *sima, ARegion *region, int mval[2], float r_col[3], bool *r_is_data) { + if (r_is_data) { + *r_is_data = false; + } if (sima->image == NULL) { return false; } @@ -3076,6 +3080,10 @@ bool ED_space_image_color_sample(SpaceImage *sima, ARegion *region, int mval[2], } } + if (r_is_data) { + *r_is_data = (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA) != 0; + } + ED_space_image_release_buffer(sima, ibuf, lock); return ret; } |