minor fixes
This commit is contained in:
parent
7f7efd5a8a
commit
637509b5d4
2 changed files with 7 additions and 4 deletions
|
@ -17,11 +17,12 @@ func (b *GoGLBackend) Clip(pts [][2]float64) {
|
|||
b.activate()
|
||||
|
||||
b.ptsBuf = b.ptsBuf[:0]
|
||||
min, max := extent(pts)
|
||||
b.ptsBuf = append(b.ptsBuf,
|
||||
0, 0,
|
||||
0, float32(b.fh),
|
||||
float32(b.fw), float32(b.fh),
|
||||
float32(b.fw), 0)
|
||||
float32(min[0]), float32(min[1]),
|
||||
float32(min[0]), float32(max[1]),
|
||||
float32(max[0]), float32(max[1]),
|
||||
float32(max[0]), float32(min[1]))
|
||||
for _, pt := range pts {
|
||||
b.ptsBuf = append(b.ptsBuf, float32(pt[0]), float32(pt[1]))
|
||||
}
|
||||
|
|
|
@ -72,6 +72,8 @@ func (b *GoGLBackend) clearRect(x, y, w, h int) {
|
|||
}
|
||||
|
||||
func extent(pts [][2]float64) (min, max vec) {
|
||||
max[0] = -math.MaxFloat64
|
||||
max[1] = -math.MaxFloat64
|
||||
min[0] = math.MaxFloat64
|
||||
min[1] = math.MaxFloat64
|
||||
for _, v := range pts {
|
||||
|
|
Loading…
Reference in a new issue