dont make ThermionFlutterTexture inherit from ThermionDartTexture
This commit is contained in:
@@ -2,20 +2,24 @@ import Foundation
|
|||||||
import GLKit
|
import GLKit
|
||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
|
|
||||||
public class ThermionFlutterTexture : ThermionDartTexture, FlutterTexture {
|
public class ThermionFlutterTexture : NSObject, FlutterTexture {
|
||||||
|
|
||||||
var flutterTextureId: Int64 = -1
|
var flutterTextureId: Int64 = -1
|
||||||
var registry: FlutterTextureRegistry
|
var registry: FlutterTextureRegistry
|
||||||
|
var texture: ThermionDartTexture
|
||||||
|
|
||||||
init(registry:FlutterTextureRegistry, width:Int64, height:Int64) {
|
init(registry:FlutterTextureRegistry, width:Int64, height:Int64) {
|
||||||
self.registry = registry
|
self.registry = registry
|
||||||
super.init(width:width, height:height)
|
self.texture = ThermionDartTexture(width:width, height: height)
|
||||||
|
super.init()
|
||||||
self.flutterTextureId = registry.register(self)
|
self.flutterTextureId = registry.register(self)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func copyPixelBuffer() -> Unmanaged<CVPixelBuffer>? {
|
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) {
|
public func onTextureUnregistered(_ texture:FlutterTexture) {
|
||||||
@@ -24,7 +28,7 @@ public class ThermionFlutterTexture : ThermionDartTexture, FlutterTexture {
|
|||||||
|
|
||||||
public func destroy() {
|
public func destroy() {
|
||||||
self.registry.unregisterTexture(self.flutterTextureId)
|
self.registry.unregisterTexture(self.flutterTextureId)
|
||||||
self.destroyTexture()
|
self.texture.destroyTexture()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user