Documentation
¶
Overview ¶
Package gputest has what the display tests of the GPU renderers share: the scenes the renderers are compared on, the comparison with the software renderer's image, and its tolerance. It is test support and has no Flutter counterpart.
Index ¶
- Constants
- Variables
- func CanvasScene(fn func(c *ui.Canvas)) *ui.Scene
- func DamagePicture(rect ui.Rect) *ui.Picture
- func DamageScene(pics ...*ui.Picture) *ui.Scene
- func EvenStops(n int) []float64
- func FillPaint(argb uint32) *ui.Paint
- func Pattern(n int) *ui.Image
- func PictureOf(fn func(c *ui.Canvas)) *ui.Picture
- func RetainedFrames(n int, clip func(b *ui.SceneBuilder)) []*ui.Scene
- func Scale4(s float32) *ui.Matrix4
- func ShaderPaint(sh ui.Shader) *ui.Paint
- func StarPath() *ui.Path
- func StripesAndDisc(c *ui.Canvas)
- func StrokePaint(argb uint32, width float64, cap ui.StrokeCap, join ui.StrokeJoin) *ui.Paint
- type Diff
- type EffectScene
- type ShapeScene
- type Tolerance
Constants ¶
const EffectSize = 128
EffectSize is the width and height of the surface of the effect scenes.
const ShapeSize = 128
ShapeSize is the width and height of the surface of the shape scenes.
Variables ¶
var ProofTolerances = map[string]Tolerance{
"shapes-basic": {Over8Permille: 20, Over32Permille: 5},
"shapes-clips": {Over8Permille: 30, Over32Permille: 3},
"gradients": {Over8Permille: 10, Over32Permille: 3},
"blend-modes": {Over8Permille: 15, Over32Permille: 5},
"effects": {Over8Permille: 1},
"text-tour": {Over8Permille: 1},
"decorations": {Over8Permille: 3, Over32Permille: 1},
"rendering-tour": {Over8Permille: 1},
}
ProofTolerances is how far the GPU renderers may be from the software renderer in each proof scene (the scenes are the goldens of the proof tool, SPEC §9.2). A scene that is registered without an entry here fails the parity tests, so a step that adds one states its tolerance.
Flutter: no counterpart
Functions ¶
func CanvasScene ¶
CanvasScene is a scene of one picture: a white background, then what fn draws.
func DamagePicture ¶
DamagePicture is a picture of one rectangle, for the tests of damage tracking.
Flutter: no counterpart
func Pattern ¶
Pattern is an n x n image of a color gradient with a grid and a transparent corner, to show orientation, filtering and alpha.
func RetainedFrames ¶
func RetainedFrames(n int, clip func(b *ui.SceneBuilder)) []*ui.Scene
RetainedFrames makes the scenes of a retained layer: the layer is built in the first and added again in the others, as a RepaintBoundary that does not change.
Flutter: no counterpart
func StripesAndDisc ¶
StripesAndDisc is something with an edge and a gradient to put layers over.
func StrokePaint ¶
StrokePaint is a stroking paint of the color with the width, cap and join.
Types ¶
type Diff ¶
type Diff struct {
Pixels, Over8, Over32, Over96, Max int
}
Diff compares two images inside a rectangle: the number of pixels whose largest channel difference is above each threshold, and the largest difference.
type EffectScene ¶
type EffectScene struct {
Name string
Tolerance Tolerance
// Build makes the scene, EffectSize pixels square.
Build func() *ui.Scene
}
EffectScene is a drawing of the paint shaders, color filters, blend modes and layers, with the tolerance the GPU renderers are held to against the software renderer.
func EffectScenes ¶
func EffectScenes() []EffectScene
EffectScenes returns the drawings of gradients, image shaders, color filters, blend modes, vertices and layers that both GPU renderers are compared with the software renderer on.
type ShapeScene ¶
type ShapeScene struct {
Name string
// Over8Permille, Over32Permille and Over96 are the Tolerance.
Over8Permille, Over32Permille, Over96 int
Draw func(c *ui.Canvas)
}
ShapeScene is a drawing of analytic shapes on a surface of ShapeSize pixels, with the tolerance the GPU renderers are held to against the software renderer.
func ShapeScenes ¶
func ShapeScenes() []ShapeScene
ShapeScenes returns the drawings of shapes, clips and the blend modes of the blend unit that both GPU renderers are compared with the software renderer on.
func (ShapeScene) Tolerance ¶
func (s ShapeScene) Tolerance() Tolerance
Tolerance returns the scene's tolerance.
type Tolerance ¶
type Tolerance struct{ Over8Permille, Over32Permille, Over96 int }
Tolerance is how far a GPU image may be from the software renderer's in a region: of its pixels, at most Over8Permille differ by more than 8 levels (the edges, where the distance field and the exact area differ a little), at most Over32Permille by more than 32, and at most Over96 pixels by more than 96.