Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions crates/labcolors-core/src/appearance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,14 @@ pub(crate) struct ProgramOccurrenceBindingV1 {
}

impl ProgramOccurrenceBindingV1 {
#[cfg(test)]
pub(crate) const fn occurrence(self) -> OccurrenceId {
self.occurrence
}

#[cfg(test)]
pub(crate) const fn subject(self) -> PaintId {
self.subject
}

#[cfg(test)]
pub(crate) const fn backdrop_surface(self) -> SurfaceId {
self.backdrop_surface
}
Expand Down Expand Up @@ -1217,7 +1214,6 @@ impl EncodedPointPaintV1 {
self.opacity
}

#[cfg(test)]
pub(crate) const fn opacity_bits(self) -> u64 {
self.opacity.bits()
}
Expand All @@ -1242,7 +1238,6 @@ impl SourceOverCertificateV1 {
.composite(self.subject_rgb, self.subject_opacity, self.backdrop_rgb)
}

#[cfg(test)]
pub(crate) const fn profile(&self) -> CompositionProfileV1 {
self.profile
}
Expand Down Expand Up @@ -1357,11 +1352,11 @@ pub(crate) struct VisiblePointBindingV1 {
}

impl VisiblePointBindingV1 {
pub(crate) fn program_occurrence(self) -> ProgramOccurrenceBindingV1 {
pub(crate) const fn program_occurrence(self) -> ProgramOccurrenceBindingV1 {
self.program_occurrence
}

pub(crate) fn occurrence(self) -> SourceOverCertificateV1 {
pub(crate) const fn occurrence(self) -> SourceOverCertificateV1 {
self.occurrence
}

Expand Down
1 change: 0 additions & 1 deletion crates/labcolors-core/src/constraints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ impl<Binding, Identity, Release, Capability, Invocation, Measurement>
&self.invocation
}

#[cfg(test)]
pub(crate) fn measurement(&self) -> &Measurement {
&self.measurement
}
Expand Down
2 changes: 1 addition & 1 deletion crates/labcolors-core/src/constraints/wcag22.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub(crate) struct ApplicableWcag22MeasurementV1 {
evidence: NumericalDecisionEvidenceV1,
}

#[cfg(test)]
impl ApplicableWcag22MeasurementV1 {
pub(crate) const fn profile_id(&self) -> Wcag22ProfileIdV1 {
self.profile_id
Expand All @@ -44,6 +43,7 @@ impl ApplicableWcag22MeasurementV1 {
&self.measurement
}

#[cfg(test)]
pub(crate) const fn decision(&self) -> Wcag22ApplicableDecisionV1 {
self.decision
}
Expand Down
23 changes: 18 additions & 5 deletions crates/labcolors-core/src/lcs_occurrence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ pub struct ColorSignal {
output_profile: OutputProfileId,
}

/// Exhaustive internal decomposition for boundaries that must preserve the
/// signal profile instead of treating encoded bytes as self-describing.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ColorSignalViewV1 {
Iec61966Srgb8D65(Srgb8),
}

impl ColorSignal {
/// Form the only admitted encoded signal without accepting a free-form
/// channel/profile pairing.
Expand All @@ -45,6 +52,12 @@ impl ColorSignal {
pub(crate) const fn output_profile(self) -> OutputProfileId {
self.output_profile
}

pub(crate) const fn view(self) -> ColorSignalViewV1 {
match self.output_profile {
OutputProfileId::Iec61966Srgb8D65V1 => ColorSignalViewV1::Iec61966Srgb8D65(self.srgb8),
}
}
}

/// Exact code release for one colorimetric signal-to-tristimulus transform.
Expand Down Expand Up @@ -321,6 +334,8 @@ fn derive_sample_with_binding(
signal: ColorSignal,
binding: AdmittedSrgb8TristimulusBindingV1,
) -> Result<TristimulusSample, TristimulusDomainErrorV1> {
#[cfg(test)]
MODELED_TRISTIMULUS_DERIVATION_CALLS.with(|calls| calls.set(calls.get() + 1));
let xyz = match (
signal.output_profile(),
binding.signal_output_profile(),
Expand All @@ -337,9 +352,9 @@ fn derive_sample_with_binding(

#[cfg(test)]
thread_local! {
/// Per-thread count of modeled signal-to-tristimulus derivations. Program
/// regression tests use this deterministic metric to pin one derivation
/// per unique target occurrence and physical case without timing noise.
/// Per-thread count of modeled signal-to-tristimulus kernel executions.
/// Counting below both initial derivation and replay keeps a projection
/// from hiding recomputation behind the replay API.
pub(crate) static MODELED_TRISTIMULUS_DERIVATION_CALLS: std::cell::Cell<u64> =
const { std::cell::Cell::new(0) };
}
Expand All @@ -352,8 +367,6 @@ thread_local! {
pub(crate) fn derive_modeled_tristimulus_v1(
signal: ColorSignal,
) -> Result<ModeledTristimulusDerivationV1, TristimulusDomainErrorV1> {
#[cfg(test)]
MODELED_TRISTIMULUS_DERIVATION_CALLS.with(|calls| calls.set(calls.get() + 1));
let binding = admitted_binding(signal.output_profile());
let sample = derive_sample_with_binding(signal, binding)?;
Ok(ModeledTristimulusDerivationV1 {
Expand Down
8 changes: 8 additions & 0 deletions crates/labcolors-core/src/observation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ impl ObservationStreamId {
pub(crate) const fn new(raw: u32) -> Self {
Self(raw)
}

pub(crate) const fn value(self) -> u32 {
self.0
}
}

/// Monotonic revision inside one [`ObservationStreamId`].
Expand All @@ -54,6 +58,10 @@ impl ScenarioId {
pub(crate) const fn new(raw: u32) -> Self {
Self(raw)
}

pub(crate) const fn value(self) -> u32 {
self.0
}
}

/// Opaque reason why the current observation is unavailable.
Expand Down
Loading
Loading