compositor: Revert most of previous patch.

The calculation doesn't produce the same results.
Keep just the change to divide alpha by 255 instead of 256,
for slightly better accuracy
This commit is contained in:
Jan Schmidt 2015-03-16 03:53:33 +11:00
parent 6a1f97cd50
commit d9a96ac2ec

View file

@ -17,7 +17,7 @@ copyl d1, s1
.param 2 p1
.temp 2 t1
.temp 2 t2
.const 1 c1 8
.const 1 c1 8
convubw t1, d1
convubw t2, s1
@ -35,7 +35,6 @@ convsuswb d1, t2
.source 4 s guint8
.param 2 alpha
.temp 4 t
.temp 4 t2
.temp 2 tw
.temp 1 tb
.temp 4 a
@ -51,25 +50,14 @@ splatbl a, tb
x4 convubw a_wide, a
x4 mullw a_wide, a_wide, alpha
x4 div255w a_wide, a_wide
# dest pixel into t2
loadl t2, d
# t = s - d (as bytes)
x4 subb t, t, t2
# s_wide = (uint16)(t) * alpha
x4 convubw s_wide, t
loadl t, d
x4 convubw d_wide, t
x4 subw s_wide, s_wide, d_wide
x4 mullw s_wide, s_wide, a_wide
# s_wide /= 255
x4 div255w s_wide, s_wide
# d_wide = (uint16)(dest) + s_wide
x4 convubw d_wide, t2
x4 addw d_wide, d_wide, s_wide
# Set output alpha to 0xff and store
x4 convwb t, d_wide
orl t, t, a_alpha
storel d, t
@ -98,15 +86,13 @@ x4 convubw a_wide, a
x4 mullw a_wide, a_wide, alpha
x4 div255w a_wide, a_wide
loadl t2, d
# t = s - d (as bytes)
x4 subb t, t, t2
x4 convubw s_wide, t
loadl t, d
x4 convubw d_wide, t
x4 subw s_wide, s_wide, d_wide
x4 mullw s_wide, s_wide, a_wide
x4 div255w s_wide, s_wide
x4 convubw d_wide, t2
x4 addw d_wide, d_wide, s_wide
x4 convwb t, d_wide
orl t, t, a_alpha