Imaging: implement the optional Skia codec adapter #41

Closed
opened 2026-08-08 08:17:25 +00:00 by hugo · 1 comment
Owner

Objective

Implement SkiaTextureCodec with conversions only at the imaging abstraction boundary.

Deliverables

  • Map ManagedImage layouts to and from Skia safely.
  • Preserve requested encoding, resize, color behavior, and typed errors.
  • Keep Skia optional and document native/binary-cache builds on macOS, Linux, and Windows.

Validation

  • All translated Skia adapter tests pass under the feature.
  • Core/default workspace builds without Skia.
  • Cross-platform feature builds and packaging checks succeed.

Prerequisite

Types and StructuredData are implemented and the global API/test gates are complete.

Project constraints

  • Native Rust implementation only; optional third-party native codecs stay behind documented features.
  • Keep mapped signatures fixed and preserve translated geometry/pixel assertions exactly.
  • Enforce checked sizes and indices, then update docs and coverage status.
## Objective Implement SkiaTextureCodec with conversions only at the imaging abstraction boundary. ## Deliverables - Map ManagedImage layouts to and from Skia safely. - Preserve requested encoding, resize, color behavior, and typed errors. - Keep Skia optional and document native/binary-cache builds on macOS, Linux, and Windows. ## Validation - All translated Skia adapter tests pass under the feature. - Core/default workspace builds without Skia. - Cross-platform feature builds and packaging checks succeed. ## Prerequisite Types and StructuredData are implemented and the global API/test gates are complete. ## Project constraints - Native Rust implementation only; optional third-party native codecs stay behind documented features. - Keep mapped signatures fixed and preserve translated geometry/pixel assertions exactly. - Enforce checked sizes and indices, then update docs and coverage status.
hugo added this to the 06 - Imaging and PrimMesher implementation milestone 2026-08-08 08:17:25 +00:00
hugo added the enhancement label 2026-08-08 08:17:25 +00:00
Author
Owner

Implemented and pushed in commit 4849bbd.

Implementation:

  • Replaced all three generated SkiaTextureCodec shims with native Rust constructor, bounded stream decode, and SKBitmap-to-ManagedImage conversion.
  • Added a checked project-owned bitmap boundary; no skia-safe/native type leaks into the core imaging trait.
  • Matched the pinned C# RGB565, BGRA/RGBA8888, RGBA/BGRA1010102, Gray8, Alpha8, row-stride fallback, channel-order, bit-scaling, and premultiplied-to-straight-alpha behavior.
  • Bounded encoded input at 64 MiB, decoded images at 16,777,216 pixels, native decode memory, row strides, indices, and owned allocations; malformed/unsupported/over-limit paths return typed errors.
  • Kept Skia fully optional. The skia feature uses skia-safe 0.99.0 and published WebP-capable binary-cache feature sets for Linux, macOS, and Windows. Added build/licensing/cache documentation and a three-platform cache-only workflow.

Verification:

  • cargo test -p libremetaverse-imaging-skia --no-default-features: 4 passed.
  • cargo test -p libremetaverse-imaging-skia --features skia: 6 passed, including independent PNG and WebP fixtures, malformed input, every mapped pixel branch, padding, alpha normalization, and typed rejection.
  • Controlled full suite: 208 passed, 1,200 expected standardized failures, 0 ignored with live credentials; no unrelated failures.
  • Passed format, mapping/shim generation, API coverage, default workspace check, locked downstream API compile, workspace no-run, workspace all-features Clippy with warnings denied, docs, diff, and package-list gates.

Gitea queued Skia workflow run 15 for commit 4849bbd, with Linux/macOS/Windows jobs. The repository currently reports zero registered Actions runners, so those remote jobs remain queued until runner infrastructure is attached; the Linux cache-only feature build was exercised locally and the published cache matrix was verified for all three target families.

Implemented and pushed in commit 4849bbd. Implementation: - Replaced all three generated SkiaTextureCodec shims with native Rust constructor, bounded stream decode, and SKBitmap-to-ManagedImage conversion. - Added a checked project-owned bitmap boundary; no skia-safe/native type leaks into the core imaging trait. - Matched the pinned C# RGB565, BGRA/RGBA8888, RGBA/BGRA1010102, Gray8, Alpha8, row-stride fallback, channel-order, bit-scaling, and premultiplied-to-straight-alpha behavior. - Bounded encoded input at 64 MiB, decoded images at 16,777,216 pixels, native decode memory, row strides, indices, and owned allocations; malformed/unsupported/over-limit paths return typed errors. - Kept Skia fully optional. The skia feature uses skia-safe 0.99.0 and published WebP-capable binary-cache feature sets for Linux, macOS, and Windows. Added build/licensing/cache documentation and a three-platform cache-only workflow. Verification: - cargo test -p libremetaverse-imaging-skia --no-default-features: 4 passed. - cargo test -p libremetaverse-imaging-skia --features skia: 6 passed, including independent PNG and WebP fixtures, malformed input, every mapped pixel branch, padding, alpha normalization, and typed rejection. - Controlled full suite: 208 passed, 1,200 expected standardized failures, 0 ignored with live credentials; no unrelated failures. - Passed format, mapping/shim generation, API coverage, default workspace check, locked downstream API compile, workspace no-run, workspace all-features Clippy with warnings denied, docs, diff, and package-list gates. Gitea queued Skia workflow run 15 for commit 4849bbd, with Linux/macOS/Windows jobs. The repository currently reports zero registered Actions runners, so those remote jobs remain queued until runner infrastructure is attached; the Linux cache-only feature build was exercised locally and the published cache matrix was verified for all three target families.
hugo closed this issue 2026-08-09 04:16:09 +00:00
Sign in to join this conversation.