Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions demo/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="E4H-RR-EJP">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="RFa-ls-Jny">
<objects>
<viewController id="E4H-RR-EJP" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="qzx-KQ-J8g"/>
<viewControllerLayoutGuide type="bottom" id="6xd-zZ-Vq7"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="lD7-3U-Ymd">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ioY-pH-fjq" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="191" y="300"/>
</scene>
</scenes>
</document>
9 changes: 7 additions & 2 deletions tinySVGRenderer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
5BED70221D4F89B300867CE9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5BED70211D4F89B300867CE9 /* Main.storyboard */; };
8F2654AD18E459A0002B190A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8FD8FE3018E069FE00EB9ACF /* Foundation.framework */; };
8F2654CF18E45A28002B190A /* SVGPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F26549218E1BDE4002B190A /* SVGPath.m */; };
8F2654D018E45A28002B190A /* SVGText.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F26549518E1BDF1002B190A /* SVGText.m */; };
Expand Down Expand Up @@ -186,6 +187,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
5BED70211D4F89B300867CE9 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
8F26549118E1BDE4002B190A /* SVGPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPath.h; sourceTree = "<group>"; };
8F26549218E1BDE4002B190A /* SVGPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGPath.m; sourceTree = "<group>"; };
8F26549418E1BDF1002B190A /* SVGText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGText.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1188,6 +1190,7 @@
8FD802C718E0730A00EB9ACF /* tiger.svg */,
8FD8FE4818E069FE00EB9ACF /* Images.xcassets */,
8FD8FE3718E069FE00EB9ACF /* Supporting Files */,
5BED70211D4F89B300867CE9 /* Main.storyboard */,
);
name = Demo;
path = demo;
Expand Down Expand Up @@ -1283,7 +1286,7 @@
LastUpgradeCheck = 0510;
ORGANIZATIONNAME = planetmutlu;
};
buildConfigurationList = 8FD8FE2818E069FE00EB9ACF /* Build configuration list for PBXProject "demo" */;
buildConfigurationList = 8FD8FE2818E069FE00EB9ACF /* Build configuration list for PBXProject "tinySVGRenderer" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
Expand All @@ -1308,6 +1311,7 @@
buildActionMask = 2147483647;
files = (
8FD8FE4918E069FE00EB9ACF /* Images.xcassets in Resources */,
5BED70221D4F89B300867CE9 /* Main.storyboard in Resources */,
8FD8FE3B18E069FE00EB9ACF /* InfoPlist.strings in Resources */,
8FD802C818E0730A00EB9ACF /* tiger.svg in Resources */,
);
Expand Down Expand Up @@ -1658,8 +1662,9 @@
8F2654CA18E459A0002B190A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8FD8FE2818E069FE00EB9ACF /* Build configuration list for PBXProject "demo" */ = {
8FD8FE2818E069FE00EB9ACF /* Build configuration list for PBXProject "tinySVGRenderer" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8FD8FE5D18E069FE00EB9ACF /* Debug */,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "4E7501ED9CA57FB66A08641A94E4915C3A020E12",
"DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : {

},
"DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : {
"BA85DC1162BCF2B1579557DBF17F0EE6799F9B4B" : 0,
"31D5E034AC39B57FE6DE465243ABCA1EC0D74FA6" : 0,
"A6893613B38ED679F5992131C5A09336C47C0345" : 0,
"4B8CF4240CFB761F7EC5859A93F9EA814584B858" : 0,
"4E7501ED9CA57FB66A08641A94E4915C3A020E12" : 0
},
"DVTSourceControlWorkspaceBlueprintIdentifierKey" : "095B809E-AA12-4087-8A94-92A63EFA4C2D",
"DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : {
"BA85DC1162BCF2B1579557DBF17F0EE6799F9B4B" : "tinySVGRenderer\/libparserutils\/",
"31D5E034AC39B57FE6DE465243ABCA1EC0D74FA6" : "tinySVGRenderer\/libwapcaplet\/",
"A6893613B38ED679F5992131C5A09336C47C0345" : "tinySVGRenderer\/libsvgtiny\/",
"4B8CF4240CFB761F7EC5859A93F9EA814584B858" : "tinySVGRenderer\/libdom\/",
"4E7501ED9CA57FB66A08641A94E4915C3A020E12" : "tinySVGRenderer\/"
},
"DVTSourceControlWorkspaceBlueprintNameKey" : "tinySVGRenderer",
"DVTSourceControlWorkspaceBlueprintVersion" : 204,
"DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "tinySVGRenderer.xcodeproj",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "git:\/\/git.netsurf-browser.org\/libwapcaplet.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "31D5E034AC39B57FE6DE465243ABCA1EC0D74FA6"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/dunkelstern\/libdom.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "4B8CF4240CFB761F7EC5859A93F9EA814584B858"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/martinwork\/tinySVGRenderer.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "4E7501ED9CA57FB66A08641A94E4915C3A020E12"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/dunkelstern\/libsvgtiny.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "A6893613B38ED679F5992131C5A09336C47C0345"
},
{
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/dunkelstern\/libparserutils.git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git",
"DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "BA85DC1162BCF2B1579557DBF17F0EE6799F9B4B"
}
]
}
5 changes: 5 additions & 0 deletions tinySVGRenderer/SVGObject.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ - (instancetype)initWithSVGNamed:(NSString *)name {
_filename = [[NSBundle mainBundle] pathForResource:name ofType:@"svg"];
}
_svgData = [NSData dataWithContentsOfFile:_filename];

// test memory leak
// for ( int dbg = 0; dbg < 50; dbg++)
if (![self parseSVG]) return nil;
}
return self;
Expand Down Expand Up @@ -168,6 +171,8 @@ - (BOOL)parseSVG {
_boundingBox = CGSizeMake([components[2] integerValue], [components[3] integerValue]);
}
}

dom_node_unref(svg); // must unref or svgtiny_free_dom cannot free dom
}

if (CGSizeEqualToSize(_size, CGSizeZero)) {
Expand Down