layout: change NewContext to take the FrameEvent directly

The layout package imports io/system anyway, so depending on
FrameEvent does not introduce new dependencies.

API change. Use gofmt to adjust your code:

	gofmt -r 'layout.NewContext(a, b, c, d) -> layout.NewContext(a, e)'

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-09 22:49:18 +02:00
parent 566132b4f5
commit d1ea9339d5
+7 -8
View File
@@ -3,7 +3,6 @@
package layout
import (
"image"
"math"
"time"
@@ -32,19 +31,19 @@ type Context struct {
//
// Context{
// Ops: ops,
// Queue: q,
// Config: cfg,
// Constraints: Exact(size),
// Queue: e.Queue,
// Config: e.Config,
// Constraints: Exact(e.Size),
// }
//
// NewContext calls ops.Reset.
func NewContext(ops *op.Ops, q event.Queue, cfg system.Config, size image.Point) Context {
func NewContext(ops *op.Ops, e system.FrameEvent) Context {
ops.Reset()
return Context{
Ops: ops,
Queue: q,
Config: cfg,
Constraints: Exact(size),
Queue: e.Queue,
Config: e.Config,
Constraints: Exact(e.Size),
}
}