-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor RectI & RectD methods to simplify code and improve readability.
- Changed RectI::toCanonical(), RectI::toCanonical_noClip() and RectD::toPixelEnclosing() to return their value instead if using an out pointer param. This simplifies a lot of callers, avoids default construction in a lot of cases, and allows many variables to be marked const which makes it easier to ensure values don't change unexpectedly in large functions. - Added RectI::toNewMipMapLevel() helper function to reduce duplicate code and make the code a little more readable. - Added RectI::intersect() and RectD::intersect() methods that return the intersection or a null rect. Updated a few places where this form simplifies or makes the code more clear. - Added RectI::clipIfOverlaps() and RectD::clipIfOverlaps() helper functions to replace a common usage of the existing intersect() method. The intent is to make it a little more clear that the intersection only happens if there is an overlap and it avoids having to specify a variable name twice. - Renamed the original intersect() to intersectInternal() and made it private. The intersect() and clipIfOverlaps() changes above made it so there were no callers outside of RectI and RectD that needed this. - Removed some comment out code and a few variables/computations that weren't actually used for anything. - Added documentation for a few methods to make their behavior a little more clear. - Updated python wrapper type definitions to reflect the changes above. The intersect modifications could be removed because the new intersect() signature and semantics match the desired python signature and semantics.
- Loading branch information
Showing
32 changed files
with
291 additions
and
468 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.