diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-09-16 11:07:46 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2024-09-16 11:07:46 +0200 |
| commit | 505c1e620497828ffb914e05dd76d9ab124f144a (patch) | |
| tree | 0d93162c4228dbee9e29c35e9f97f58daa5e3eef /Captura/Core Extensions/CVImageBuffer+cgImage.swift | |
| parent | 5802c153cae64142d84e3cd5f762939501ee7e53 (diff) | |
Format the code
Diffstat (limited to 'Captura/Core Extensions/CVImageBuffer+cgImage.swift')
| -rw-r--r-- | Captura/Core Extensions/CVImageBuffer+cgImage.swift | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Captura/Core Extensions/CVImageBuffer+cgImage.swift b/Captura/Core Extensions/CVImageBuffer+cgImage.swift index eb62e7a..ba98855 100644 --- a/Captura/Core Extensions/CVImageBuffer+cgImage.swift +++ b/Captura/Core Extensions/CVImageBuffer+cgImage.swift @@ -18,19 +18,20 @@ import Foundation import ReplayKit extension CVImageBuffer { - + private static let contextQueue = DispatchQueue(label: "com.example.contextQueue") static let sharedContext: CIContext = { - return CIContext() + return CIContext() }() - + var cgImage: CGImage? { var result: CGImage? CVImageBuffer.contextQueue.sync { let ciImage = CIImage(cvImageBuffer: self) let width = CVPixelBufferGetWidth(self) let height = CVPixelBufferGetHeight(self) - result = CVImageBuffer.sharedContext.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: width, height: height)) + result = CVImageBuffer.sharedContext.createCGImage( + ciImage, from: CGRect(x: 0, y: 0, width: width, height: height)) } return result } |