Created FillRectangleShatter for convenience

This commit is contained in:
Sasha Koshka
2023-02-16 18:18:44 -05:00
parent fc0a9292d9
commit f8240fb518
4 changed files with 24 additions and 18 deletions

View File

@@ -6,7 +6,6 @@ import "git.tebibyte.media/sashakoshka/tomo/theme"
import "git.tebibyte.media/sashakoshka/tomo/config"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/artist"
import "git.tebibyte.media/sashakoshka/tomo/shatter"
import "git.tebibyte.media/sashakoshka/tomo/layouts"
import "git.tebibyte.media/sashakoshka/tomo/elements"
import "git.tebibyte.media/sashakoshka/tomo/elements/core"
@@ -225,14 +224,11 @@ func (element *Container) redoAll () {
for index, entry := range element.children {
rocks[index] = entry.Bounds
}
tiles := shatter.Shatter(element.Bounds(), rocks...)
pattern := element.theme.Pattern (
theme.PatternBackground,
theme.PatternState { })
for _, tile := range tiles {
artist.FillRectangleClip (
element.core, pattern, element.Bounds(), tile)
}
artist.FillRectangleShatter (
element.core, pattern, element.Bounds(), rocks...)
// cut our canvas up and give peices to child elements
for _, entry := range element.children {

View File

@@ -7,7 +7,6 @@ import "git.tebibyte.media/sashakoshka/tomo/theme"
import "git.tebibyte.media/sashakoshka/tomo/config"
import "git.tebibyte.media/sashakoshka/tomo/canvas"
import "git.tebibyte.media/sashakoshka/tomo/artist"
import "git.tebibyte.media/sashakoshka/tomo/shatter"
import "git.tebibyte.media/sashakoshka/tomo/elements/core"
// List is an element that contains several objects that a user can select.
@@ -461,9 +460,6 @@ func (element *List) draw () {
innerBounds.Dx(), element.contentHeight,
).Add(innerBounds.Min).Intersect(innerBounds)
pattern := element.theme.Pattern(theme.PatternSunken, state)
tiles := shatter.Shatter(bounds, covered)
for _, tile := range tiles {
artist.FillRectangleClip (
element.core, pattern, bounds, tile)
}
artist.FillRectangleShatter (
element.core, pattern, bounds, covered)
}

View File

@@ -5,7 +5,6 @@ import "git.tebibyte.media/sashakoshka/tomo/input"
import "git.tebibyte.media/sashakoshka/tomo/theme"
import "git.tebibyte.media/sashakoshka/tomo/config"
import "git.tebibyte.media/sashakoshka/tomo/artist"
import "git.tebibyte.media/sashakoshka/tomo/shatter"
import "git.tebibyte.media/sashakoshka/tomo/elements/core"
import "git.tebibyte.media/sashakoshka/tomo/elements/fun/music"
@@ -304,11 +303,8 @@ func (element *Piano) draw () {
}
pattern := element.theme.Pattern(theme.PatternPinboard, state)
tiles := shatter.Shatter(element.Bounds(), element.contentBounds)
for _, tile := range tiles {
artist.FillRectangleClip (
element.core, pattern, element.Bounds(), tile)
}
artist.FillRectangleShatter (
element.core, pattern, element.Bounds(), element.contentBounds)
}
func (element *Piano) drawFlat (