mirror of
https://github.com/yattee/yattee.git
synced 2025-12-07 16:48:15 +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
|
// 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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user