opt: add doc for macOS
This commit is contained in:
parent
4221adb1cb
commit
0e16af448c
2 changed files with 3 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ public final class TextRgba: NSObject, FlutterTexture {
|
||||||
public func markFrameAvaliable(data: Data, width: Int, height: Int) -> Bool {
|
public func markFrameAvaliable(data: Data, width: Int, height: Int) -> Bool {
|
||||||
self.data = data.withUnsafeBytes { buffer in
|
self.data = data.withUnsafeBytes { buffer in
|
||||||
var pixelBufferCopy: CVPixelBuffer!
|
var pixelBufferCopy: CVPixelBuffer!
|
||||||
|
// macOS only support 32BGRA currently.
|
||||||
let result = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, nil, &pixelBufferCopy)
|
let result = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, nil, &pixelBufferCopy)
|
||||||
guard result == kCVReturnSuccess else {
|
guard result == kCVReturnSuccess else {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -53,7 +54,7 @@ public final class TextRgba: NSObject, FlutterTexture {
|
||||||
}
|
}
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
if (textureId != -1) {
|
if (textureId != -1 && self.data != nil) {
|
||||||
registry?.textureFrameAvailable(textureId)
|
registry?.textureFrameAvailable(textureId)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue