X-Git-Url: https://git.r.bdr.sh/rbdr/captura/blobdiff_plain/c9b9e1d654ea697afad9f6427d94623bfdf55cce..3472041dfee0a6e8c8a29e949f239bae13e1a18f:/Captura/Domain/CapturaCaptureSession.swift?ds=inline diff --git a/Captura/Domain/CapturaCaptureSession.swift b/Captura/Domain/CapturaCaptureSession.swift index 80240e6..8943282 100644 --- a/Captura/Domain/CapturaCaptureSession.swift +++ b/Captura/Domain/CapturaCaptureSession.swift @@ -12,7 +12,11 @@ class CapturaCaptureSession: AVCaptureSession, AVCaptureFileOutputRecordingDeleg let displayId = screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as! CGDirectDisplayID let screenInput = AVCaptureScreenInput(displayID: displayId) - screenInput?.cropRect = box.insetBy(dx: 1, dy: 1) + var croppingBox = NSOffsetRect(box, -screen.frame.origin.x, -screen.frame.origin.y) + if croppingBox.width.truncatingRemainder(dividingBy: 2) != 0 { + croppingBox.size.width -= 1 + } + screenInput?.cropRect = croppingBox.insetBy(dx: 1, dy: 1) if self.canAddInput(screenInput!) { self.addInput(screenInput!)