This commit is contained in:
Horcrux
2016-08-16 20:00:49 +08:00
parent b6165a98c7
commit 63ad060e49
2 changed files with 6 additions and 8 deletions
+2 -3
View File
@@ -28,9 +28,8 @@
- (void)renderLayerTo:(CGContextRef)context
{
if (!self.d) {
self.d = [self getPath:context];;
}
// todo: add detection if path has changed since last update.
self.d = [self getPath:context];
CGPathRef path = self.d;
if ((!self.fill && !self.stroke) || !path) {
return;
+4 -5
View File
@@ -30,13 +30,11 @@ static void RNSVGFreeTextFrame(RNSVGTextFrame frame)
_alignment = alignment;
}
- (void)setTextFrame:(RNSVGTextFrame)frame
- (void)setTextFrame:(RNSVGTextFrame)textFrame
{
if (frame.lines == _textFrame.lines) {
RNSVGFreeTextFrame(_textFrame);
}
RNSVGFreeTextFrame(_textFrame);
[self invalidate];
_textFrame = frame;
_textFrame = textFrame;
}
- (void)setPath:(NSArray *)path
@@ -99,6 +97,7 @@ static void RNSVGFreeTextFrame(RNSVGTextFrame frame)
CTRunGetPositions(run, CFRangeMake(0, 0), positions);
CTRunGetGlyphs(run, CFRangeMake(0, 0), glyphs);
CFDictionaryRef attributes = CTRunGetAttributes(run);
CTFontRef runFont = CFDictionaryGetValue(attributes, kCTFontAttributeName);
RNSVGBezierPath *bezierPath = [[RNSVGBezierPath alloc] initWithBezierCurves:self.path];