Skip to main content

Module tiles

Module tiles 

Source
Expand description

Tiles: squares of a drawing, 256 device pixels a side, painted at one scale in one theme — where each is in the design, the pyramid’s levels, the cache that keeps them and marks the ones damage makes stale, and the frame plan a browser canvas carries out.

Structs§

Cache
Painted tiles, keyed by theme, level, column and row, holding at most cap of cost — bytes of pixels, or a count — the least recently used dropped first. Damage marks the tiles it overlaps stale; a stale tile is still there, and says so, until it is painted again. What a tile holds is the cache’s user’s: pixels in the server, a texture on the GPU.
Key
A tile: its theme, its level, and its column and row from the drawing’s top-left.
Level
A scale tiles are painted at, to a 1/1024th: a level of the pyramid.
Plan
One canvas’s frame plan.
View
A view of a drawing: width × height device pixels showing the drawing scaled by zoom, its top-left at origin, a whole device pixel.
Work
A frame’s work: the paintings to draw, bottom first, each where it lands in the view, in device pixels; the tiles to paint next, each under its ticket; the paintings to free; and how many tiles of the view at its own level are missing or stale — 0 when the frame shows the view current.

Enums§

Arrival
What became of a painting that arrived.

Constants§

BUDGET
The most tiles a canvas has in flight at once.
CAP
The most tiles a canvas holds: more than a 4K screen at a device pixel ratio of 2 shows, about 160, so a view never evicts its own.
TILE
A tile’s side, in device pixels.

Traits§

Tiled
What a cache keys its tiles by: a tile’s Key, with whatever else tells the cache’s tiles apart — a server’s design, say.

Functions§

square
The design-coordinate square of tile (col, row) at scale of a drawing whose top-left is origin.
tile_rect
The design-coordinate square of tile (col, row) at scale, from the drawing’s top-left.

Type Aliases§

Ticket
What a host knows a painting by: given when a tile is asked for, never given again by any plan, so an answer for the design a canvas showed before matches nothing.