Fix code relating to cookies
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package fallbackStyle
|
||||
|
||||
import "io"
|
||||
import "bytes"
|
||||
import "image"
|
||||
import _ "embed"
|
||||
@@ -47,12 +46,6 @@ var borderColorShade = [4]color.Color { colorShade, colorShade, col
|
||||
//go:embed assets/atlas.png
|
||||
var atlasBytes []byte
|
||||
|
||||
type closerCookie struct { io.Closer }
|
||||
func (cookie closerCookie) Close () { cookie.Closer.Close() }
|
||||
func newCloserCookie (closer io.Closer) event.Cookie {
|
||||
return closerCookie { Closer: closer }
|
||||
}
|
||||
|
||||
// New returns Wintergreen, the default Tomo style. It is neutral-gray with
|
||||
// green and turquoise accents.
|
||||
func New () (*style.Style, event.Cookie) {
|
||||
@@ -66,7 +59,7 @@ func New () (*style.Style, event.Cookie) {
|
||||
textureHandleVertical := atlasTexture.SubTexture(image.Rect(28, 0, 29, 2))
|
||||
textureHandleHorizontal := atlasTexture.SubTexture(image.Rect(28, 0, 30, 1))
|
||||
|
||||
cookie := event.MultiCookie(newCloserCookie(atlasTexture))
|
||||
cookie := event.MultiCookie(atlasTexture)
|
||||
|
||||
rules := []style.Rule {
|
||||
// *.*
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tss
|
||||
|
||||
import "os"
|
||||
import "io"
|
||||
import "fmt"
|
||||
import "image"
|
||||
import "errors"
|
||||
@@ -81,7 +80,7 @@ func (this *styleBuilder) build () (*style.Style, event.Cookie, error) {
|
||||
|
||||
// add each texture to the cookies list
|
||||
for _, texture := range this.textures {
|
||||
cookies = append(cookies, closerCookie { Closer: texture })
|
||||
cookies = append(cookies, texture)
|
||||
}
|
||||
|
||||
return sty, event.MultiCookie(cookies...), nil
|
||||
@@ -398,10 +397,3 @@ func copyBorderValue[T any, U ~[]T] (destination, source U) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
type closerCookie struct {
|
||||
io.Closer
|
||||
}
|
||||
func (cookie closerCookie) Close () {
|
||||
cookie.Closer.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user