Slight optimization for AA passes.
This commit is contained in:
parent
d9469babee
commit
8e8fa77d36
@ -453,8 +453,13 @@ def pixel_renderer(
|
||||
# blend to ensure that partial transparency pixel values don't unnecessarily factor
|
||||
# into average calculations.
|
||||
texoff = (aax + (aay * texwidth)) * 4
|
||||
apercent = texbytes[texoff + 3] / 255.0
|
||||
|
||||
# If this is a fully transparent pixel, the below formulas work out to adding nothing
|
||||
# so we should skip this altogether.
|
||||
if texbytes[texoff + 3] == 0:
|
||||
continue
|
||||
|
||||
apercent = texbytes[texoff + 3] / 255.0
|
||||
r += int(texbytes[texoff] * apercent)
|
||||
g += int(texbytes[texoff + 1] * apercent)
|
||||
b += int(texbytes[texoff + 2] * apercent)
|
||||
|
@ -294,8 +294,14 @@ extern "C"
|
||||
// blend to ensure that partial transparency pixel values don't unnecessarily factor
|
||||
// into average calculations.
|
||||
unsigned int texoff = aax + (aay * work->texwidth);
|
||||
float apercent = work->texdata[texoff].a / 255.0;
|
||||
|
||||
// If this is a fully transparent pixel, the below formulas work out to adding nothing
|
||||
// so we should skip this altogether.
|
||||
if (work->texdata[texoff].a == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
float apercent = work->texdata[texoff].a / 255.0;
|
||||
r += (int)(work->texdata[texoff].r * apercent);
|
||||
g += (int)(work->texdata[texoff].g * apercent);
|
||||
b += (int)(work->texdata[texoff].b * apercent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user