aboutsummaryrefslogtreecommitdiff
path: root/Captura/Core Extensions/CVImageBuffer+cgImage.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2023-09-19 22:58:44 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2023-09-19 22:58:44 +0200
commit7ee43fb83799abb89a69cfcd4e2146dd4eaa5045 (patch)
tree560c7fcb1c408eb46c1517b7197e5543d70814a0 /Captura/Core Extensions/CVImageBuffer+cgImage.swift
parentcdc79b7d7c4829ba7a0371826b28f398f267c46a (diff)
Add multimonitor support
Diffstat (limited to 'Captura/Core Extensions/CVImageBuffer+cgImage.swift')
-rw-r--r--Captura/Core Extensions/CVImageBuffer+cgImage.swift5
1 files changed, 3 insertions, 2 deletions
diff --git a/Captura/Core Extensions/CVImageBuffer+cgImage.swift b/Captura/Core Extensions/CVImageBuffer+cgImage.swift
index c30cb0c..f8958f2 100644
--- a/Captura/Core Extensions/CVImageBuffer+cgImage.swift
+++ b/Captura/Core Extensions/CVImageBuffer+cgImage.swift
@@ -3,9 +3,10 @@ import ReplayKit
extension CVImageBuffer {
+ static let sharedContext = CIContext()
+
var cgImage: CGImage? {
let ciImage = CIImage(cvImageBuffer: self)
- let context = CIContext()
- return context.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self)))
+ return CVImageBuffer.sharedContext.createCGImage(ciImage, from: CGRect(x: 0, y: 0, width: CVPixelBufferGetWidth(self), height: CVPixelBufferGetHeight(self)))
}
}