From 39610f01c000e98296ff6fdfd41235cca53132e0 Mon Sep 17 00:00:00 2001 From: Horcrux Date: Mon, 8 Aug 2016 09:47:31 +0800 Subject: [PATCH] fix #107 --- ios/Utils/RCTConvert+RNSVG.h | 1 - ios/Utils/RCTConvert+RNSVG.m | 24 +++++++----------------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/ios/Utils/RCTConvert+RNSVG.h b/ios/Utils/RCTConvert+RNSVG.h index 744b1a43..5dc78a95 100644 --- a/ios/Utils/RCTConvert+RNSVG.h +++ b/ios/Utils/RCTConvert+RNSVG.h @@ -25,7 +25,6 @@ + (RNSVGBrush *)RNSVGBrush:(id)json; + (NSArray *)RNSVGBezier:(id)json; -+ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset; + (CGRect)CGRect:(id)json offset:(NSUInteger)offset; + (CGColorRef)CGColor:(id)json offset:(NSUInteger)offset; + (CGGradientRef)CGGradient:(id)json offset:(NSUInteger)offset; diff --git a/ios/Utils/RCTConvert+RNSVG.m b/ios/Utils/RCTConvert+RNSVG.m index 542101f4..d4428077 100644 --- a/ios/Utils/RCTConvert+RNSVG.m +++ b/ios/Utils/RCTConvert+RNSVG.m @@ -45,6 +45,9 @@ case 3: CGPathAddCurveToPoint(path, nil, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE); break; + case 4: + CGPathAddArc(path, NULL, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE, NEXT_VALUE == 0); + break; default: RCTLogError(@"Invalid CGPath type %zd at element %zd of %@", type, i, arr); CGPathRelease(path); @@ -75,10 +78,10 @@ RCT_ENUM_CONVERTER(RNSVGCGFCRule, (@{ }), kRNSVGCGFCRuleNonzero, intValue) RCT_ENUM_CONVERTER(RNSVGVBMOS, (@{ - @"meet": @(kRNSVGVBMOSMeet), - @"slice": @(kRNSVGVBMOSSlice), - @"none": @(kRNSVGVBMOSNone) - }), kRNSVGVBMOSMeet, intValue) + @"meet": @(kRNSVGVBMOSMeet), + @"slice": @(kRNSVGVBMOSSlice), + @"none": @(kRNSVGVBMOSNone) + }), kRNSVGVBMOSMeet, intValue) // This takes a tuple of text lines and a font to generate a CTLine for each text line. @@ -225,19 +228,6 @@ RCT_ENUM_CONVERTER(RNSVGVBMOS, (@{ return beziers; } -+ (CGPoint)CGPoint:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 2) { - RCTLogError(@"Too few elements in array (expected at least %zd): %@", 2 + offset, arr); - return CGPointZero; - } - return (CGPoint){ - [self CGFloat:arr[offset]], - [self CGFloat:arr[offset + 1]], - }; -} - + (CGRect)CGRect:(id)json offset:(NSUInteger)offset { NSArray *arr = [self NSArray:json];