Skip to content

Commit

Permalink
note transform/style invariant in Encoding docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dfrg committed Feb 13, 2024
1 parent 5c298da commit 595ef62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/encoding/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ use {
};

/// Encoded data streams for a scene.
///
/// # Invariants
///
/// * At least one transform and style must be encoded before any path data
/// or draw object.
#[derive(Clone, Default)]
pub struct Encoding {
/// The path tag stream.
Expand Down
2 changes: 2 additions & 0 deletions shader/flatten.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ fn compute_tag_monoid(ix: u32) -> PathTagData {
var tag_byte = (tag_word >> shift) & 0xffu;
// We no longer encode an initial transform and style so these
// are off by one.
// Note: an alternative would be to adjust config.transform_base and
// config.style_base.
tm.trans_ix -= 1u;
tm.style_ix -= STYLE_SIZE_IN_WORDS;
return PathTagData(tag_byte, tm);
Expand Down

0 comments on commit 595ef62

Please sign in to comment.