From 167dcc88c78b68540ecdd1abc3e26ade73d2d27c Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 18 Feb 2013 19:34:14 +0000 Subject: [PATCH] Force movie clips always use default alpha mode, before this straight alpha was used for them which doesn't work for cleaned footage stored in EXR file format. Perhaps we need to support configurable alpha mode for clips, but that's for later (maybe even after release), --- source/blender/blenkernel/intern/movieclip.c | 2 +- source/blender/imbuf/intern/readimage.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 943d9e9452a..eceac61ddb6 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -216,7 +216,7 @@ static ImBuf *movieclip_load_sequence_file(MovieClip *clip, MovieClipUser *user, colorspace = clip->colorspace_settings.name; } - loadflag = IB_rect | IB_multilayer; + loadflag = IB_rect | IB_multilayer | IB_alphamode_detect; /* read ibuf */ ibuf = IMB_loadiffname(name, loadflag, colorspace); diff --git a/source/blender/imbuf/intern/readimage.c b/source/blender/imbuf/intern/readimage.c index 00bc78ee488..4d47d883444 100644 --- a/source/blender/imbuf/intern/readimage.c +++ b/source/blender/imbuf/intern/readimage.c @@ -75,6 +75,8 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co if (type->load) { ibuf = type->load(mem, size, flags, effective_colorspace); if (ibuf) { + int alpha_flags; + if (colorspace) { if (ibuf->rect) { /* byte buffer is never internally converted to some standard space, @@ -86,11 +88,16 @@ ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char co BLI_strncpy(colorspace, effective_colorspace, IM_MAX_SPACE); } + if (flags & IB_alphamode_detect) + alpha_flags = ibuf->flags & IB_alphamode_premul; + else + alpha_flags = flags & IB_alphamode_premul; + if (flags & IB_ignore_alpha) { IMB_rectfill_alpha(ibuf, 1.0f); } else { - if (flags & IB_alphamode_premul) { + if (alpha_flags & IB_alphamode_premul) { if (ibuf->rect) { IMB_unpremultiply_alpha(ibuf); }