slice vertices and colors
This commit is contained in:
parent
259014193d
commit
8bc0343156
1 changed files with 22 additions and 26 deletions
|
@ -39,33 +39,29 @@ func (p *GLPainter) Paint(ss []raster.Span, done bool) {
|
||||||
ci := len(p.colors)
|
ci := len(p.colors)
|
||||||
p.vertices = p.vertices[0 : vi+vlenrequired]
|
p.vertices = p.vertices[0 : vi+vlenrequired]
|
||||||
p.colors = p.colors[0 : ci+clenrequired]
|
p.colors = p.colors[0 : ci+clenrequired]
|
||||||
|
var (
|
||||||
|
colors []uint8
|
||||||
|
vertices []int32
|
||||||
|
)
|
||||||
for _, s := range ss {
|
for _, s := range ss {
|
||||||
ma := s.A >> 16
|
ma := s.A >> 16
|
||||||
a := ma * p.ca / M16
|
a := uint8((ma * p.ca / M16) >> 8)
|
||||||
p.colors[ci] = p.cr
|
colors = p.colors[ci:]
|
||||||
ci++
|
colors[0] = p.cr
|
||||||
p.colors[ci] = p.cg
|
colors[1] = p.cg
|
||||||
ci++
|
colors[2] = p.cb
|
||||||
p.colors[ci] = p.cb
|
colors[3] = a
|
||||||
ci++
|
colors[4] = p.cr
|
||||||
p.colors[ci] = uint8(a >> 8)
|
colors[5] = p.cg
|
||||||
ci++
|
colors[6] = p.cb
|
||||||
p.colors[ci] = p.cr
|
colors[7] = a
|
||||||
ci++
|
ci += 8
|
||||||
p.colors[ci] = p.cg
|
vertices = p.vertices[vi:]
|
||||||
ci++
|
vertices[0] = int32(s.X0)
|
||||||
p.colors[ci] = p.cb
|
vertices[1] = int32(s.Y)
|
||||||
ci++
|
vertices[2] = int32(s.X1)
|
||||||
p.colors[ci] = uint8(a >> 8)
|
vertices[3] = int32(s.Y)
|
||||||
ci++
|
vi += 4
|
||||||
p.vertices[vi] = int32(s.X0)
|
|
||||||
vi++
|
|
||||||
p.vertices[vi] = int32(s.Y)
|
|
||||||
vi++
|
|
||||||
p.vertices[vi] = int32(s.X1)
|
|
||||||
vi++
|
|
||||||
p.vertices[vi] = int32(s.Y)
|
|
||||||
vi++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue