mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
ui: move ops reader to ui package
To prepare support for cached OpBlock to refer to other Ops lists. The exposure of OpsReader is alleviated by the removal of the Refs and Data accessors for Ops. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -56,7 +56,7 @@ type renderer struct {
|
||||
}
|
||||
|
||||
type drawOps struct {
|
||||
reader ops.Reader
|
||||
reader ui.OpsReader
|
||||
cache *resourceCache
|
||||
viewport image.Point
|
||||
clearColor [3]float32
|
||||
@@ -651,7 +651,7 @@ func (d *drawOps) collect(cache *resourceCache, root *ui.Ops, viewport image.Poi
|
||||
clip := f32.Rectangle{
|
||||
Max: f32.Point{X: float32(viewport.X), Y: float32(viewport.Y)},
|
||||
}
|
||||
d.reader.Reset(root.Data(), root.Refs())
|
||||
d.reader.Reset(root)
|
||||
state := drawState{
|
||||
clip: clip,
|
||||
rect: true,
|
||||
@@ -664,7 +664,7 @@ func (d *drawOps) newPathOp() *pathOp {
|
||||
return &d.pathOpCache[len(d.pathOpCache)-1]
|
||||
}
|
||||
|
||||
func (d *drawOps) collectOps(r *ops.Reader, state drawState) int {
|
||||
func (d *drawOps) collectOps(r *ui.OpsReader, state drawState) int {
|
||||
loop:
|
||||
for {
|
||||
data, ok := r.Decode()
|
||||
|
||||
+3
-3
@@ -46,7 +46,7 @@ type Window struct {
|
||||
nextFrame time.Time
|
||||
delayedDraw *time.Timer
|
||||
|
||||
reader ops.Reader
|
||||
reader ui.OpsReader
|
||||
}
|
||||
|
||||
// driver is the interface for the platform implementation
|
||||
@@ -144,7 +144,7 @@ func (w *Window) Draw(root *ui.Ops) {
|
||||
w.timings = fmt.Sprintf("tot:%7s cpu:%7s %s", frameDur.Round(q), drawDur.Round(q), w.gpu.Timings())
|
||||
w.setNextFrame(time.Time{})
|
||||
}
|
||||
w.reader.Reset(root.Data(), root.Refs())
|
||||
w.reader.Reset(root)
|
||||
if t, ok := collectRedraws(&w.reader); ok {
|
||||
w.setNextFrame(t)
|
||||
}
|
||||
@@ -152,7 +152,7 @@ func (w *Window) Draw(root *ui.Ops) {
|
||||
w.gpu.Draw(w.Profiling, size, root)
|
||||
}
|
||||
|
||||
func collectRedraws(r *ops.Reader) (time.Time, bool) {
|
||||
func collectRedraws(r *ui.OpsReader) (time.Time, bool) {
|
||||
var t time.Time
|
||||
redraw := false
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user