mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
The same NativeScript conversion leak as the frame path (see java-direct-buffer.ts) applied to every other ArrayBuffer handed to a Java ByteBuffer parameter: - Shell scenes (submitShellScene on the bridge and the preview display), submitted on every shell render, which the frame-path fix predates. These now go through a reused JavaDirectBuffer like frames do. - Glyph, firmware-glyph and image atlas registration, Mapbox image decode, the preview placeholder bitmap, firmware hash/write, binary file writes and the EvenHub privacy-policy download, plus the Kotlin protocol smoke test. These are rare or large, so they cross through a new copyToJavaByteBuffer: a fresh Java direct buffer per call that is freed normally, rather than one pinned for the life of the isolate. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
10 lines
547 B
TypeScript
10 lines
547 B
TypeScript
import { grayImageFromPacket } from './image-files'
|
|
import { type GrayImage } from '../graphics/image'
|
|
import { copyToJavaByteBuffer } from './java-direct-buffer'
|
|
declare const com: any
|
|
|
|
/** The encoded bytes cross as a fresh Java buffer; passing the ArrayBuffer leaks it (java-direct-buffer.ts). */
|
|
export function decodeImageBytes(bytes: ArrayBuffer, width: number, height: number): GrayImage | null {
|
|
return grayImageFromPacket(com.faceclaw.app.ImageFileLoader.loadGrayFromBytes(copyToJavaByteBuffer(new Uint8Array(bytes)), width, height))
|
|
}
|