Refactor dirty region handling in MPVOGLView

Simplify the conditional logic for marking dirty regions by using optional binding instead of force unwrapping.
This commit is contained in:
Arkadiusz Fal
2025-11-15 15:44:29 +01:00
parent 98bdd5d6a5
commit ada4189aea

View File

@@ -104,11 +104,10 @@ final class MPVOGLView: GLKView {
// Function to set a dirty region when a part of the screen changes // Function to set a dirty region when a part of the screen changes
func markRegionAsDirty(_ region: CGRect) { func markRegionAsDirty(_ region: CGRect) {
if dirtyRegion == nil { if var dirtyRegion {
dirtyRegion = region self.dirtyRegion = dirtyRegion.union(region)
} else { } else {
// Expand the dirty region to include the new region dirtyRegion = region
dirtyRegion = dirtyRegion!.union(region)
} }
} }