mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-25 12:03:27 +00:00
refactor: remove defaultColor/tintColor abstraction layer
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
BOOL fillColor;
|
||||
|
||||
if (brush.class == RNSVGBrush.class) {
|
||||
CGContextSetFillColorWithColor(context, [element.defaultColor CGColor]);
|
||||
CGContextSetFillColorWithColor(context, [element.tintColor CGColor]);
|
||||
fillColor = YES;
|
||||
} else {
|
||||
fillColor = [brush applyFillColor:context opacity:opacity];
|
||||
@@ -73,7 +73,7 @@
|
||||
BOOL strokeColor;
|
||||
|
||||
if (brush.class == RNSVGBrush.class) {
|
||||
CGContextSetStrokeColorWithColor(context, [element.defaultColor CGColor]);
|
||||
CGContextSetStrokeColorWithColor(context, [element.tintColor CGColor]);
|
||||
strokeColor = YES;
|
||||
} else {
|
||||
strokeColor = [brush applyStrokeColor:context opacity:opacity];
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
@property (nonatomic, copy) NSArray<NSString *> *propList;
|
||||
@property (nonatomic, assign) CGPathRef hitArea;
|
||||
|
||||
- (RNSVGColor *)defaultColor;
|
||||
|
||||
- (void)setHitArea:(CGPathRef)path;
|
||||
|
||||
- (NSArray<NSString *> *)getAttributeList;
|
||||
|
||||
@@ -41,11 +41,6 @@ static RNSVGRenderable * _contextElement;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (RNSVGColor *)defaultColor
|
||||
{
|
||||
return [self tintColor];
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
_sourceStrokeDashArray = nil;
|
||||
@@ -411,7 +406,7 @@ UInt32 saturate(CGFloat value) {
|
||||
|
||||
if (self.fill) {
|
||||
if (self.fill.class == RNSVGBrush.class) {
|
||||
CGContextSetFillColorWithColor(context, [self.defaultColor CGColor]);
|
||||
CGContextSetFillColorWithColor(context, [self.tintColor CGColor]);
|
||||
fillColor = YES;
|
||||
} else {
|
||||
fillColor = [self.fill applyFillColor:context opacity:self.fillOpacity];
|
||||
@@ -460,7 +455,7 @@ UInt32 saturate(CGFloat value) {
|
||||
BOOL strokeColor;
|
||||
|
||||
if (self.stroke.class == RNSVGBrush.class) {
|
||||
CGContextSetStrokeColorWithColor(context,[self.defaultColor CGColor]);
|
||||
CGContextSetStrokeColorWithColor(context,[self.tintColor CGColor]);
|
||||
strokeColor = YES;
|
||||
} else {
|
||||
strokeColor = [self.stroke applyStrokeColor:context opacity:self.strokeOpacity];
|
||||
|
||||
@@ -68,7 +68,7 @@ static CGFloat RNSVGTSpan_radToDeg = 180 / (CGFloat)M_PI;
|
||||
CGColorRef color;
|
||||
if (self.fill) {
|
||||
if (self.fill.class == RNSVGBrush.class) {
|
||||
color = [self.defaultColor CGColor];
|
||||
color = [self.tintColor CGColor];
|
||||
[self drawWrappedText:context gc:gc rect:rect color:color];
|
||||
} else {
|
||||
color = [self.fill getColorWithOpacity:self.fillOpacity];
|
||||
@@ -81,7 +81,7 @@ static CGFloat RNSVGTSpan_radToDeg = 180 / (CGFloat)M_PI;
|
||||
}
|
||||
if (self.stroke) {
|
||||
if (self.stroke.class == RNSVGBrush.class) {
|
||||
color = [self.defaultColor CGColor];
|
||||
color = [self.tintColor CGColor];
|
||||
[self drawWrappedText:context gc:gc rect:rect color:color];
|
||||
} else {
|
||||
color = [self.stroke getColorWithOpacity:self.strokeOpacity];
|
||||
|
||||
Reference in New Issue
Block a user