From 8fb7b9aa167f5146f7fa056bfcc5580d292ed8aa Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Mon, 20 Nov 2023 23:00:46 +0800 Subject: [PATCH] clean up macos warnings --- macos/Classes/SwiftPolyvoxFilamentPlugin.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/macos/Classes/SwiftPolyvoxFilamentPlugin.swift b/macos/Classes/SwiftPolyvoxFilamentPlugin.swift index 4e439054..429206b9 100644 --- a/macos/Classes/SwiftPolyvoxFilamentPlugin.swift +++ b/macos/Classes/SwiftPolyvoxFilamentPlugin.swift @@ -14,7 +14,7 @@ public class SwiftFlutterFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture var pixelBufferAttrs = [ kCVPixelBufferPixelFormatTypeKey: NSNumber(value: kCVPixelFormatType_32ABGR ), kCVPixelBufferOpenGLCompatibilityKey: kCFBooleanTrue!, - kCVPixelBufferIOSurfacePropertiesKey: [:] + kCVPixelBufferIOSurfacePropertiesKey: [:] as CFDictionary ] as CFDictionary var resources:[UInt32:NSData] = [:] @@ -116,8 +116,9 @@ public class SwiftFlutterFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture result(unsafeBitCast(resourceLoaderWrapper, to:Int64.self)) case "getRenderCallback": let renderCallback = markTextureFrameAvailable - result([ - unsafeBitCast(renderCallback, to:Int64.self), unsafeBitCast(Unmanaged.passUnretained(self), to:UInt64.self)]) + let resultArray:[Any] = [ + unsafeBitCast(renderCallback, to:Int64.self), unsafeBitCast(Unmanaged.passUnretained(self), to:UInt64.self)] + result(resultArray) case "createTexture": let args = call.arguments as! [Any] let width = UInt32(args[0] as! Int64) @@ -147,8 +148,7 @@ public class SwiftFlutterFilamentPlugin: NSObject, FlutterPlugin, FlutterTexture return } metalTexture = CVMetalTextureGetTexture(cvMetalTexture!); - let pixelBufferPtr = CVPixelBufferGetBaseAddress(pixelBuffer!); - let pixelBufferAddress = Int(bitPattern:pixelBufferPtr); + let metalTexturePtr = Unmanaged.passUnretained(metalTexture!).toOpaque() let metalTextureAddress = Int(bitPattern:metalTexturePtr)