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