@glissade/backend-skia 0.11.0 → 0.12.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -27,6 +27,15 @@ declare class SkiaBackend implements RenderBackend {
27
27
  render(list: DisplayList): void;
28
28
  /** Raw RGBA — the FFmpeg pipe path (§5.1d). Resolves synchronously (no GPU readback) but typed Promise to match the RenderBackend contract. */
29
29
  readPixels(): Promise<Uint8ClampedArray>;
30
+ /**
31
+ * §3.5 disk-cache HIT path: blit stored straight-RGBA into the canvas so the
32
+ * IDENTICAL `encodePng()` / `readPixels()` downstream runs over it. A
33
+ * `render(dl)→encodePng()` and a `putPixels(readPixels(dl))→encodePng()` are
34
+ * byte-identical (the putImageData round-trip preserves bytes), which is what
35
+ * makes a frame-cache hit byte-equal to a cold render. The buffer length must
36
+ * be `width*height*4`.
37
+ */
38
+ putPixels(rgba: Uint8ClampedArray): void;
30
39
  /** Deterministic PNG bytes for golden frames and `gs render` output. */
31
40
  encodePng(): Buffer;
32
41
  dispose(): void;
package/dist/index.js CHANGED
@@ -66,6 +66,23 @@ var SkiaBackend = class {
66
66
  const ctx = this.canvas.getContext("2d");
67
67
  return Promise.resolve(ctx.getImageData(0, 0, this.canvas.width, this.canvas.height).data);
68
68
  }
69
+ /**
70
+ * §3.5 disk-cache HIT path: blit stored straight-RGBA into the canvas so the
71
+ * IDENTICAL `encodePng()` / `readPixels()` downstream runs over it. A
72
+ * `render(dl)→encodePng()` and a `putPixels(readPixels(dl))→encodePng()` are
73
+ * byte-identical (the putImageData round-trip preserves bytes), which is what
74
+ * makes a frame-cache hit byte-equal to a cold render. The buffer length must
75
+ * be `width*height*4`.
76
+ */
77
+ putPixels(rgba) {
78
+ const w = this.canvas.width;
79
+ const h = this.canvas.height;
80
+ if (rgba.length !== w * h * 4) throw new Error(`putPixels: expected ${w * h * 4} RGBA bytes for ${w}x${h}, got ${rgba.length}`);
81
+ const ctx = this.canvas.getContext("2d");
82
+ const img = ctx.createImageData(w, h);
83
+ img.data.set(rgba);
84
+ ctx.putImageData(img, 0, 0);
85
+ }
69
86
  /** Deterministic PNG bytes for golden frames and `gs render` output. */
70
87
  encodePng() {
71
88
  return this.canvas.toBuffer("image/png");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissade/backend-skia",
3
- "version": "0.11.0",
3
+ "version": "0.12.0-pre.0",
4
4
  "description": "glissade headless render backend: DisplayList -> @napi-rs/canvas (Skia). Node-only; the CI-grade deterministic path.",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@napi-rs/canvas": "^0.1.65",
22
- "@glissade/core": "0.11.0",
23
- "@glissade/scene": "0.11.0"
22
+ "@glissade/core": "0.12.0-pre.0",
23
+ "@glissade/scene": "0.12.0-pre.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",