diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-02-23 13:43:06 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-02-23 20:32:09 +0300 |
commit | b123aadeeebe20317183c7c9d833caee1eb7e59b (patch) | |
tree | c08da7cb07779303f46d7bcaec07f96007a63c8b /source/blender/draw/engines/image/image_engine.c | |
parent | 64c35769f921e2c7e83ac966d07e0aace7e5f1fa (diff) |
Fix T85895: Viewing value passes in Image Editor displays the value as alpha
There was a similar report prior to the introduction of the Image
Engine, see T74586.
This was fixed by rB6a5bd812b569 at that time, but got lost in the
refactor it seems.
Above commit introduced the `ED_space_image_get_display_channel_mask`
function that will determine
the valid bitflags for the display channel of a given ImBuf.
But since the refactor, this is not called anymore (`draw_image_main` is
not called anymore)
Now it seems we can safely reuse that said function
`ED_space_image_get_display_channel_mask` also for the Image Engine.
Maniphest Tasks: T85895
Differential Revision: https://developer.blender.org/D10510
Diffstat (limited to 'source/blender/draw/engines/image/image_engine.c')
-rw-r--r-- | source/blender/draw/engines/image/image_engine.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/draw/engines/image/image_engine.c b/source/blender/draw/engines/image/image_engine.c index 886f211189b..d75f887ce2b 100644 --- a/source/blender/draw/engines/image/image_engine.c +++ b/source/blender/draw/engines/image/image_engine.c @@ -113,7 +113,8 @@ static void space_image_gpu_texture_get(Image *image, BKE_image_multiview_index(image, &sima->iuser); if (ibuf) { - if (sima->flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) { + const int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf); + if (sima_flag & SI_SHOW_ZBUF && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1))) { if (ibuf->zbuf) { BLI_assert(!"Integer based depth buffers not supported"); } @@ -204,30 +205,31 @@ static void image_cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser int draw_flags = 0; if (space_type == SPACE_IMAGE) { SpaceImage *sima = (SpaceImage *)draw_ctx->space_data; + const int sima_flag = sima->flag & ED_space_image_get_display_channel_mask(ibuf); const bool do_repeat = (!is_tiled_texture) && ((sima->flag & SI_DRAW_TILE) != 0); SET_FLAG_FROM_TEST(draw_flags, do_repeat, IMAGE_DRAW_FLAG_DO_REPEAT); SET_FLAG_FROM_TEST(draw_flags, is_tiled_texture, IMAGE_DRAW_FLAG_USE_WORLD_POS); - if ((sima->flag & SI_USE_ALPHA) != 0) { + if ((sima_flag & SI_USE_ALPHA) != 0) { /* Show RGBA */ draw_flags |= IMAGE_DRAW_FLAG_SHOW_ALPHA | IMAGE_DRAW_FLAG_APPLY_ALPHA; } - else if ((sima->flag & SI_SHOW_ALPHA) != 0) { + else if ((sima_flag & SI_SHOW_ALPHA) != 0) { draw_flags |= IMAGE_DRAW_FLAG_SHUFFLING; copy_v4_fl4(shuffle, 0.0f, 0.0f, 0.0f, 1.0f); } - else if ((sima->flag & SI_SHOW_ZBUF) != 0) { + else if ((sima_flag & SI_SHOW_ZBUF) != 0) { draw_flags |= IMAGE_DRAW_FLAG_DEPTH | IMAGE_DRAW_FLAG_SHUFFLING; copy_v4_fl4(shuffle, 1.0f, 0.0f, 0.0f, 0.0f); } - else if ((sima->flag & SI_SHOW_R) != 0) { + else if ((sima_flag & SI_SHOW_R) != 0) { draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING; copy_v4_fl4(shuffle, 1.0f, 0.0f, 0.0f, 0.0f); } - else if ((sima->flag & SI_SHOW_G) != 0) { + else if ((sima_flag & SI_SHOW_G) != 0) { draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING; copy_v4_fl4(shuffle, 0.0f, 1.0f, 0.0f, 0.0f); } - else if ((sima->flag & SI_SHOW_B) != 0) { + else if ((sima_flag & SI_SHOW_B) != 0) { draw_flags |= IMAGE_DRAW_FLAG_APPLY_ALPHA | IMAGE_DRAW_FLAG_SHUFFLING; copy_v4_fl4(shuffle, 0.0f, 0.0f, 1.0f, 0.0f); } |