jassub 2.5.16 → 2.5.17

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.
@@ -275,7 +275,6 @@ export class ASSRenderer {
275
275
  self.HEAPU8RAW.set(uint8, ptr)
276
276
  this._wasm.addFont('font-' + (this._fontId++), ptr, uint8.byteLength)
277
277
  }
278
- this._wasm.reloadFonts()
279
278
  }
280
279
 
281
280
  _resizeCanvas (width: number, height: number, videoWidth: number, videoHeight: number) {
@@ -300,6 +299,21 @@ export class ASSRenderer {
300
299
  this._gpurender.render(images, self.HEAPU8RAW)
301
300
  }
302
301
 
302
+ // single-frame readback for tests
303
+ _drawCapture (time: number) {
304
+ const images = (this._wasm.rawRender(time, 1) ?? []) as ASSImage[]
305
+ this._gpurender.render(images, self.HEAPU8RAW)
306
+
307
+ const canvas = this._gpurender.canvas
308
+ if (!canvas) return
309
+ const { width, height } = canvas
310
+ const surface = new OffscreenCanvas(width, height)
311
+ const ctx = surface.getContext('2d')
312
+ if (!ctx) return
313
+ ctx.drawImage(canvas, 0, 0)
314
+ return { data: ctx.getImageData(0, 0, width, height).data, width, height }
315
+ }
316
+
303
317
  _setColorSpace (videoColorSpace: 'RGB' | 'BT709' | 'BT601') {
304
318
  if (videoColorSpace === 'RGB') return
305
319
  this._videoColorSpace = videoColorSpace