Checkpoint

This commit is contained in:
maze authored and maze committed 2026-10-29 17:29:41 +01:00
1 parent 85a9ec684c
commit c5d6137fab
160 files changed
+76293 -387

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
package safe
import (
"image"
"sync/atomic"
)
type Point struct {
X, Y atomic.Int64
}
func (p *Point) Load() image.Point {
return image.Pt(
int(p.X.Load()),
int(p.Y.Load()),
)
}
func (p *Point) Store(point image.Point) {
p.X.Store(int64(point.X))
p.Y.Store(int64(point.Y))
}
type Rectangle struct {
Min, Max Point
}
func (r *Rectangle) Load() image.Rectangle {
return image.Rectangle{
Min: r.Min.Load(),
Max: r.Max.Load(),
}
}
func (r *Rectangle) Store(rect image.Rectangle) {
r.Min.Store(rect.Min)
r.Max.Store(rect.Max)
}