Retain closed raw-pointer identities for late frames, release frame buffers after engine completion, and serialize termination with decoded frame writes. Add native regression controls for held raster buffers, inline completion, failed raster posts, missing registrations, teardown and concurrent closure. B252; Apache-2.0 dependency license and upstream history preserved.
46 lines
1.7 KiB
Dart
46 lines
1.7 KiB
Dart
// Modified by the Kitedesk fork (2026, B212/B252): closeTexture ownership.
|
|
import 'dart:typed_data';
|
|
|
|
export './texture_rgba_ffi.dart' show Native;
|
|
|
|
import 'texture_rgba_renderer_platform_interface.dart';
|
|
|
|
class TextureRgbaRenderer {
|
|
/// Create a texture with unique [key].
|
|
///
|
|
/// @return a texture id which can be used with
|
|
/// ```dart
|
|
/// Texture(textureId: textureId)
|
|
/// ```
|
|
Future<int> createTexture(int key) {
|
|
return TextureRgbaRendererPlatform.instance.createTexture(key);
|
|
}
|
|
|
|
/// Close a texture with unique identifier [key].
|
|
///
|
|
/// Pass [recycle] = true only when nothing calls `onRgba` with the pointer
|
|
/// from [getTexturePtr] any more. On Linux the texture is then kept for the
|
|
/// next [createTexture] of the same window (Kitedesk fork, B212).
|
|
/// On Windows it may be destroyed only after the engine finishes unregistering
|
|
/// it. Without [recycle], Windows retains its closed identity for the process
|
|
/// lifetime so late raw-pointer frames cannot reach freed or reused memory;
|
|
/// its frame buffers are freed after unregistering (Kitedesk fork, B252).
|
|
/// Other platforms ignore [recycle].
|
|
///
|
|
/// @return a boolean to indicate whether the operation is sucessfully executed.
|
|
Future<bool> closeTexture(int key, {bool recycle = false}) {
|
|
return TextureRgbaRendererPlatform.instance
|
|
.closeTexture(key, recycle: recycle);
|
|
}
|
|
|
|
/// Provide the rgba data to the texture.
|
|
Future<bool> onRgba(
|
|
int key, Uint8List data, int height, int width, int strideAlign) {
|
|
return TextureRgbaRendererPlatform.instance
|
|
.onRgba(key, data, height, width, strideAlign);
|
|
}
|
|
|
|
Future<int> getTexturePtr(int key) {
|
|
return TextureRgbaRendererPlatform.instance.getTexturePtr(key);
|
|
}
|
|
}
|