-
-
Save percysnoodle/6869701 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@implementation DTMutableCoreTextLayoutFrame | |
{ | |
NSUInteger _numberOfDrawingOperationsInParallel; | |
NSConditionLock *_lock; | |
} | |
- (void)_incDrawingOperations | |
{ | |
[_lock lock]; | |
_numberOfDrawingOperationsInParallel++; | |
[_lock unlockWithCondition:_numberOfDrawingOperationsInParallel]; | |
} | |
- (void)_decDrawingOperations | |
{ | |
[_lock lock] | |
_numberOfDrawingOperationsInParallel--; | |
[_lock unlockWithCondition:_numberOfDrawingOperationsInParallel]; | |
} | |
- (void)drawInContext:(CGContextRef)context options:(DTCoreTextLayoutFrameDrawingOptions)options | |
{ | |
[self _incDrawingOperations]; | |
[super drawInContext:context options:options]; | |
[self _decDrawingOperations]; | |
} | |
- (void)replaceTextInRange:(NSRange)range withText:(NSAttributedString *)text dirtyRect:(CGRect *)dirtyRect | |
{ | |
[_lock lockWhenCondition:0]; | |
// updates | |
[_lock unlockWithCondition:0]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment