nested clipping now works with save/restore
This commit is contained in:
parent
649cffa1e3
commit
a9aa15d1d6
1 changed files with 8 additions and 8 deletions
12
canvas.go
12
canvas.go
|
@ -505,17 +505,17 @@ func (cv *Canvas) Restore() {
|
|||
if l <= 0 {
|
||||
return
|
||||
}
|
||||
hadClip := len(cv.state.clip) > 0
|
||||
cv.state = cv.stateStack[l-1]
|
||||
cv.stateStack = cv.stateStack[:l-1]
|
||||
if len(cv.state.clip) > 0 {
|
||||
cv.clip(cv.state.clip)
|
||||
} else if hadClip {
|
||||
gli.StencilMask(0x02)
|
||||
gli.Clear(gl_STENCIL_BUFFER_BIT)
|
||||
gli.StencilMask(0xFF)
|
||||
for _, st := range cv.stateStack {
|
||||
if len(st.clip) > 0 {
|
||||
cv.clip(st.clip)
|
||||
}
|
||||
}
|
||||
cv.state = cv.stateStack[l-1]
|
||||
cv.stateStack = cv.stateStack[:l-1]
|
||||
}
|
||||
|
||||
// Scale updates the current transformation with a scaling by the given values
|
||||
func (cv *Canvas) Scale(x, y float64) {
|
||||
|
|
Loading…
Reference in a new issue