dont make ThermionFlutterTexture inherit from ThermionDartTexture

This commit is contained in:
Nick Fisher
2024-06-19 13:19:04 +08:00
parent 1f58717635
commit 3468e7da55

View File

@@ -2,20 +2,24 @@ import Foundation
import GLKit
import FlutterMacOS
public class ThermionFlutterTexture : ThermionDartTexture, FlutterTexture {
public class ThermionFlutterTexture : NSObject, FlutterTexture {
var flutterTextureId: Int64 = -1
var registry: FlutterTextureRegistry
var texture: ThermionDartTexture
init(registry:FlutterTextureRegistry, width:Int64, height:Int64) {
self.registry = registry
super.init(width:width, height:height)
self.texture = ThermionDartTexture(width:width, height: height)
super.init()
self.flutterTextureId = registry.register(self)
}
public func copyPixelBuffer() -> Unmanaged<CVPixelBuffer>? {
return Unmanaged.passRetained(pixelBuffer!);
if(self.texture.pixelBuffer == nil) {
return nil
}
return Unmanaged.passRetained(self.texture.pixelBuffer!);
}
public func onTextureUnregistered(_ texture:FlutterTexture) {
@@ -24,7 +28,7 @@ public class ThermionFlutterTexture : ThermionDartTexture, FlutterTexture {
public func destroy() {
self.registry.unregisterTexture(self.flutterTextureId)
self.destroyTexture()
self.texture.destroyTexture()
}
}
}