Documentation
¶
Overview ¶
Package repaint keeps one surface's repaint bookkeeping between frames: the logical rects its widget tree owes, and, at paint time, the device rects a buffer from the surface's rotating pool must repaint, the buffer's own staleness included. Windows and popups draw through it alike.
Index ¶
- func Area(regions []render.Rect) int
- type Region
- func (r *Region) Add(bounds render.Rect, rects ...render.Rect)
- func (r *Region) Collect(root widget.Widget, bounds render.Rect) bool
- func (r *Region) Covers(stale render.Rect, num int) bool
- func (r *Region) Empty() bool
- func (r *Region) Full(bounds render.Rect)
- func (r *Region) Plan(b *buffer.Buffer, num int) (rects []render.Rect, changed render.Rect, regions []render.Rect)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Region ¶
type Region struct {
// contains filtered or unexported fields
}
Region is the damage a surface owes its next frame. The zero value owes nothing and has drained no tree yet.
func (*Region) Add ¶
Add owes rects, clipped to bounds, besides what the tree drained: a focus ring that moved, or the whole surface.
func (*Region) Collect ¶
Collect drains root's invalidations into the region, clipped to bounds, the surface's logical rect: a widget may owe pixels outside it (an overflowing scroll child), and those must not keep a frame alive. It reports whether root owed anything, inside bounds or not.
func (*Region) Covers ¶ added in v0.2.3
Covers reports whether one owed rect, at device scale num/scale.Denom, holds all of stale: the frame repaints it anyway, so copying it forward first is work thrown away.
func (*Region) Empty ¶
Empty reports whether nothing is owed: the frame can skip its buffer entirely.
func (*Region) Full ¶
Full owes the whole surface, bounds: a rescale, a renderer change, an overlay toggled over everything.
func (*Region) Plan ¶
func (r *Region) Plan(b *buffer.Buffer, num int) (rects []render.Rect, changed render.Rect, regions []render.Rect)
Plan maps the owed rects onto b at device scale num/scale.Denom and clears them. rects is what the frame repaints and damages on the wire: the owed rects plus whatever b is stale in. changed is only what differs on screen after the commit, the owed rects without b's staleness: a fresh buffer's first paint covers the whole surface but changes nothing the screen did not already show, so the pool must not count it against the other buffers (buffer.Pool.Presented). regions covers rects, the clips the frame paints in. Both slices are reused by the next Plan.