vector: re-order some functions.

There are no code changes, just a re-ordering so that these files are
consistent with others in this package: OpOver, OpSrc, Mask.

Change-Id: Ib1d46a8e912dae0c760af655e919b77023688189
Reviewed-on: https://go-review.googlesource.com/30111
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Nigel Tao 2016-10-01 08:35:39 +10:00
parent 992afa5d48
commit 72141d56a2
2 changed files with 31 additions and 31 deletions

View File

@ -199,22 +199,6 @@ func (z *Rasterizer) fixedLineTo(b f32.Vec2) {
} }
} }
func fixedAccumulateOpSrc(dst []uint8, src []uint32) {
acc := int2ϕ(0)
for i, v := range src {
acc += int2ϕ(v)
a := acc
if a < 0 {
a = -a
}
a >>= 2*ϕ - 8
if a > 0xff {
a = 0xff
}
dst[i] = uint8(a)
}
}
func fixedAccumulateOpOver(dst []uint8, src []uint32) { func fixedAccumulateOpOver(dst []uint8, src []uint32) {
acc := int2ϕ(0) acc := int2ϕ(0)
for i, v := range src { for i, v := range src {
@ -235,6 +219,22 @@ func fixedAccumulateOpOver(dst []uint8, src []uint32) {
} }
} }
func fixedAccumulateOpSrc(dst []uint8, src []uint32) {
acc := int2ϕ(0)
for i, v := range src {
acc += int2ϕ(v)
a := acc
if a < 0 {
a = -a
}
a >>= 2*ϕ - 8
if a > 0xff {
a = 0xff
}
dst[i] = uint8(a)
}
}
func fixedAccumulateMask(buf []uint32) { func fixedAccumulateMask(buf []uint32) {
acc := int2ϕ(0) acc := int2ϕ(0)
for i, v := range buf { for i, v := range buf {

View File

@ -145,21 +145,6 @@ const (
almost65536 = almost256 * 256 almost65536 = almost256 * 256
) )
func floatingAccumulateOpSrc(dst []uint8, src []float32) {
acc := float32(0)
for i, v := range src {
acc += v
a := acc
if a < 0 {
a = -a
}
if a > 1 {
a = 1
}
dst[i] = uint8(almost256 * a)
}
}
func floatingAccumulateOpOver(dst []uint8, src []float32) { func floatingAccumulateOpOver(dst []uint8, src []float32) {
acc := float32(0) acc := float32(0)
for i, v := range src { for i, v := range src {
@ -179,6 +164,21 @@ func floatingAccumulateOpOver(dst []uint8, src []float32) {
} }
} }
func floatingAccumulateOpSrc(dst []uint8, src []float32) {
acc := float32(0)
for i, v := range src {
acc += v
a := acc
if a < 0 {
a = -a
}
if a > 1 {
a = 1
}
dst[i] = uint8(almost256 * a)
}
}
func floatingAccumulateMask(dst []uint32, src []float32) { func floatingAccumulateMask(dst []uint32, src []float32) {
acc := float32(0) acc := float32(0)
for i, v := range src { for i, v := range src {