Skip to documentation
SLOP

tiny.ui.fact

Reference tiny.ui fact

Defined in tiny.ui.

API (20)

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

No direct callersNo direct callstiny.uifact
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/ui/src/fact/records.zig:25

zig
pub const Clip = extern struct {    rect: abi.Rect = .{},    origin_x: f32 = 0,    origin_y: f32 = 0,    scroll_x: f32 = 0,    scroll_y: f32 = 0,    parent: u32 = 0,    flags: u32 = 0,};

Source: lib/ui/src/fact/records.zig:60

zig
pub const Cluster = extern struct {    byte_start: u32 = 0,    byte_end: u32 = 0,    advance: f32 = 0,    glyph: u32 = 0,    face: u32 = 0,    columns: u8 = 0,    flags: u8 = 0,    _pad: u16 = 0,};

Source: lib/ui/src/fact/records.zig:9

zig
pub const Fact = extern struct {    id: u64 = 0,    revision: u64 = 0,    rect: abi.Rect = .{},    clip: u32 = 0,    paint: u32 = 0,    text: u32 = 0,    state: u32 = 0,    role: u16 = 0,    kind: u16 = 0,    flags: u16 = 0,    focus_index: u16 = 0xffff,    name: u32 = 0,    action: u32 = 0,};

Source: lib/ui/src/fact/records.zig:35

zig
pub const TextLayout = extern struct {    line_first: u32 = 0,    line_count: u32 = 0,    width: f32 = 0,    height: f32 = 0,};

Source: lib/ui/src/fact/records.zig:42

zig
pub const TextLine = extern struct {    span_first: u32 = 0,    span_count: u32 = 0,    origin_x: f32 = 0,    baseline_y: f32 = 0,    width: f32 = 0,    height: f32 = 0,};

Source: lib/ui/src/fact/records.zig:51

zig
pub const TextSpan = extern struct {    cluster_first: u32 = 0,    cluster_count: u32 = 0,    origin_x: f32 = 0,    width: f32 = 0,    paint: u32 = 0,    text_style: u32 = 0,};

Source: lib/ui/src/fact/records.zig:71

zig
pub const TextTables = struct {    layouts: []const TextLayout,    lines: []const TextLine,    spans: []const TextSpan,    clusters: []const Cluster,};

Source: lib/ui/src/fact/records.zig:78

zig
pub const UnitMetrics = extern struct {    device_per_unit_x: f32 = 1,    device_per_unit_y: f32 = 1,    snap_x: f32 = 1,    snap_y: f32 = 1,    root_font_size: f32 = 16,    cell_advance: f32 = 1,    cell_height: f32 = 1,    flags: u32 = 0,};

Source: lib/ui/src/fact/store.zig:25

zig
pub const Store = struct {    pub const claim: alloc_phase.capacity.Declaration = .{        .source = .{            .id = "ui.fact_store",            .kind = .phase_static,            .limit_source = .caller,            .storage = .{                .covered = &.{.{                    .id = "retained_fact_arrays",                    .lifetime = .steady,                    .detail = "two arrays of Limits.nodes Fact records; the current and prior frame occupy one array each",                }},                .excluded = &.{                    "the tree store's node identity map and the damage owner's changed-node list",                    "paint, image, text, and clip tables owned by their respective emitters",                },            },            .capacity = .{                .inputs = &.{alloc_phase.capacity.bindInput(Limits, "nodes", "nodes")},                .type_selectors = &.{alloc_phase.capacity.bindType(Fact, "fact")},                .nodes = &.{                    .{ .input = 0 },                    .{ .scale = .{ .node = 0, .coefficient = .{ .size_of_concrete_type = 0 } } },                    .{ .add = .{ .left = 1, .right = 1 } },                },                .assertions = &.{.{                    .scope = .closure_total,                    .measure = .retained,                    .relation = .exact,                    .expression = 2,                }},            },            .overload = .{                .kind = .reject_before_seal,                .detail = "publish rejects a fact count above Limits.nodes before writing either retained array",            },            .risks = .{                .transitive = .{                    .status = .open,                    .detail = "publish copies caller facts without an allocator; a machine certificate of the call graph remains open",                },                .foreign = .{                    .status = .excluded,                    .detail = "fact emission is an in-process copy and calls no foreign runtime",                },            },            .obligations = &.{                .{ .key = "ui_fact_capacity", .role = .capacity_model },                .{ .key = "ui_fact_acquisition", .role = .acquisition },                .{ .key = "ui_fact_oom", .role = .initialization_failure },                .{ .key = "ui_fact_teardown", .role = .teardown },            },        },        .bindings = .{            .owner = @This(),            .seal = .{                .family = alloc_phase.capacity.selector(@This().activate),                .premise = .{ .class = .checked_semantic_fact, .authority = .checker },            },            .teardown = .{                .family = alloc_phase.capacity.selector(@This().deinit),                .premise = .{ .class = .checked_semantic_fact, .authority = .checker },            },        },    };    phase: alloc_phase.capacity.Phase,    limits: Limits,    capacity: Capacity,    storage: []Fact,    arrays: [2][]Fact,    counts: [2]u32 = @splat(0),    live: u1 = 0,    pub fn init(allocator: Allocator, limits: Limits) (error{CapacityOverflow} || Allocator.Error)!Store {        const capacity = try Capacity.derive(limits);        const count = std.math.mul(usize, limits.nodes, 2) catch return error.CapacityOverflow;        const storage = try allocator.alloc(Fact, count);        return .{            .phase = .initialization,            .limits = limits,            .capacity = capacity,            .storage = storage,            .arrays = .{ storage[0..limits.nodes], storage[limits.nodes..] },        };    }    pub fn activate(self: *Store) void {        std.debug.assert(self.phase == .initialization);        self.phase = .steady;    }    pub fn publish(self: *Store, facts: []const Fact) error{FactCapacityExceeded}!void {        std.debug.assert(self.phase == .steady);        if (facts.len > self.limits.nodes) return error.FactCapacityExceeded;        const next = self.live ^ 1;        @memcpy(self.arrays[next][0..facts.len], facts);        self.counts[next] = @intCast(facts.len);        self.live = next;    }    pub fn retained(self: *const Store) []const Fact {        std.debug.assert(self.phase == .steady);        return self.arrays[self.live][0..self.counts[self.live]];    }    pub fn prior(self: *const Store) []const Fact {        std.debug.assert(self.phase == .steady);        const other = self.live ^ 1;        return self.arrays[other][0..self.counts[other]];    }    pub fn deinit(self: *Store, allocator: Allocator) void {        std.debug.assert(self.phase != .teardown);        self.phase = .teardown;        allocator.free(self.storage);        self.storage = &.{};    }};
Called byCallsNo direct callstest sourcelib.ui.src.fact.storetest: ui fact acquisition retains the...test sourcelib.ui.src.fact.storetest: ui fact teardown releases both ...fact.Storeactivate
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.ui.src.fact.storetest: ui fact acquisition retains the...test sourcelib.ui.src.fact.storetest: ui fact teardown releases both ...fact.Storedeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallstest sourcelib.ui.src.fact.storetest: ui fact acquisition retains the...test sourcelib.ui.src.fact.storetest: ui fact oom leaves no partial a...test sourcelib.ui.src.fact.storetest: ui fact teardown releases both ...private sourcelib.ui.src.fact.store.Capacityderivefact.Storeinit
Static calls · unresolved targets: 0 · external targets: 1.
Called byCallsNo direct callstest sourcelib.ui.src.fact.storetest: ui fact acquisition retains the...fact.Storeprior
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.ui.src.fact.storetest: ui fact acquisition retains the...fact.Storepublish
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callstest sourcelib.ui.src.fact.storetest: ui fact acquisition retains the...fact.Storeretained
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/ui/src/fact/unit.zig:5

zig
pub fn deviceRect(rect: abi.Rect, metrics: UnitMetrics) abi.IRect {    std.debug.assert(std.math.isFinite(rect.x));    std.debug.assert(std.math.isFinite(rect.y));    std.debug.assert(std.math.isFinite(rect.width));    std.debug.assert(std.math.isFinite(rect.height));    std.debug.assert(rect.width >= 0);    std.debug.assert(rect.height >= 0);    std.debug.assert(metrics.device_per_unit_x > 0);    std.debug.assert(metrics.device_per_unit_y > 0);    std.debug.assert(metrics.snap_x > 0);    std.debug.assert(metrics.snap_y > 0);    std.debug.assert(std.math.isFinite(metrics.device_per_unit_x));    std.debug.assert(std.math.isFinite(metrics.device_per_unit_y));    std.debug.assert(std.math.isFinite(metrics.snap_x));    std.debug.assert(std.math.isFinite(metrics.snap_y));    const left = @floor(rect.x * metrics.device_per_unit_x / metrics.snap_x) * metrics.snap_x;    const top = @floor(rect.y * metrics.device_per_unit_y / metrics.snap_y) * metrics.snap_y;    const right = @ceil((rect.x + rect.width) * metrics.device_per_unit_x / metrics.snap_x) *        metrics.snap_x;    const bottom = @ceil((rect.y + rect.height) * metrics.device_per_unit_y / metrics.snap_y) *        metrics.snap_y;    std.debug.assert(left >= std.math.minInt(i32));    std.debug.assert(top >= std.math.minInt(i32));    std.debug.assert(right < 2_147_483_648);    std.debug.assert(bottom < 2_147_483_648);    std.debug.assert(right >= left);    std.debug.assert(bottom >= top);    std.debug.assert(right - left < 4_294_967_296);    std.debug.assert(bottom - top < 4_294_967_296);    return .{        .x = @intFromFloat(left),        .y = @intFromFloat(top),        .width = @intFromFloat(right - left),        .height = @intFromFloat(bottom - top),    };}
Called byCallsNo direct callstest sourcelib.ui.src.fact.unittest: deviceRect covers fractional fa...test sourcelib.ui.src.fact.unittest: deviceRect scales before roundi...test sourcelib.ui.src.fact.unittest: deviceRect snaps outward on a c...factdeviceRect
Static calls · unresolved targets: 0 · external targets: 0.

Source: lib/ui/src/fact/root.zig

zig
const records = @import("records.zig");const unit = @import("unit.zig");pub const Fact = records.Fact;pub const Clip = records.Clip;pub const Paint = records.Paint;pub const ImagePaint = records.ImagePaint;pub const TextStyle = records.TextStyle;pub const TextLayout = records.TextLayout;pub const TextLine = records.TextLine;pub const TextSpan = records.TextSpan;pub const Cluster = records.Cluster;pub const TextTables = records.TextTables;pub const UnitMetrics = records.UnitMetrics;pub const deviceRect = unit.deviceRect;pub const Store = @import("store.zig").Store;

Source: lib/ui/src/root.zig:12

zig
pub const fact = @import("fact/root.zig");

Audit

Definitions18
Public names18
Members63
Version26.7.0
Revisiondaab053ee433