Created
August 8, 2013 02:25
-
-
Save gnachman/6180913 to your computer and use it in GitHub Desktop.
set rect dirty
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
- (void)setRectDirtyFromX:(int)fromX Y:(int)fromY toX:(int)toX Y:(int)toY | |
{ | |
assert(fromX >= 0); | |
assert(fromX < WIDTH); | |
assert(toX >= 0); | |
assert(toX <= WIDTH); // <= because not inclusive of toX. | |
assert(fromY >= 0); | |
assert(fromY < HEIGHT); | |
assert(toY >= 0); | |
assert(toY < HEIGHT); | |
assert(fromY <= toY); | |
if (fromY == toY) { | |
assert(fromX <= toX); | |
} | |
for (int y = fromY; y <= toY; y++) { | |
int i = fromX + y * WIDTH; | |
[self setRangeDirty:NSMakeRange(i, toX + y * WIDTH - i)]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment