Skip to content

Commit

Permalink
Update SentryViewPhotographer.swift (#4655)
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin authored Dec 20, 2024
1 parent b448017 commit 0cb72fd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/Swift/Tools/SentryViewPhotographer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0cb72fd

Please sign in to comment.