Replace references to Canvas.Clip

This commit is contained in:
Sasha Koshka 2024-05-26 15:18:27 -04:00
parent c92377f50b
commit 398ad08867
3 changed files with 5 additions and 5 deletions

6
box.go
View File

@ -358,7 +358,7 @@ func (this *box) drawBorders (can canvas.Canvas) {
rectangle := func (x0, y0, x1, y1 int, c color.Color) {
area := image.Rect(x0, y0, x1, y1)
if transparent(c) && this.parent != nil {
this.parent.drawBackgroundPart(can.Clip(area))
this.parent.drawBackgroundPart(can.SubCanvas(area))
}
pen.Fill(c)
pen.Rectangle(area)
@ -426,7 +426,7 @@ func (this *box) doDraw () {
if this.canvas == nil { return }
if this.drawer != nil {
this.drawBorders(this.canvas)
this.drawer.Draw(this.canvas.Clip(this.innerClippingBounds))
this.drawer.Draw(this.canvas.SubCanvas(this.innerClippingBounds))
}
}
@ -439,7 +439,7 @@ func (this *box) doLayout () {
if this.parent == nil { this.canvas = nil; return }
parentCanvas := this.parent.canvas()
if parentCanvas == nil { this.canvas = nil; return }
this.canvas = parentCanvas.Clip(this.bounds)
this.canvas = parentCanvas.SubCanvas(this.bounds)
}
func (this *box) setParent (parent parent) {

View File

@ -31,5 +31,5 @@ func (this *canvasBox) Invalidate () {
func (this *canvasBox) Draw (can canvas.Canvas) {
this.box.Draw(can)
this.userDrawer.Draw (
can.Clip(this.padding.Apply(this.innerClippingBounds)))
can.SubCanvas(this.padding.Apply(this.innerClippingBounds)))
}

View File

@ -167,7 +167,7 @@ func (this *containerBox) Draw (can canvas.Canvas) {
rocks[index] = box.Bounds()
}
for _, tile := range canvas.Shatter(this.bounds, rocks...) {
clipped := can.Clip(tile)
clipped := can.SubCanvas(tile)
if this.transparent() && this.parent != nil {
this.parent.drawBackgroundPart(clipped)
}