fix: macos ptr access
This commit is contained in:
parent
6fd900c479
commit
4f059a9138
6 changed files with 72 additions and 56 deletions
|
|
@ -15,7 +15,7 @@ extern "C" {
|
|||
/// Keep the same name with Windows.
|
||||
void FlutterRgbaRendererPluginOnRgba(void* texture_rgba_ptr, const uint8_t* buffer, int width, int height) {
|
||||
TextRgba* texture_rgba = (__bridge TextRgba *)(texture_rgba_ptr);
|
||||
NSData* data = [NSData dataWithBytesNoCopy:(void*)buffer length:width * height * 4];
|
||||
NSData* data = [NSData dataWithBytesNoCopy:(void*)buffer length:width * height * 4 freeWhenDone:FALSE];
|
||||
[texture_rgba markFrameAvaliableWithData:data width:width height:height];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,10 +62,8 @@ public class TextureRgbaRendererPlugin: NSObject, FlutterPlugin {
|
|||
if (textureRgba == nil) {
|
||||
result(0)
|
||||
} else {
|
||||
let ptr = withUnsafePointer(to: textureRgba!) { p in
|
||||
return UnsafeRawPointer(p);
|
||||
};
|
||||
let intAddr = UInt(bitPattern: ptr)
|
||||
let unmanaged = Unmanaged.passUnretained(textureRgba!)
|
||||
let intAddr = UInt(bitPattern: unmanaged.toOpaque())
|
||||
result(intAddr)
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ A new Flutter plugin project.
|
|||
s.source_files = 'Classes/**/*'
|
||||
s.dependency 'FlutterMacOS'
|
||||
|
||||
s.platform = :osx, '10.14'
|
||||
s.platform = :osx, '10.11'
|
||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||
s.swift_version = '5.0'
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue