opt: add doc for macOS

This commit is contained in:
Kingtous 2023-02-17 01:52:16 -08:00
parent 4221adb1cb
commit 0e16af448c
2 changed files with 3 additions and 1 deletions

View file

@ -1,3 +1,4 @@
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';

View file

@ -33,6 +33,7 @@ public final class TextRgba: NSObject, FlutterTexture {
public func markFrameAvaliable(data: Data, width: Int, height: Int) -> Bool {
self.data = data.withUnsafeBytes { buffer in
var pixelBufferCopy: CVPixelBuffer!
// macOS only support 32BGRA currently.
let result = CVPixelBufferCreate(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, nil, &pixelBufferCopy)
guard result == kCVReturnSuccess else {
return nil
@ -53,7 +54,7 @@ public final class TextRgba: NSObject, FlutterTexture {
}
self.width = width
self.height = height
if (textureId != -1) {
if (textureId != -1 && self.data != nil) {
registry?.textureFrameAvailable(textureId)
return true
} else {