repaint

package
v0.2.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Area added in v0.2.3

func Area(regions []render.Rect) int

Area is the pixels of regions.

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

func (r *Region) Add(bounds render.Rect, rects ...render.Rect)

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

func (r *Region) Blit(b, front, carryFrom *buffer.Buffer) []gpu.Carry

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

func (r *Region) Collect(root widget.Widget, bounds render.Rect) bool

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

func (r *Region) DropCovered(b *buffer.Buffer, num int)

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

func (r *Region) Empty() bool

Empty reports whether nothing is owed: the frame can skip its buffer entirely.

func (*Region) Full

func (r *Region) Full(bounds render.Rect)

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

func (r *Region) PlanBlits(b, front *buffer.Buffer, num int)

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.

func (*Region) Refuse added in v0.2.5

func (r *Region) Refuse()

Refuse owes again what the last Plan took, the views it moved whole: the GPU refused the frame, having done nothing, or drew it without everything in it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL