IOSurface experiment

This commit is contained in:
Isaac
2025-03-14 15:34:16 +01:00
parent 6d1732d830
commit daaa6a7e2e
6 changed files with 354 additions and 43 deletions

View File

@@ -415,7 +415,20 @@ public final class InlineStickerItemLayer: MultiAnimationRenderTarget {
}
override public var contents: Any? {
didSet {
get {
return super.contents
} set(value) {
#if targetEnvironment(simulator)
if let value, CFGetTypeID(value as CFTypeRef) == CVPixelBufferGetTypeID() {
let pixelBuffer = value as! CVPixelBuffer
super.contents = CVPixelBufferGetIOSurface(pixelBuffer)
} else {
super.contents = value
}
#else
super.contents = value
#endif
if let mirrorLayer = self.mirrorLayer {
mirrorLayer.contents = self.contents
}