shmwindow

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: BSD-3-Clause 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 shmwindow is the renderer of a Linux window without a GPU (SPEC §9.6): the software renderer (package soft) draws the frame into memory that a gpu.PixelTarget gives, and the window shows it, through wl_shm on Wayland. It is to Linux what gdiwindow is to Windows, nativewindow to Android and canvas2d to the web, with one difference that matters on a machine whose CPU is the rasterizer: it draws only what changed.

A surface keeps the pixels of its window across frames, as offscreen.Surface does. Each frame clears and redraws only the rectangles that the damage tracker finds (SPEC §9.1, "Damage"), and then copies into the buffer the target gave the rectangles that buffer is missing: what this frame changed, and what the frames since the buffer was last shown changed (its age, as with EGL_EXT_buffer_age). The window is told only what this frame changed.

The sequence of calls is plain Go over a gpu.PixelTarget, which a test replaces with a fake; the memory, the protocol and the release of buffers are the platform backend's.

Flutter: no counterpart (Flutter's Linux embedder has a software compositor that copies the whole frame, shell/platform/linux/fl_compositor_software.cc)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// Background is what shows where the scene draws nothing. The window is opaque, so only the
	// color's red, green and blue count; the zero value is black.
	Background ui.Color
}

Options are the optional parameters of NewRenderer.

Flutter: no counterpart

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer is a gpu.Renderer that draws with soft into the buffers of a gpu.PixelTarget.

Flutter: shell/platform/linux/fl_compositor_software.cc FlCompositorSoftware

func NewRenderer

func NewRenderer(targets func(gpu.SurfaceHandle) (gpu.PixelTarget, bool), opts ...Options) *Renderer

NewRenderer makes a renderer. targets gives the gpu.PixelTarget of the window that a surface handle names, and false when there is none. More than one options value panics with MultipleOptions.

Flutter: no counterpart

func (*Renderer) Attach

func (r *Renderer) Attach(h gpu.SurfaceHandle) (gpu.Surface, error)

Attach starts drawing into the window that the handle names, which must be of kind gpu.SurfaceKindWayland, gpu.SurfaceKindX11 or gpu.SurfaceKindMetalLayer (the layer of a macOS window, which shows IOSurfaces, SPEC §29.5) and have a target. It fails with RendererClosed after Close, with SurfaceKindUnsupported for another kind and with PixelTargetMissing for a window with no target.

Flutter: no counterpart

func (*Renderer) Close

func (r *Renderer) Close() error

Close stops the renderer; its surfaces are destroyed by their owners. It is safe to call twice.

Flutter: no counterpart

func (*Renderer) Invalidate

func (r *Renderer) Invalidate(s gpu.Surface)

Invalidate says that the window lost its content, so that the next frame is drawn and presented whole. A surface that is not this renderer's is ignored.

Flutter: no counterpart

func (*Renderer) Render

func (r *Renderer) Render(s gpu.Surface, scene *ui.Scene, size ui.Size, dpr float32) error

Render draws the scene into the surface at the size in device pixels and presents it. A nil scene draws the background only. The scene's coordinates are already in device pixels, so dpr is not used.

Flutter: no counterpart

func (*Renderer) RenderCapture

func (r *Renderer) RenderCapture(s gpu.Surface, scene *ui.Scene, size ui.Size, _ float32, capture bool) (*image.RGBA, error)

RenderCapture is Render that also returns, when capture is set, the frame it presented, top row first. The image belongs to the caller.

Flutter: no counterpart

func (*Renderer) Snapshot

func (r *Renderer) Snapshot(scene *ui.Scene, size ui.Size) (*image.RGBA, error)

Snapshot draws the scene into a new image of the size, without a window.

Flutter: no counterpart

Jump to

Keyboard shortcuts

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