From 0cb72fd53497916cf201b7e03effcb4a09ab8f9a Mon Sep 17 00:00:00 2001 From: Dhiogo Brustolin Date: Fri, 20 Dec 2024 10:49:21 +0100 Subject: [PATCH] Update SentryViewPhotographer.swift (#4655) --- Sources/Swift/Tools/SentryViewPhotographer.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Swift/Tools/SentryViewPhotographer.swift b/Sources/Swift/Tools/SentryViewPhotographer.swift index 7a756c345c..100ab0a384 100644 --- a/Sources/Swift/Tools/SentryViewPhotographer.swift +++ b/Sources/Swift/Tools/SentryViewPhotographer.swift @@ -80,6 +80,8 @@ class SentryViewPhotographer: NSObject, SentryViewScreenshotProvider { switch region.type { case .redact, .redactSwiftUI: + // This early return is to avoid masking the same exact area in row, + // something that is very common in SwiftUI and can impact performance. guard latestRegion?.canReplace(as: region) != true && imageRect.intersects(path.boundingBoxOfPath) else { continue } (region.color ?? UIImageHelper.averageColor(of: context.currentImage, at: rect.applying(region.transform))).setFill() context.cgContext.addPath(path)