diff --git a/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate b/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate index 934c7f8..1760ac5 100644 Binary files a/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate and b/IJSVGExample/IJSVGExample.xcodeproj/project.xcworkspace/xcuserdata/curtishard.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/source/IJSVG.m b/source/IJSVG.m index b012a0f..38b78f2 100644 --- a/source/IJSVG.m +++ b/source/IJSVG.m @@ -347,9 +347,11 @@ static NSColor * _baseColor = nil; { dispatch_block_t block = ^(void) { - [self _drawPath:(IJSVGPath *)child - rect:rect - context:context]; + IJSVGPath * p = (IJSVGPath *)child; + if( p.shouldRender ) + [self _drawPath:p + rect:rect + context:context]; }; // draw the clip diff --git a/source/IJSVGNode.h b/source/IJSVGNode.h index 37614c6..c58dcd0 100644 --- a/source/IJSVGNode.h +++ b/source/IJSVGNode.h @@ -65,6 +65,7 @@ static CGFloat IJSVGInheritedFloatValue = -99.9999991; IJSVGGradient * fillGradient; BOOL usesDefaultFillColor; + BOOL shouldRender; NSColor * fillColor; NSColor * strokeColor; @@ -95,6 +96,7 @@ static CGFloat IJSVGInheritedFloatValue = -99.9999991; @property ( nonatomic, assign ) IJSVGNodeType type; @property ( nonatomic, copy ) NSString * name; +@property ( nonatomic, assign ) BOOL shouldRender; @property ( nonatomic, assign ) BOOL usesDefaultFillColor; @property ( nonatomic, assign ) CGFloat x; @property ( nonatomic, assign ) CGFloat y; diff --git a/source/IJSVGNode.m b/source/IJSVGNode.m index 29959f0..ffb9509 100644 --- a/source/IJSVGNode.m +++ b/source/IJSVGNode.m @@ -11,6 +11,7 @@ @implementation IJSVGNode +@synthesize shouldRender; @synthesize type; @synthesize name; @synthesize x; @@ -124,6 +125,8 @@ self.lineJoinStyle = node.lineJoinStyle; self.parentNode = node.parentNode; + self.shouldRender = node.shouldRender; + // dash array needs physical memory copied CGFloat * nStrokeDashArray = (CGFloat *)malloc(node.strokeDashArrayCount*sizeof(CGFloat)); memcpy( self.strokeDashArray, nStrokeDashArray, node.strokeDashArrayCount*sizeof(CGFloat)); @@ -147,6 +150,7 @@ self.fillOpacity = 1.f; self.strokeOpacity = 1.f; self.strokeDashOffset = 0.f; + self.shouldRender = YES; self.strokeWidth = IJSVGInheritedFloatValue; self.windingRule = IJSVGWindingRuleInherit; self.lineCapStyle = IJSVGLineCapStyleInherit; diff --git a/source/IJSVGParser.m b/source/IJSVGParser.m index b31a972..03285b8 100644 --- a/source/IJSVGParser.m +++ b/source/IJSVGParser.m @@ -319,6 +319,14 @@ { IJSVGStyle * style = [IJSVGStyle parseStyleString:[styleNode stringValue]]; + // actual display + NSString * display = nil; + if( ( display = [style property:@"display"] ) != nil ) + { + if( [display isEqualToString:@"none"] ) + node.shouldRender = NO; + } + // fill color NSColor * fill = nil; if( ( fill = [style property:@"fill"] ) != nil )