Fix [#22610] Alpha problem with textureswhen Brightness > 1 or Contrast < 1

* Enabled premultiplication for packed images
* Added pack/unpack operator to image template
* Moved brightness/contrast corrections to after de-premultiplication in image texture sampling
This commit is contained in:
2010-06-17 07:20:12 +00:00
parent a8f6a198a6
commit 3173232bfa
4 changed files with 81 additions and 20 deletions

View File

@@ -236,8 +236,6 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre
}
}
BRICONTRGB;
if(texres->talpha) texres->tin= texres->ta;
else if(tex->imaflag & TEX_CALCALPHA) {
texres->ta= texres->tin= MAX3(texres->tr, texres->tg, texres->tb);
@@ -254,6 +252,8 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, TexResult *texre
texres->tb*= fx;
}
BRICONTRGB;
return retval;
}
@@ -1318,8 +1318,6 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
}
}
BRICONTRGB;
if (tex->imaflag & TEX_CALCALPHA)
texres->ta = texres->tin = texres->ta * MAX3(texres->tr, texres->tg, texres->tb);
else
@@ -1348,6 +1346,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec,
texres->tb *= fx;
}
BRICONTRGB;
return retval;
}
@@ -1705,8 +1705,6 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
boxsample(ibuf, fx-minx, fy-miny, fx+minx, fy+miny, texres, imaprepeat, imapextend, 0);
}
BRICONTRGB;
if(tex->imaflag & TEX_CALCALPHA) {
texres->ta= texres->tin= texres->ta*MAX3(texres->tr, texres->tg, texres->tb);
}
@@ -1733,6 +1731,8 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, float *texvec, float *DXT, f
texres->tb*= fx;
}
BRICONTRGB;
return retval;
}