From 2af78ac944847b711669f6a69f174216327dda09 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 26 Mar 2008 15:25:56 +0000 Subject: [PATCH] Fix for bug #8750: depremul in the image texture code should check with an epsilon rather than 0.0f, could give random spots otherwise with e.g. calcalpha + negalpha. --- source/blender/render/intern/source/imagetexture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index 7dc205e2794..696f6b72849 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -32,6 +32,7 @@ #include #include #include +#include #ifndef WIN32 #include #else @@ -245,7 +246,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre if(tex->flag & TEX_NEGALPHA) texres->ta= 1.0f-texres->ta; /* de-premul, this is being premulled in shade_input_do_shade() */ - if(texres->ta!=1.0f && texres->ta!=0.0f) { + if(texres->ta!=1.0f && texres->ta>FLT_EPSILON) { fx= 1.0f/texres->ta; texres->tr*= fx; texres->tg*= fx; @@ -989,7 +990,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *dxt, f } /* de-premul, this is being premulled in shade_input_do_shade() */ - if(texres->ta!=1.0f && texres->ta!=0.0f) { + if(texres->ta!=1.0f && texres->ta>FLT_EPSILON) { fx= 1.0f/texres->ta; texres->tr*= fx; texres->tg*= fx;