mirror of
https://github.com/yattee/yattee.git
synced 2025-11-16 06:58:43 +00:00
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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user