Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public final class ImageCaptureService {
let enclosingBounds = windowCaptureManager.minimalBoundsEnclosingWindows(windows)
let renderer = windowCaptureManager.makeRenderer(size: enclosingBounds.size, scale: scale)

CATransaction.flush()
let maskOperationsBefore = windows.map { maskCollector.collectViewMasks(in: $0, window: $0, scale: scale) }
let image = renderer.image { ctx in
windowCaptureManager.drawWindows(windows, into: ctx.cgContext, bounds: enclosingBounds, afterScreenUpdates: false)
Expand All @@ -64,8 +63,12 @@ public final class ImageCaptureService {
DispatchQueue.main.async { [weak self, weak maskCollector] in
// Move collecting masks after to the next tick
guard let self, let maskCollector, shouldCapture else { return }

let hasMasks = maskOperationsBefore.contains(where: { !$0.maskOperations.isEmpty })
if (hasMasks) {
CATransaction.flush()
}

CATransaction.flush()
let maskOperationsAfter = windows.map { maskCollector.collectViewMasks(in: $0, window: $0, scale: self.scale) }

Task {
Expand Down
4 changes: 3 additions & 1 deletion TestApp/Sources/MainMenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ struct MainMenuView: View {
Section {
MaskingGridRow(title: "One TextField", uikitAction: {
isMaskingUIKitOneFieldEnabled = true
}, swiftUIAction: nil)
}, swiftUIAction: nil).ldMask()

#if os(iOS)
MaskingGridRow(title: "Credit Card", uikitAction: {
isMaskingUIKitCreditCardEnabled = true
Expand Down Expand Up @@ -146,6 +147,7 @@ struct MainMenuView: View {
isNotebookEnabled = true
}
.buttonStyle(.borderedProminent)

Button("Storyboard") {
isStoryboardEnabled = true
}
Expand Down
Loading