diff --git a/box.go b/box.go index e2f9d56..aa2dafb 100644 --- a/box.go +++ b/box.go @@ -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) { diff --git a/canvasbox.go b/canvasbox.go index 13fd62a..e77277e 100644 --- a/canvasbox.go +++ b/canvasbox.go @@ -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))) } diff --git a/containerbox.go b/containerbox.go index 44d1d99..bfaafcb 100644 --- a/containerbox.go +++ b/containerbox.go @@ -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) }