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
func markRegionAsDirty(_ region: CGRect) {
if dirtyRegion == nil {
dirtyRegion = region
if var dirtyRegion {
self.dirtyRegion = dirtyRegion.union(region)
} else {
// Expand the dirty region to include the new region
dirtyRegion = dirtyRegion!.union(region)
dirtyRegion = region
}
}