diff --git a/apple/Elements/RNSVGForeignObject.mm b/apple/Elements/RNSVGForeignObject.mm index 3b7655d45..164726111 100644 --- a/apple/Elements/RNSVGForeignObject.mm +++ b/apple/Elements/RNSVGForeignObject.mm @@ -150,8 +150,8 @@ - (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect [self setHitArea:path]; if (!CGRectEqualToRect(bounds, CGRectNull)) { self.clientRect = bounds; - self.fillBounds = CGPathGetBoundingBox(path); - self.strokeBounds = CGPathGetBoundingBox(self.strokePath); + self.fillBounds = CGPathGetPathBoundingBox(path); + self.strokeBounds = CGPathGetPathBoundingBox(self.strokePath); self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds); CGAffineTransform current = CGContextGetCTM(context); diff --git a/apple/Elements/RNSVGGroup.mm b/apple/Elements/RNSVGGroup.mm index ee56928b5..44acf6308 100644 --- a/apple/Elements/RNSVGGroup.mm +++ b/apple/Elements/RNSVGGroup.mm @@ -129,8 +129,8 @@ - (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect [self setHitArea:path]; if (!CGRectEqualToRect(bounds, CGRectNull)) { self.clientRect = bounds; - self.fillBounds = CGPathGetBoundingBox(path); - self.strokeBounds = CGPathGetBoundingBox(self.strokePath); + self.fillBounds = CGPathGetPathBoundingBox(path); + self.strokeBounds = CGPathGetPathBoundingBox(self.strokePath); self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds); CGAffineTransform current = CGContextGetCTM(context); diff --git a/apple/RNSVGRenderable.mm b/apple/RNSVGRenderable.mm index 0cc82c095..b7c8b5c76 100644 --- a/apple/RNSVGRenderable.mm +++ b/apple/RNSVGRenderable.mm @@ -510,8 +510,8 @@ - (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect self.path = CGPathRetain(path); } [self setHitArea:path]; - self.fillBounds = CGPathGetBoundingBox(path); - self.strokeBounds = CGPathGetBoundingBox(self.strokePath); + self.fillBounds = CGPathGetPathBoundingBox(path); + self.strokeBounds = CGPathGetPathBoundingBox(self.strokePath); self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds); } const CGRect pathBounds = self.pathBounds; diff --git a/apple/RNSVGRenderableModule.mm b/apple/RNSVGRenderableModule.mm index f6af102b3..8d07fafad 100644 --- a/apple/RNSVGRenderableModule.mm +++ b/apple/RNSVGRenderableModule.mm @@ -138,7 +138,7 @@ @implementation RNSVGRenderableModule BOOL clipped = [[options objectForKey:@"clipped"] boolValue]; [svg getPath:nil]; - CGRect bounds = CGRectZero; + CGRect bounds = CGRectNull; if (fill) { bounds = CGRectUnion(bounds, svg.fillBounds); } @@ -150,12 +150,12 @@ @implementation RNSVGRenderableModule } if (clipped) { CGPathRef clipPath = [svg getClipPath]; - CGRect clipBounds = CGPathGetBoundingBox(clipPath); + CGRect clipBounds = CGPathGetPathBoundingBox(clipPath); if (clipPath && !CGRectIsEmpty(clipBounds)) { bounds = CGRectIntersection(bounds, clipBounds); } } - + if (CGRectIsNull(bounds)) bounds = CGRectZero; CGPoint origin = bounds.origin; CGSize size = bounds.size; return @{@"x" : @(origin.x), @"y" : @(origin.y), @"width" : @(size.width), @"height" : @(size.height)};