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) Blit(b, front, carryFrom *buffer.Buffer) []gpu.Carry
- func (r *Region) Collect(root widget.Widget, bounds render.Rect) bool
- func (r *Region) DropCovered(b *buffer.Buffer, num int)
- func (r *Region) Empty() bool
- func (r *Region) Full(bounds render.Rect)
- func (r *Region) Plan(b *buffer.Buffer, num int, carrying bool) (rects []render.Rect, changed *buffer.Region, regions []render.Rect)
- func (r *Region) PlanBlits(b, front *buffer.Buffer, num int)
- func (r *Region) Refuse()
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) Blit ¶ added in v0.2.5
Blit makes the moves PlanBlits kept. Shared memory copies here, and nil comes back. A GPU target copies inside the submission that draws it: the carries come back for the frame, b's staleness from carryFrom first, when not nil (buffer.Pool.CopyForward), then each move from front. The carries are reused by the next Blit.
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) DropCovered ¶ added in v0.2.5
DropCovered takes off b's staleness every rect one owed rect, at device scale num/scale.Denom, holds whole: the frame repaints those anyway, so copying them 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, carrying bool) (rects []render.Rect, changed *buffer.Region, regions []render.Rect)
Plan maps the owed rects onto b at device scale num/scale.Denom and takes them off the region. 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. All three are reused by the next Plan. carrying says the frame copies b's staleness forward (buffer.Pool.CopyForward), so it paints none of it.
func (*Region) PlanBlits ¶ added in v0.2.5
PlanBlits decides how b takes the moves the region holds: copied from front, on the wire without being painted, or, for a front of another size or kind or a move landing between device pixels, owed whole so the frame paints it. Call it ahead of DropCovered and CopyForward, and Blit after them.