diff --git a/Framework/IJSVG/IJSVG.xcodeproj/project.pbxproj b/Framework/IJSVG/IJSVG.xcodeproj/project.pbxproj index cc04b50..37b51cf 100644 --- a/Framework/IJSVG/IJSVG.xcodeproj/project.pbxproj +++ b/Framework/IJSVG/IJSVG.xcodeproj/project.pbxproj @@ -955,7 +955,7 @@ 594CF478238FF38E009B251B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGN_STYLE = Automatic; @@ -983,7 +983,7 @@ 594CF479238FF38E009B251B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_ENABLE_OBJC_ARC = NO; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CODE_SIGN_STYLE = Automatic; diff --git a/Framework/IJSVG/IJSVG/Source/Additions/IJSVGStringAdditions.m b/Framework/IJSVG/IJSVG/Source/Additions/IJSVGStringAdditions.m index 43496f4..d0d0d59 100644 --- a/Framework/IJSVG/IJSVG/Source/Additions/IJSVGStringAdditions.m +++ b/Framework/IJSVG/IJSVG/Source/Additions/IJSVGStringAdditions.m @@ -18,7 +18,7 @@ return @[]; } NSMutableArray* strings = nil; - strings = [[[NSMutableArray alloc] init] autorelease]; + strings = [[NSMutableArray alloc] init]; char* copy = strdup(chars); char* spt = NULL; char* ptr = strtok_r(copy, aChar, &spt); diff --git a/Framework/IJSVG/IJSVG/Source/Additions/NSImage+IJSVGAdditions.m b/Framework/IJSVG/IJSVG/Source/Additions/NSImage+IJSVGAdditions.m index ff9bf8c..2e1ea0a 100644 --- a/Framework/IJSVG/IJSVG/Source/Additions/NSImage+IJSVGAdditions.m +++ b/Framework/IJSVG/IJSVG/Source/Additions/NSImage+IJSVGAdditions.m @@ -36,14 +36,14 @@ IJSVG* IJSVGGetFromNSImage(NSImage* image) != nil) { // work out if we can get the data - NSData* data = [[[NSData alloc] initWithContentsOfFile:str] autorelease]; + NSData* data = [[NSData alloc] initWithContentsOfFile:str]; if (data == nil) { return nil; } // grab the image rep - IJSVGImageRep* rep = [[[IJSVGImageRep alloc] initWithData:data] autorelease]; - NSImage* image = [[[NSImage alloc] init] autorelease]; + IJSVGImageRep* rep = [[IJSVGImageRep alloc] initWithData:data]; + NSImage* image = [[NSImage alloc] init]; [image addRepresentation:rep]; return image; } diff --git a/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColor.m b/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColor.m index 3767bfa..a587c12 100644 --- a/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColor.m +++ b/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColor.m @@ -61,7 +61,7 @@ CGFloat* IJSVGColorCSSHSLToHSB(CGFloat hue, CGFloat saturation, CGFloat lightnes { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - _colorTree = [@{ + _colorTree = @{ @"aliceblue" : @(0xf0f8ff), @"antiquewhite" : @(0xfaebd7), @"aqua" : @(0x00ffff), @@ -207,7 +207,7 @@ CGFloat* IJSVGColorCSSHSLToHSB(CGFloat hue, CGFloat saturation, CGFloat lightnes @"whitesmoke" : @(0xf5f5f5), @"yellow" : @(0xffff00), @"yellowgreen" : @(0x9acd32) - } retain]; + }; }); } diff --git a/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorList.m b/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorList.m index 02537a4..443a4db 100644 --- a/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorList.m +++ b/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorList.m @@ -10,13 +10,6 @@ @implementation IJSVGColorList -- (void)dealloc -{ - (void)([_replacementColorTree release]), _replacementColorTree = nil; - (void)([_colors release]), _colors = nil; - [super dealloc]; -} - - (instancetype)init { if ((self = [super init]) != nil) { @@ -29,7 +22,7 @@ - (id)copyWithZone:(NSZone*)zone { IJSVGColorList* sheet = [[self.class alloc] init]; - [sheet setReplacementColors:[_replacementColorTree.copy autorelease] + [sheet setReplacementColors:_replacementColorTree.copy clearExistingColors:YES]; return sheet; } @@ -52,7 +45,6 @@ - (void)_invalidateColorTree { - (void)([_replacementColorTree release]), _replacementColorTree = nil; _replacementColorTree = [[NSMutableDictionary alloc] init]; } diff --git a/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorType.m b/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorType.m index ef75289..689eb99 100644 --- a/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorType.m +++ b/Framework/IJSVG/IJSVG/Source/Colors/IJSVGColorType.m @@ -10,16 +10,10 @@ @implementation IJSVGColorType -- (void)dealloc -{ - (void)[_color release], _color = nil; - [super dealloc]; -} - + (IJSVGColorType*)typeWithColor:(NSColor*)color flags:(IJSVGColorTypeFlags)mask { - IJSVGColorType* type = [[[self alloc] init] autorelease]; + IJSVGColorType* type = [[self alloc] init]; type.color = color; type.flags = mask; return type; diff --git a/Framework/IJSVG/IJSVG/Source/Commands/IJSVGCommand.m b/Framework/IJSVG/IJSVG/Source/Commands/IJSVGCommand.m index 9352a48..d227523 100644 --- a/Framework/IJSVG/IJSVG/Source/Commands/IJSVGCommand.m +++ b/Framework/IJSVG/IJSVG/Source/Commands/IJSVGCommand.m @@ -122,7 +122,7 @@ + (NSArray*)commandsForDataCharacters:(const char*)buffer dataStream:(IJSVGPathDataStream*)dataStream { - NSMutableArray* commands = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* commands = [[NSMutableArray alloc] init]; NSUInteger len = strlen(buffer); NSUInteger lastIndex = len - 1; @@ -152,8 +152,8 @@ // previous command is actual subcommand Class commandClass = [IJSVGCommand commandClassForCommandChar:commandString[0]]; IJSVGCommand* command = nil; - command = (IJSVGCommand*)[[[commandClass alloc] initWithCommandStringBuffer:commandString - dataStream:dataStream] autorelease]; + command = (IJSVGCommand*)[[commandClass alloc] initWithCommandStringBuffer:commandString + dataStream:dataStream]; [commands addObject:command]; @@ -170,7 +170,7 @@ bounds:(CGRect)bounds { NSMutableArray* newCommands = nil; - newCommands = [[[NSMutableArray alloc] initWithCapacity:commands.count] autorelease]; + newCommands = [[NSMutableArray alloc] initWithCapacity:commands.count]; for(IJSVGCommand* command in commands) { IJSVGCommand* nCommand = [command commandByConvertingToUnits:unitType boundingBox:bounds]; @@ -181,11 +181,9 @@ - (void)dealloc { - (void)([_subCommands release]), _subCommands = nil; if (_parameters) { (void)(free(_parameters)), _parameters = nil; } - [super dealloc]; } - (id)initWithCommandStringBuffer:(const char*)str @@ -207,10 +205,10 @@ IJSVGCommand* command = [self subcommandWithParameters:subParams paramCount:paramCount previousCommand:nil]; - _subCommands = @[ command ].retain; + _subCommands = @[ command ]; } else { NSMutableArray* subCommandArray = nil; - subCommandArray = [[NSMutableArray alloc] initWithCapacity:sets].autorelease; + subCommandArray = [[NSMutableArray alloc] initWithCapacity:sets]; // interate over the sets IJSVGCommand* lastCommand = nil; @@ -239,8 +237,7 @@ - (void)setSubCommands:(NSArray*)subCommands { - (void)[_subCommands release], _subCommands = nil; - _subCommands = subCommands.retain; + _subCommands = subCommands; } - (id)copyWithZone:(NSZone *)zone @@ -257,9 +254,9 @@ IJSVGCommand* lastCommand = nil; NSMutableArray* subcommands = nil; - subcommands = [[[NSMutableArray alloc] initWithCapacity:self.subCommands.count] autorelease]; + subcommands = [[NSMutableArray alloc] initWithCapacity:self.subCommands.count]; for(IJSVGCommand* subcommand in self.subCommands) { - IJSVGCommand* subCopy = [[subcommand copy] autorelease]; + IJSVGCommand* subCopy = [subcommand copy]; subCopy.previousCommand = lastCommand; subCopy.isSubCommand = lastCommand != nil; [subcommands addObject:subCopy]; @@ -284,7 +281,7 @@ previousCommand:(IJSVGCommand*)aPreviousCommand { // create a subcommand per set - IJSVGCommand* c = [[[self.class alloc] init] autorelease]; + IJSVGCommand* c = [[self.class alloc] init]; c.parameterCount = paramCount; c.parameters = subParams; c.type = self.type; @@ -330,9 +327,9 @@ - (NSString *)description { - NSMutableString* str = [[[NSMutableString alloc] init] autorelease]; + NSMutableString* str = [[NSMutableString alloc] init]; [str appendFormat:@"%c ",_command]; - NSMutableArray* args = [[[NSMutableArray alloc] initWithCapacity:_parameterCount] autorelease]; + NSMutableArray* args = [[NSMutableArray alloc] initWithCapacity:_parameterCount]; for(int i = 0; i < _parameterCount; i++) { [args addObject:[NSString stringWithFormat:@"%f",_parameters[i]]]; } @@ -346,7 +343,7 @@ IJSVGCommand* copy = self.copy; [copy convertToUnits:unitType boundingBox:boundingBox]; - return [copy autorelease]; + return copy; } @end diff --git a/Framework/IJSVG/IJSVG/Source/Core/IJSVG.h b/Framework/IJSVG/IJSVG/Source/Core/IJSVG.h index 160a512..4d15228 100644 --- a/Framework/IJSVG/IJSVG/Source/Core/IJSVG.h +++ b/Framework/IJSVG/IJSVG/Source/Core/IJSVG.h @@ -64,12 +64,12 @@ withSVGString:(NSString*)subSVGString; // fillColor, strokeColor, pattern and gradient fill @property (nonatomic, assign) IJSVGRenderQuality renderQuality; @property (nonatomic, assign) BOOL clipToViewport; -@property (nonatomic, retain) IJSVGRenderingStyle* renderingStyle; -@property (nonatomic, readonly) IJSVGUnitSize * intrinsicSize; +@property (nonatomic, strong) IJSVGRenderingStyle* renderingStyle; +@property (weak, nonatomic, readonly) IJSVGUnitSize * intrinsicSize; @property (nonatomic, copy) NSString* title; @property (nonatomic, copy) NSString* desc; -@property (nonatomic, retain) IJSVGLayerTree* layerTree; -@property (nonatomic, retain) IJSVGRootLayer* rootLayer; +@property (nonatomic, strong) IJSVGLayerTree* layerTree; +@property (nonatomic, strong) IJSVGRootLayer* rootLayer; - (void)prepForDrawingInView:(NSView*)view; - (BOOL)isFont; diff --git a/Framework/IJSVG/IJSVG/Source/Core/IJSVG.m b/Framework/IJSVG/IJSVG/Source/Core/IJSVG.m index 605b861..9ec6ea0 100644 --- a/Framework/IJSVG/IJSVG/Source/Core/IJSVG.m +++ b/Framework/IJSVG/IJSVG/Source/Core/IJSVG.m @@ -20,18 +20,17 @@ { // this can all be called on the background thread to be released BOOL hasTransaction = IJSVGBeginTransaction(); - (void)([_renderingBackingScaleHelper release]), _renderingBackingScaleHelper = nil; - (void)([_replacementColors release]), _replacementColors = nil; - (void)([_renderingStyle release]), _renderingStyle = nil; - (void)([_rootNode release]), _rootNode = nil; - (void)([_intrinsicSize release]), _intrinsicSize = nil; - (void)([_title release]), _title = nil; - (void)([_desc release]), _desc = nil; - (void)([_rootLayer release]), _rootLayer = nil; + (void)(_renderingBackingScaleHelper), _renderingBackingScaleHelper = nil; + (void)(_replacementColors), _replacementColors = nil; + (void)(_renderingStyle), _renderingStyle = nil; + (void)(_rootNode), _rootNode = nil; + (void)(_intrinsicSize), _intrinsicSize = nil; + (void)(_title), _title = nil; + (void)(_desc), _desc = nil; + (void)(_rootLayer), _rootLayer = nil; // kill any memory that has been around - (void)([_layerTree release]), _layerTree = nil; - [super dealloc]; + (void)(_layerTree), _layerTree = nil; if (hasTransaction == YES) { IJSVGEndTransaction(); } @@ -71,14 +70,14 @@ } if ((str = [bundle pathForResource:[string stringByDeletingPathExtension] ofType:ext]) != nil) { - return [[[self alloc] initWithFile:str + return [[self alloc] initWithFile:str error:error - delegate:delegate] autorelease]; + delegate:delegate]; } // check the asset catalogues - return [[[self alloc] initWithDataAssetNamed:string - error:error] autorelease]; + return [[self alloc] initWithDataAssetNamed:string + error:error]; } - (id)initWithDataAssetNamed:(NSDataAssetName)name @@ -93,11 +92,11 @@ bundle:(NSBundle*)bundle error:(NSError**)error { - NSDataAsset* dataAsset = [[[NSDataAsset alloc] initWithName:name - bundle:bundle] autorelease]; + NSDataAsset* dataAsset = [[NSDataAsset alloc] initWithName:name + bundle:bundle]; if(dataAsset != nil) { - return [[self initWithSVGData:dataAsset.data - error:error] autorelease]; + return [self initWithSVGData:dataAsset.data + error:error]; } return nil; } @@ -108,13 +107,13 @@ __block IJSVGImageLayer* imageLayer = nil; // create the layers we require - IJSVGImage* imageNode = [[[IJSVGImage alloc] init] autorelease]; + IJSVGImage* imageNode = [[IJSVGImage alloc] init]; imageNode.image = image; BOOL hasTransaction = IJSVGBeginTransaction(); - layer = [[[IJSVGGroupLayer alloc] init] autorelease]; + layer = [[IJSVGGroupLayer alloc] init]; imageLayer = - [[[IJSVGImageLayer alloc] initWithImage:imageNode] autorelease]; + [[IJSVGImageLayer alloc] initWithImage:imageNode]; [layer addSublayer:imageLayer]; if (hasTransaction == YES) { IJSVGEndTransaction(); @@ -211,7 +210,7 @@ IJSVGParser* parser = [IJSVGParser groupForFileURL:aURL error:&anError delegate:self]; - _rootNode = parser.rootNode.retain; + _rootNode = parser.rootNode; [self _setupBasicInfoFromGroup]; [self _setupBasicsFromAnyInitializer]; @@ -220,7 +219,7 @@ if (error != NULL) { *error = anError; } - (void)([self release]), self = nil; + (void)(self), self = nil; return nil; } } @@ -238,7 +237,7 @@ { NSString* svgString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - return [self initWithSVGString:svgString.autorelease + return [self initWithSVGString:svgString error:error]; } @@ -269,10 +268,10 @@ [self _checkDelegate]; // setup the parser - IJSVGParser* parser = [[[IJSVGParser alloc] initWithSVGString:string + IJSVGParser* parser = [[IJSVGParser alloc] initWithSVGString:string error:&anError - delegate:self] autorelease]; - _rootNode = parser.rootNode.retain; + delegate:self]; + _rootNode = parser.rootNode; [self _setupBasicInfoFromGroup]; [self _setupBasicsFromAnyInitializer]; @@ -282,7 +281,7 @@ if (error != NULL) { *error = anError; } - (void)([self release]), self = nil; + (void)(self), self = nil; return nil; } } @@ -301,12 +300,12 @@ - (void)_setupBasicInfoFromGroup { _viewBox = [_rootNode.viewBox computeValue:CGSizeZero]; - _intrinsicSize = _rootNode.intrinsicSize.retain; + _intrinsicSize = _rootNode.intrinsicSize; } - (void)_setupBasicsFromAnyInitializer { - self.renderingStyle = [[[IJSVGRenderingStyle alloc] init] autorelease]; + self.renderingStyle = [[IJSVGRenderingStyle alloc] init]; self.clipToViewport = YES; self.renderQuality = kIJSVGRenderQualityFullResolution; @@ -358,34 +357,34 @@ - (BOOL)isFont { - return [_rootNode isFont]; + return NO;//[_rootNode isFont]; } - (NSArray*)glyphs { - return [_rootNode glyphs]; + return @[];//[_rootNode glyphs]; } - (NSArray*)subSVGs:(BOOL)recursive { - return [_rootNode subSVGs:recursive]; + return @[];//[_rootNode subSVGs:recursive]; } - (NSString*)SVGStringWithOptions:(IJSVGExporterOptions)options { - IJSVGExporter* exporter = [[[IJSVGExporter alloc] initWithSVG:self + IJSVGExporter* exporter = [[IJSVGExporter alloc] initWithSVG:self size:self.viewBox.size - options:options] autorelease]; + options:options]; return [exporter SVGString]; } - (NSString*)SVGStringWithOptions:(IJSVGExporterOptions)options floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions { - IJSVGExporter* exporter = [[[IJSVGExporter alloc] initWithSVG:self + IJSVGExporter* exporter = [[IJSVGExporter alloc] initWithSVG:self size:self.viewBox.size options:options - floatingPointOptions:floatingPointOptions] autorelease]; + floatingPointOptions:floatingPointOptions]; return [exporter SVGString]; } @@ -483,7 +482,7 @@ NSImage* image = [[NSImage alloc] initWithCGImage:ref size:aSize]; CGImageRelease(ref); - return image.autorelease; + return image; } - (NSImage*)imageByMaintainingAspectRatioWithSize:(NSSize)aSize @@ -515,7 +514,7 @@ error:(NSError**)error { // create the data for the PDF - NSMutableData* data = [[[NSMutableData alloc] init] autorelease]; + NSMutableData* data = [[NSMutableData alloc] init]; // assign the data to the consumer CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData((CFMutableDataRef)data); @@ -592,7 +591,7 @@ [self rootLayer]; // set the scale - __block NSView* weakView = view; + __weak NSView* weakView = view; self.renderingBackingScaleHelper = ^CGFloat { return weakView.window.screen.backingScaleFactor; }; @@ -754,7 +753,7 @@ [self.rootLayer renderInContext:ref viewPort:rect backingScale:backingScale - quality:_renderQuality]; + quality:_renderQuality]; CGContextRestoreGState(ref); if(transaction) { IJSVGEndTransaction(); @@ -773,7 +772,7 @@ - (IJSVGRootLayer*)rootLayer { if(_rootLayer == nil) { - _rootLayer = [self.layerTree rootLayerForRootNode:_rootNode].retain; + _rootLayer = [self.layerTree rootLayerForRootNode:_rootNode]; } return _rootLayer; } @@ -790,8 +789,7 @@ - (void)setRenderingStyle:(IJSVGRenderingStyle*)style { - (void)([_renderingStyle release]), _renderingStyle = nil; - _renderingStyle = style.retain; + _renderingStyle = style; } - (void)observeValueForKeyPath:(NSString*)keyPath @@ -812,12 +810,12 @@ - (void)invalidateLayerTree { - (void)([_layerTree release]), _layerTree = nil; + (void)(_layerTree), _layerTree = nil; } - (IJSVGColorList*)colorList { - IJSVGColorList* sheet = [[[IJSVGColorList alloc] init] autorelease]; + IJSVGColorList* sheet = [[IJSVGColorList alloc] init]; void (^block)(CALayer* layer, BOOL* stop) = ^void(CALayer* layer, BOOL* stop) { diff --git a/Framework/IJSVG/IJSVG/Source/Core/IJSVGFontConverter.m b/Framework/IJSVG/IJSVG/Source/Core/IJSVGFontConverter.m index 53abbfa..a37a068 100644 --- a/Framework/IJSVG/IJSVG/Source/Core/IJSVGFontConverter.m +++ b/Framework/IJSVG/IJSVG/Source/Core/IJSVGFontConverter.m @@ -11,14 +11,6 @@ @implementation IJSVGFontConverter -- (void)dealloc -{ - (void)([_transformedPaths release]), _transformedPaths = nil; - (void)([_url release]), _url = nil; - (void)([_font release]), _font = nil; - [super dealloc]; -} - - (id)initWithFontAtFileURL:(NSURL*)url { if ((self = [super init]) != nil) { @@ -30,7 +22,7 @@ CTFontRef font = CTFontCreateWithGraphicsFont(fontRef, 30.f, NULL, NULL); // toll free bridge between NSFont at CTFont :) - _font = [(NSFont*)font copy]; + _font = [(__bridge NSFont*)font copy]; CGFontRelease(fontRef); CGDataProviderRelease(dataProvider); CFRelease(font); @@ -46,7 +38,7 @@ - (NSArray*)allCharacters { NSCharacterSet* charSet = _font.coveredCharacterSet; - NSMutableArray* array = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* array = [[NSMutableArray alloc] init]; NSStringEncoding encoding = NSUTF32LittleEndianStringEncoding; for (int plane = 0; plane <= 16; plane++) { if ([charSet hasMemberInPlane:plane]) { @@ -54,9 +46,9 @@ for (c = plane << 16; c < (plane + 1) << 16; c++) { if ([charSet longCharacterIsMember:c]) { UTF32Char c1 = NSSwapHostIntToLittle(c); - [array addObject:[[[NSString alloc] initWithBytes:&c1 - length:4 - encoding:encoding] autorelease]]; + [array addObject:[[NSString alloc] initWithBytes:&c1 + length:4 + encoding:encoding]]; } } } @@ -66,7 +58,7 @@ - (void)generateMap { - CTFontRef font = (CTFontRef)_font; + CTFontRef font = (__bridge CTFontRef)_font; for (NSString* charString in [self allCharacters]) { // get the characters in each char NSUInteger count = charString.length; @@ -82,7 +74,7 @@ // add SVG to the dictionary NSString* key = [NSString stringWithFormat:@"%04x", [charString characterAtIndex:0]]; CGPathRef flippedPath = [IJSVGUtils newFlippedCGPath:path]; - _transformedPaths[key] = (id)flippedPath; + _transformedPaths[key] = (__bridge id)flippedPath; CGPathRelease(flippedPath); } CGPathRelease(path); @@ -113,15 +105,15 @@ { IJSVGBeginTransaction(); __block IJSVG* svg = nil; - IJSVGGroupLayer* layer = [[[IJSVGGroupLayer alloc] init] autorelease]; - IJSVGShapeLayer* shape = [[[IJSVGShapeLayer alloc] init] autorelease]; + IJSVGGroupLayer* layer = [[IJSVGGroupLayer alloc] init]; + IJSVGShapeLayer* shape = [[IJSVGShapeLayer alloc] init]; [layer addSublayer:shape]; shape.path = path; CGRect box = CGPathGetPathBoundingBox(path); svg = [[IJSVG alloc] initWithSVGLayer:layer viewBox:box]; IJSVGEndTransaction(); - return [svg autorelease]; + return svg; } @end diff --git a/Framework/IJSVG/IJSVG/Source/Core/IJSVGImageRep.m b/Framework/IJSVG/IJSVG/Source/Core/IJSVGImageRep.m index 0d0f63b..89bdc1f 100644 --- a/Framework/IJSVG/IJSVG/Source/Core/IJSVGImageRep.m +++ b/Framework/IJSVG/IJSVG/Source/Core/IJSVGImageRep.m @@ -50,13 +50,7 @@ + (instancetype)imageRepWithData:(NSData*)data { - return [[[self alloc] initWithData:data] autorelease]; -} - -- (void)dealloc -{ - (void)([_svg release]), _svg = nil; - [super dealloc]; + return [[self alloc] initWithData:data]; } - (instancetype)initWithData:(NSData*)data @@ -64,14 +58,13 @@ if ((self = [super init]) != nil) { // grab the string from the data // its more then likely UTF-8... - NSString* string = [[[NSString alloc] initWithData:data - encoding:NSUTF8StringEncoding] autorelease]; + NSString* string = [[NSString alloc] initWithData:data + encoding:NSUTF8StringEncoding]; _svg = [[IJSVG alloc] initWithSVGString:string]; // no valid SVG, just return nil; if (_svg == nil) { - [self release]; return nil; } diff --git a/Framework/IJSVG/IJSVG/Source/Core/IJSVGView.m b/Framework/IJSVG/IJSVG/Source/Core/IJSVGView.m index df856a5..0b4a640 100644 --- a/Framework/IJSVG/IJSVG/Source/Core/IJSVGView.m +++ b/Framework/IJSVG/IJSVG/Source/Core/IJSVGView.m @@ -17,15 +17,12 @@ // make sure we call this, or block may get called for a view // that doesnt exist [SVG prepForDrawingInView:nil]; - (void)([imageName release]), imageName = nil; - (void)([SVG release]), SVG = nil; - [super dealloc]; } + (IJSVGView*)viewWithSVGNamed:(NSString*)name { IJSVG* anSVG = [IJSVG svgNamed:name]; - return [[[self alloc] initWithSVG:anSVG] autorelease]; + return [[self alloc] initWithSVG:anSVG]; } - (id)initWithSVG:(IJSVG*)anSvg @@ -51,10 +48,7 @@ - (void)setSVG:(IJSVG*)anSVG { // memory clean - if (SVG != nil) { - (void)([SVG release]), SVG = nil; - } - SVG = [anSVG retain]; + SVG = anSVG; // redisplay ourself! [SVG prepForDrawingInView:self]; diff --git a/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporter.m b/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporter.m index 18224b4..9bb4a59 100644 --- a/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporter.m +++ b/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporter.m @@ -39,10 +39,10 @@ const NSArray* IJSVGShortCharacterArray(void) static NSArray* _array; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - _array = [@[ @"a", @"b", @"c", @"d", @"e", @"f", @"g", @"h", @"i", @"j", @"k", @"l", + _array = @[ @"a", @"b", @"c", @"d", @"e", @"f", @"g", @"h", @"i", @"j", @"k", @"l", @"m", @"n", @"o", @"p", @"q", @"r", @"s", @"t", @"u", @"v", @"w", @"x", @"y", @"z", @"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", - @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z" ] retain]; + @"M", @"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z" ]; }); return _array; } @@ -52,7 +52,7 @@ const NSDictionary* IJSVGDefaultAttributes(void) static NSDictionary* _defaults; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - _defaults = [@ { + _defaults = @{ @"clip" : @"auto", @"clip-path" : @"none", @"clip-rule" : @"nonzero", @@ -104,7 +104,7 @@ const NSDictionary* IJSVGDefaultAttributes(void) @"dominant-baseline" : @"auto", @"alignment-baseline" : @"baseline", @"baseline-shift" : @"baseline" - } retain]; + }; }); return _defaults; } @@ -114,7 +114,7 @@ const NSArray* IJSVGInheritableAttributes(void) static NSArray* _attributes; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - _attributes = [@[ + _attributes = @[ @"clip-rule", @"color", @"color-interpolation", @@ -159,7 +159,7 @@ const NSArray* IJSVGInheritableAttributes(void) @"white-space", @"word-spacing", @"writing-mode" - ] retain]; + ]; }); return _attributes; } @@ -171,7 +171,7 @@ void IJSVGApplyAttributesToElement(NSDictionary* _Nonnull attributes, NSXMLEleme NSDictionary* IJSVGElementAttributeDictionary(NSXMLElement* element) { - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; for (NSXMLNode* attribute in element.attributes) { dict[attribute.name] = attribute.stringValue; } @@ -188,16 +188,6 @@ NSString* IJSVGHash(NSString* key) return [@"#" stringByAppendingString:key]; } -- (void)dealloc -{ - (void)([_svg release]), _svg = nil; - (void)([_dom release]), _dom = nil; - (void)([_defElement release]), _defElement = nil; - (void)([_title release]), _title = nil; - (void)([_desc release]), _desc = nil; - [super dealloc]; -} - - (id)initWithSVG:(IJSVG*)svg size:(CGSize)size options:(IJSVGExporterOptions)options @@ -217,7 +207,7 @@ NSString* IJSVGHash(NSString* key) if ((self = [super init]) != nil) { _options = options; _size = size; - _svg = [svg retain]; + _svg = svg; // defaults for floating point rounding, if any _floatingPointOptions = floatingPointOptions; @@ -254,14 +244,14 @@ NSString* IJSVGHash(NSString* key) - (NSXMLElement*)rootNode:(NSXMLElement**)nestedRoot { // generates the root document - NSXMLElement* root = [[[NSXMLElement alloc] initWithName:@"svg"] autorelease]; + NSXMLElement* root = [[NSXMLElement alloc] initWithName:@"svg"]; // sort out viewbox NSRect viewBox = _svg.viewBox; - NSMutableDictionary* attributes = [[[NSMutableDictionary alloc] initWithDictionary:@{ + NSMutableDictionary* attributes = [[NSMutableDictionary alloc] initWithDictionary:@{ @"viewBox" : [self viewBoxWithRect:viewBox], @"xmlns" : XML_DOC_NS - }] autorelease]; + }]; // add on various XML declaritive things if (IJSVGExporterHasOption(_options, IJSVGExporterOptionRemoveXMLDeclaration) == NO) { @@ -276,7 +266,7 @@ NSString* IJSVGHash(NSString* key) // was there a size set? CGFloat scale = 1.f; - NSMutableArray* transforms = [[[NSMutableArray alloc] initWithCapacity:2] autorelease]; + NSMutableArray* transforms = [[NSMutableArray alloc] initWithCapacity:2]; if (CGSizeEqualToSize(CGSizeZero, _size) == NO && (_size.width != viewBox.size.width && _size.height != viewBox.size.height)) { // copy the attributes @@ -334,7 +324,7 @@ NSString* IJSVGHash(NSString* key) if (transforms.count != 0) { // concat the transform CGAffineTransform afTransform = IJSVGConcatTransforms(transforms); - NSXMLElement* transformedElement = [[[NSXMLElement alloc] initWithName:@"g"] autorelease]; + NSXMLElement* transformedElement = [[NSXMLElement alloc] initWithName:@"g"]; NSString* transString = nil; transString = [self transformAttributeStringForTransform:afTransform]; IJSVGApplyAttributesToElement( @@ -384,8 +374,8 @@ NSString* IJSVGHash(NSString* key) _idCount = 0; _shortIdCount = 0; _appliedXLink = NO; - (void)[_dom release], _dom = nil; - (void)[_defElement release], _defElement = nil; + _dom = nil; + _defElement = nil; // create the stand alone DOM @@ -417,7 +407,7 @@ NSString* IJSVGHash(NSString* key) // add generator if (IJSVGExporterHasOption(_options, IJSVGExporterOptionRemoveComments) == NO) { - NSXMLNode* generatorNode = [[[NSXMLNode alloc] initWithKind:NSXMLCommentKind] autorelease]; + NSXMLNode* generatorNode = [[NSXMLNode alloc] initWithKind:NSXMLCommentKind]; generatorNode.stringValue = XML_DOC_GENERATOR; [_dom.rootElement insertChild:generatorNode atIndex:0]; @@ -504,13 +494,13 @@ NSString* IJSVGHash(NSString* key) [element removeAttributeForName:@"transform"]; // x - NSXMLNode* att = [[[NSXMLNode alloc] initWithKind:NSXMLAttributeKind] autorelease]; + NSXMLNode* att = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; att.name = @"x"; att.stringValue = IJSVGShortFloatStringWithOptions(transform.parameters[0], _floatingPointOptions); [element addAttribute:att]; // y - att = [[[NSXMLNode alloc] initWithKind:NSXMLAttributeKind] autorelease]; + att = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; att.name = @"y"; att.stringValue = IJSVGShortFloatStringWithOptions(transform.parameters[1], _floatingPointOptions); [element addAttribute:att]; @@ -523,7 +513,7 @@ NSString* IJSVGHash(NSString* key) const NSArray* inhert = IJSVGInheritableAttributes(); NSArray* elements = [_dom nodesForXPath:@"//*" error:nil]; - NSMutableDictionary* rules = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* rules = [[NSMutableDictionary alloc] init]; for (NSXMLElement* element in elements) { NSDictionary* inhertEl = [self intersectableAttributes:IJSVGElementAttributeDictionary(element) inheritableAttributes:inhert]; @@ -541,10 +531,10 @@ NSString* IJSVGHash(NSString* key) } // add styles to dom - NSXMLElement* styles = [[[NSXMLElement alloc] initWithName:@"style"] autorelease]; - NSXMLNode* node = [[[NSXMLNode alloc] initWithKind:NSXMLTextKind] autorelease]; + NSXMLElement* styles = [[NSXMLElement alloc] initWithName:@"style"]; + NSXMLNode* node = [[NSXMLNode alloc] initWithKind:NSXMLTextKind]; - NSMutableArray* classes = [[[NSMutableArray alloc] initWithCapacity:rules.count] autorelease]; + NSMutableArray* classes = [[NSMutableArray alloc] initWithCapacity:rules.count]; for (NSString* r in rules) { [classes addObject:[NSString stringWithFormat:@".%@%@", rules[r], r]]; } @@ -555,7 +545,7 @@ NSString* IJSVGHash(NSString* key) - (NSString*)styleSheetRulesFromDictionary:(NSDictionary*)dict { - NSMutableArray* array = [[[NSMutableArray alloc] initWithCapacity:dict.count] autorelease]; + NSMutableArray* array = [[NSMutableArray alloc] initWithCapacity:dict.count]; for (NSString* key in dict.allKeys) { [array addObject:[NSString stringWithFormat:@"%@: %@;", key, dict[key]]]; } @@ -641,7 +631,7 @@ NSString* IJSVGHash(NSString* key) const NSArray* inheritableAttributes = IJSVGInheritableAttributes(); __block NSDictionary* intersection = nil; - NSMutableArray* currentGroup = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* currentGroup = [[NSMutableArray alloc] init]; BOOL (^createGroupIfRequired)(void) = ^BOOL { // memory clean @@ -653,7 +643,7 @@ NSString* IJSVGHash(NSString* key) // at this point we can create a new group and remove all the attributes NSInteger insertIndex = currentGroup.lastObject.index; - NSXMLElement* group = [[[NSXMLElement alloc] initWithName:@"g"] autorelease]; + NSXMLElement* group = [[NSXMLElement alloc] initWithName:@"g"]; IJSVGApplyAttributesToElement(intersection, group); // add back into the dom @@ -738,7 +728,7 @@ NSString* IJSVGHash(NSString* key) - (NSDictionary*)intersectableAttributes:(NSDictionary*)atts inheritableAttributes:(const NSArray*)inheritable { - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; for (NSString* key in atts.allKeys) { if ([inheritable containsObject:key]) { dict[key] = atts[key]; @@ -751,7 +741,7 @@ NSString* IJSVGHash(NSString* key) currentAttributes:(NSDictionary*)currentAttributes inheritableAttributes:(const NSArray*)inheritableAtts { - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; for (NSString* key in newAttributes.allKeys) { // make sure they are the same and // they are inheritable @@ -909,12 +899,12 @@ NSString* IJSVGHash(NSString* key) NSArray* paths = [_dom nodesForXPath:@"//path" error:nil]; - NSCountedSet* set = [[[NSCountedSet alloc] init] autorelease]; + NSCountedSet* set = [[NSCountedSet alloc] init]; for (NSXMLElement* element in paths) { [set addObject:[element attributeForName:@"d"].stringValue]; } - NSMutableDictionary* defs = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* defs = [[NSMutableDictionary alloc] init]; // now actually compute them for (NSXMLElement* element in paths) { @@ -927,7 +917,7 @@ NSString* IJSVGHash(NSString* key) NSXMLElement* defParentElement = nil; if ((defParentElement = [defs objectForKey:data]) == nil) { // create the def - NSXMLElement* element = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* element = [[NSXMLElement alloc] init]; element.name = @"path"; NSDictionary* atts = @{ @"d" : data, @@ -940,13 +930,13 @@ NSString* IJSVGHash(NSString* key) } // we know at this point, we need to swap out the path to a use - NSXMLElement* use = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* use = [[NSXMLElement alloc] init]; use.name = @"use"; // grab the id NSString* pathId = [defParentElement attributeForName:@"id"].stringValue; - NSXMLNode* useAttribute = [[[NSXMLNode alloc] initWithKind:NSXMLAttributeKind] autorelease]; + NSXMLNode* useAttribute = [[NSXMLNode alloc] initWithKind:NSXMLAttributeKind]; useAttribute.name = @"xlink:href"; useAttribute.stringValue = IJSVGHash(pathId); [use addAttribute:useAttribute]; @@ -1091,7 +1081,7 @@ NSString* IJSVGHash(NSString* key) fromParent:(NSXMLElement*)parent { // create the element - NSXMLElement* e = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* e = [[NSXMLElement alloc] init]; e.name = @"g"; // stick defaults @@ -1114,7 +1104,7 @@ NSString* IJSVGHash(NSString* key) } // convert the CGImage into an NSImage - NSBitmapImageRep* rep = [[[NSBitmapImageRep alloc] initWithCGImage:image] autorelease]; + NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCGImage:image]; // work out the data NSData* data = [rep representationUsingType:NSBitmapImageFileTypePNG @@ -1136,7 +1126,7 @@ NSString* IJSVGHash(NSString* key) fromParent:nil]; patternElement.name = @"pattern"; - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; dict[@"id"] = [self identifierForElement:patternElement]; dict[@"width"] = IJSVGShortFloatStringWithOptions(layer.patternNode.width.value, _floatingPointOptions); dict[@"height"] = IJSVGShortFloatStringWithOptions(layer.patternNode.height.value, _floatingPointOptions); @@ -1160,7 +1150,7 @@ NSString* IJSVGHash(NSString* key) [[self defElement] addChild:patternElement]; // now the use statement - NSXMLElement* useElement = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* useElement = [[NSXMLElement alloc] init]; useElement.name = @"use"; // now add the fill @@ -1187,7 +1177,7 @@ NSString* IJSVGHash(NSString* key) toElement:(NSXMLElement*)element { IJSVGGradient* gradient = layer.gradient; - NSXMLElement* gradientElement = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* gradientElement = [[NSXMLElement alloc] init]; // work out linear gradient if ([gradient isKindOfClass:[IJSVGLinearGradient class]]) { @@ -1247,10 +1237,10 @@ NSString* IJSVGHash(NSString* key) } // create the stop element - NSXMLElement* stop = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* stop = [[NSXMLElement alloc] init]; stop.name = @"stop"; - NSMutableDictionary* atts = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* atts = [[NSMutableDictionary alloc] init]; atts[@"offset"] = [NSString stringWithFormat:@"%g%%", (location * 100)]; // add the color @@ -1312,10 +1302,10 @@ NSString* IJSVGHash(NSString* key) } // image element for the SVG - NSXMLElement* imageElement = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* imageElement = [[NSXMLElement alloc] init]; imageElement.name = @"image"; - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; dict[@"id"] = [self identifierForElement:imageElement]; dict[@"width"] = IJSVGShortFloatStringWithOptions(layer.frame.size.width, _floatingPointOptions); dict[@"height"] = IJSVGShortFloatStringWithOptions(layer.frame.size.height, _floatingPointOptions); @@ -1368,7 +1358,7 @@ NSString* IJSVGHash(NSString* key) - (NSXMLElement*)elementForShape:(IJSVGShapeLayer*)layer fromParent:(NSXMLElement*)parent { - NSXMLElement* e = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* e = [[NSXMLElement alloc] init]; e.name = [self elementNameForPrimitiveType:layer.primitiveType]; CGPathRef path = layer.path; @@ -1377,7 +1367,7 @@ NSString* IJSVGHash(NSString* key) layer.frame.origin.y); CGPathRef transformPath = CGPathCreateCopyByTransformingPath(path, &trans); - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; BOOL cleanupPaths = IJSVGExporterHasOption(_options, IJSVGExporterOptionCleanupPaths); BOOL convertArcs = IJSVGExporterHasOption(_options, IJSVGExporterOptionConvertArcs); BOOL convertShapesToPaths = IJSVGExporterHasOption(_options, IJSVGExporterOptionConvertShapesToPaths); @@ -1392,9 +1382,9 @@ NSString* IJSVGHash(NSString* key) CGFloat radX = fabs(pathElement->points[2].x - currentPoint.x); CGFloat radY = fabs(pathElement->points[2].y - currentPoint.y); - dict[@"rx"] = IJSVGShortFloatStringWithOptions(radX, _floatingPointOptions); + dict[@"rx"] = IJSVGShortFloatStringWithOptions(radX, self->_floatingPointOptions); if (radX != radY) { - dict[@"ry"] = IJSVGShortFloatStringWithOptions(radY, _floatingPointOptions); + dict[@"ry"] = IJSVGShortFloatStringWithOptions(radY, self->_floatingPointOptions); } } }); @@ -1403,38 +1393,38 @@ NSString* IJSVGHash(NSString* key) if (cleanupPaths == YES && radiusSet == NO && convertShapesToPaths == YES) { // construct array of instructions to do e.name = [self elementNameForPrimitiveType:kIJSVGPrimitivePathTypePath]; - NSMutableArray* instructions = [[[NSMutableArray alloc] initWithCapacity:5] autorelease]; + NSMutableArray* instructions = [[NSMutableArray alloc] initWithCapacity:5]; // M -> H -> V -> H -> z // M IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' + dataCount:2]; instruction.data[0] = boundingBox.origin.x; instruction.data[1] = boundingBox.origin.y; [instructions addObject:instruction]; // H - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'H' - dataCount:1] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'H' + dataCount:1]; instruction.data[0] = boundingBox.origin.x + boundingBox.size.width; [instructions addObject:instruction]; // V - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'V' - dataCount:1] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'V' + dataCount:1]; instruction.data[0] = boundingBox.origin.y + boundingBox.size.height; [instructions addObject:instruction]; // H - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'H' - dataCount:1] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'H' + dataCount:1]; instruction.data[0] = boundingBox.origin.x; [instructions addObject:instruction]; // Z - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' - dataCount:0] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' + dataCount:0]; [instructions addObject:instruction]; dict[@"d"] = [self pathFromInstructions:instructions]; } else { @@ -1454,13 +1444,13 @@ NSString* IJSVGHash(NSString* key) // M -> L e.name = [self elementNameForPrimitiveType:kIJSVGPrimitivePathTypePath]; NSMutableArray* instructions = nil; - instructions = [[[NSMutableArray alloc] initWithCapacity:2] autorelease]; + instructions = [[NSMutableArray alloc] initWithCapacity:2]; IJSVGEnumerateCGPathElements(transformPath, ^(const CGPathElement* pathElement, CGPoint currentPoint) { switch (pathElement->type) { case kCGPathElementMoveToPoint: { IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' + dataCount:2]; instruction.data[0] = pathElement->points[0].x; instruction.data[1] = pathElement->points[0].y; [instructions addObject:instruction]; @@ -1468,8 +1458,8 @@ NSString* IJSVGHash(NSString* key) } case kCGPathElementAddLineToPoint: { IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'L' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'L' + dataCount:2]; instruction.data[0] = pathElement->points[0].x; instruction.data[1] = pathElement->points[0].y; [instructions addObject:instruction]; @@ -1484,13 +1474,13 @@ NSString* IJSVGHash(NSString* key) IJSVGEnumerateCGPathElements(transformPath, ^(const CGPathElement* pathElement, CGPoint currentPoint) { switch (pathElement->type) { case kCGPathElementMoveToPoint: { - dict[@"x1"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].x, _floatingPointOptions); - dict[@"y1"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].y, _floatingPointOptions); + dict[@"x1"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].x, self->_floatingPointOptions); + dict[@"y1"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].y, self->_floatingPointOptions); break; } case kCGPathElementAddLineToPoint: { - dict[@"x2"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].x, _floatingPointOptions); - dict[@"y2"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].y, _floatingPointOptions); + dict[@"x2"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].x, self->_floatingPointOptions); + dict[@"y2"] = IJSVGShortFloatStringWithOptions(pathElement->points[0].y, self->_floatingPointOptions); break; } default: @@ -1506,13 +1496,13 @@ NSString* IJSVGHash(NSString* key) // M -> L+ e.name = [self elementNameForPrimitiveType:kIJSVGPrimitivePathTypePath]; NSMutableArray* instructions = nil; - instructions = [[[NSMutableArray alloc] init] autorelease]; + instructions = [[NSMutableArray alloc] init]; IJSVGEnumerateCGPathElements(transformPath, ^(const CGPathElement* pathElement, CGPoint currentPoint) { switch (pathElement->type) { case kCGPathElementMoveToPoint: { IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' + dataCount:2]; instruction.data[0] = pathElement->points[0].x; instruction.data[1] = pathElement->points[0].y; [instructions addObject:instruction]; @@ -1520,8 +1510,8 @@ NSString* IJSVGHash(NSString* key) } case kCGPathElementAddLineToPoint: { IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'L' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'L' + dataCount:2]; instruction.data[0] = pathElement->points[0].x; instruction.data[1] = pathElement->points[0].y; [instructions addObject:instruction]; @@ -1537,13 +1527,13 @@ NSString* IJSVGHash(NSString* key) [instructions removeLastObject]; } IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' - dataCount:0] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' + dataCount:0]; [instructions addObject:instruction]; } dict[@"d"] = [self pathFromInstructions:instructions]; } else { - NSMutableArray* points = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* points = [[NSMutableArray alloc] init]; __block CGPathElementType type; IJSVGEnumerateCGPathElements(transformPath, ^(const CGPathElement* pathElement, CGPoint currentPoint) { type = pathElement->type; @@ -1584,19 +1574,19 @@ NSString* IJSVGHash(NSString* key) // M + A + A +Z e.name = [self elementNameForPrimitiveType:kIJSVGPrimitivePathTypePath]; NSMutableArray* instructions = nil; - instructions = [[[NSMutableArray alloc] initWithCapacity:4] autorelease]; + instructions = [[NSMutableArray alloc] initWithCapacity:4]; // M IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' + dataCount:2]; instruction.data[0] = cx; instruction.data[1] = cy - ry; [instructions addObject:instruction]; // A - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' - dataCount:7] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' + dataCount:7]; instruction.data[0] = rx; instruction.data[1] = ry; instruction.data[2] = 0; @@ -1607,8 +1597,8 @@ NSString* IJSVGHash(NSString* key) [instructions addObject:instruction]; // A - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' - dataCount:7] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' + dataCount:7]; instruction.data[0] = rx; instruction.data[1] = ry; instruction.data[2] = 0; @@ -1619,8 +1609,8 @@ NSString* IJSVGHash(NSString* key) [instructions addObject:instruction]; // Z - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' - dataCount:0] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' + dataCount:0]; [instructions addObject:instruction]; dict[@"d"] = [self pathFromInstructions:instructions]; } else { @@ -1640,19 +1630,19 @@ NSString* IJSVGHash(NSString* key) // M + A + A +Z e.name = [self elementNameForPrimitiveType:kIJSVGPrimitivePathTypePath]; NSMutableArray* instructions = nil; - instructions = [[[NSMutableArray alloc] initWithCapacity:4] autorelease]; + instructions = [[NSMutableArray alloc] initWithCapacity:4]; // M IJSVGExporterPathInstruction* instruction = nil; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' + dataCount:2]; instruction.data[0] = cx; instruction.data[1] = cy - r; [instructions addObject:instruction]; // A - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' - dataCount:7] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' + dataCount:7]; instruction.data[0] = r; instruction.data[1] = r; instruction.data[2] = 0; @@ -1663,8 +1653,8 @@ NSString* IJSVGHash(NSString* key) [instructions addObject:instruction]; // A - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' - dataCount:7] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'A' + dataCount:7]; instruction.data[0] = r; instruction.data[1] = r; instruction.data[2] = 0; @@ -1675,8 +1665,8 @@ NSString* IJSVGHash(NSString* key) [instructions addObject:instruction]; // Z - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' - dataCount:0] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' + dataCount:0]; [instructions addObject:instruction]; dict[@"d"] = [self pathFromInstructions:instructions]; } else { @@ -1826,7 +1816,7 @@ NSString* IJSVGHash(NSString* key) - (void)applyDefaultsToElement:(NSXMLElement*)element fromLayer:(IJSVGLayer*)layer { - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; // opacity if (layer.opacity != 1.f) { @@ -1835,7 +1825,7 @@ NSString* IJSVGHash(NSString* key) } // blendmode - we only every apply a stylesheet blend mode - NSMutableDictionary* style = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* style = [[NSMutableDictionary alloc] init]; if (layer.blendingMode != kCGBlendModeNormal) { NSString* str = [IJSVGUtils mixBlendingModeForBlendMode:(IJSVGBlendMode)layer.blendingMode]; if (str != nil) { @@ -1849,7 +1839,7 @@ NSString* IJSVGHash(NSString* key) } if (style.count != 0) { - NSMutableString* styleString = [[[NSMutableString alloc] init] autorelease]; + NSMutableString* styleString = [[NSMutableString alloc] init]; for (NSString* styleKey in style.allKeys) { NSString* format = [NSString stringWithFormat:@"%@:%@;", styleKey, style[styleKey]]; [styleString appendString:format]; @@ -1875,12 +1865,12 @@ NSString* IJSVGHash(NSString* key) fromLayer:(IJSVGLayer*)layer { // create the element - NSXMLElement* mask = [[[NSXMLElement alloc] init] autorelease]; + NSXMLElement* mask = [[NSXMLElement alloc] init]; mask.name = @"mask"; // create the key NSString* maskKey = [self identifierForElement:mask]; - NSMutableDictionary* dict = [[[NSMutableDictionary alloc] init] autorelease]; + NSMutableDictionary* dict = [[NSMutableDictionary alloc] init]; dict[@"id"] = maskKey; if (layer.mask.frame.origin.x != 0.f) { @@ -1936,8 +1926,8 @@ NSString* IJSVGHash(NSString* key) - (IJSVG*)SVG:(NSError**)error { - return [[[IJSVG alloc] initWithSVGString:self.SVGString - error:error] autorelease]; + return [[IJSVG alloc] initWithSVGString:self.SVGString + error:error]; } #pragma mark CGPath stuff @@ -1971,7 +1961,7 @@ NSString* IJSVGHash(NSString* key) void IJSVGExporterPathCaller(void* info, const CGPathElement* pathElement) { - IJSVGCGPathHandler handler = (IJSVGCGPathHandler)info; + IJSVGCGPathHandler handler = (__bridge IJSVGCGPathHandler)info; handler(pathElement); }; diff --git a/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporterPathInstruction.m b/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporterPathInstruction.m index 05f5430..9a20545 100644 --- a/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporterPathInstruction.m +++ b/Framework/IJSVG/IJSVG/Source/Exporter/IJSVGExporterPathInstruction.m @@ -26,7 +26,6 @@ if (_coords != NULL) { (void)free(_coords), _coords = NULL; } - [super dealloc]; } - (id)initWithInstruction:(char)instruction @@ -88,7 +87,7 @@ void IJSVGExporterPathInstructionCommandFree(IJSVGExporterPathInstructionCommand floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions { IJSVGExporterPathInstructionCommand* lastCommand = NULL; - NSMutableString* string = [[[NSMutableString alloc] init] autorelease]; + NSMutableString* string = [[NSMutableString alloc] init]; for (NSValue* value in instructionSets) { // read back the bytes IJSVGExporterPathInstructionCommand command; @@ -119,7 +118,7 @@ void IJSVGExporterPathInstructionCommandFree(IJSVGExporterPathInstructionCommand + (NSString*)pathStringFromInstructions:(NSArray*)instructions floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions { - NSMutableArray* pathInstructions = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* pathInstructions = [[NSMutableArray alloc] init]; for (IJSVGExporterPathInstruction* instruction in instructions) { CGFloat* data = instruction.data; const char lowerInstruction = tolower(instruction.instruction); @@ -285,8 +284,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, IJSVGExporterPathInstructionRoundData(adata, length, floatingPointOptions); IJSVGExporterPathInstruction* ainstruction = nil; - ainstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:instructionChar - dataCount:length] autorelease]; + ainstruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:instructionChar + dataCount:length]; memcpy(ainstruction.data, adata, sizeof(CGFloat) * length); // run these through our default string runner @@ -319,7 +318,7 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, floatingPointOptions:(IJSVGFloatingPointOptions)floatingPointOptions { NSMutableArray* nInstructions = nil; - nInstructions = [[[NSMutableArray alloc] initWithCapacity:instructions.count] autorelease]; + nInstructions = [[NSMutableArray alloc] initWithCapacity:instructions.count]; IJSVGExporterPathInstruction* lastInstruction = nil; for (IJSVGExporterPathInstruction* instruction in instructions) { lastInstruction = nInstructions.lastObject; @@ -330,8 +329,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, if (instruction.instruction == 'c') { if (lastInstruction.instruction == 'c' && instruction.data[0] == -(lastInstruction.data[2] - lastInstruction.data[4]) && instruction.data[1] == -(lastInstruction.data[3] - lastInstruction.data[5])) { IJSVGExporterPathInstruction* nInstruction = nil; - nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'s' - dataCount:4] autorelease]; + nInstruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'s' + dataCount:4]; nInstruction.data[0] = instruction.data[2]; nInstruction.data[1] = instruction.data[3]; nInstruction.data[2] = instruction.data[4]; @@ -340,8 +339,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, continue; } else if (lastInstruction.instruction == 's' && instruction.data[0] == -(lastInstruction.data[0] - lastInstruction.data[2]) && instruction.data[1] == -(lastInstruction.data[1] - lastInstruction.data[3])) { IJSVGExporterPathInstruction* nInstruction = nil; - nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'s' - dataCount:4] autorelease]; + nInstruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'s' + dataCount:4]; nInstruction.data[0] = instruction.data[2]; nInstruction.data[1] = instruction.data[3]; nInstruction.data[2] = instruction.data[4]; @@ -350,8 +349,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, continue; } else if (lastInstruction.instruction != 'c' && lastInstruction.instruction != 's' && instruction.data[0] == 0.f && instruction.data[1] == 0.f) { IJSVGExporterPathInstruction* nInstruction = nil; - nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'s' - dataCount:4] autorelease]; + nInstruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'s' + dataCount:4]; nInstruction.data[0] = instruction.data[2]; nInstruction.data[1] = instruction.data[3]; nInstruction.data[2] = instruction.data[4]; @@ -362,16 +361,16 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, } else if (instruction.instruction == 'q') { if (lastInstruction.instruction == 'q' && instruction.data[0] == (lastInstruction.data[2] - lastInstruction.data[0]) && instruction.data[1] == (lastInstruction.data[3] - lastInstruction.data[1])) { IJSVGExporterPathInstruction* nInstruction = nil; - nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'t' - dataCount:2] autorelease]; + nInstruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'t' + dataCount:2]; nInstruction.data[0] = instruction.data[2]; nInstruction.data[1] = instruction.data[3]; [nInstructions addObject:nInstruction]; continue; } else if (lastInstruction.instruction == 't' && instruction.data[2] == lastInstruction.data[0] && instruction.data[3] == lastInstruction.data[1]) { IJSVGExporterPathInstruction* nInstruction = nil; - nInstruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'t' - dataCount:2] autorelease]; + nInstruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'t' + dataCount:2]; nInstruction.data[0] = instruction.data[2]; nInstruction.data[1] = instruction.data[3]; [nInstructions addObject:nInstruction]; @@ -518,7 +517,7 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, // keep track of the current point __block CGPoint currentPoint = CGPointZero; - NSMutableArray* instructions = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* instructions = [[NSMutableArray alloc] init]; // create the path callback IJSVGCGPathHandler callback = ^(const CGPathElement* pathElement) { @@ -528,8 +527,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, case kCGPathElementMoveToPoint: { // move to command - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'M' + dataCount:2]; CGPoint point = pathElement->points[0]; instruction.data[0] = point.x; instruction.data[1] = point.y; @@ -543,16 +542,16 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, // line to command CGPoint point = pathElement->points[0]; if (point.x == currentPoint.x) { - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'V' - dataCount:1] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'V' + dataCount:1]; instruction.data[0] = point.y; } else if (point.y == currentPoint.y) { - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'H' - dataCount:1] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'H' + dataCount:1]; instruction.data[0] = point.x; } else { - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'L' - dataCount:2] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'L' + dataCount:2]; instruction.data[0] = point.x; instruction.data[1] = point.y; } @@ -566,8 +565,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, // quad curve to command CGPoint controlPoint = pathElement->points[0]; CGPoint point = pathElement->points[1]; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Q' - dataCount:4] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'Q' + dataCount:4]; instruction.data[0] = controlPoint.x; instruction.data[1] = controlPoint.y; instruction.data[2] = point.x; @@ -585,8 +584,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, CGPoint point = pathElement->points[2]; currentPoint = point; - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'C' - dataCount:6] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'C' + dataCount:6]; instruction.data[0] = controlPoint1.x; instruction.data[1] = controlPoint1.y; instruction.data[2] = controlPoint2.x; @@ -600,8 +599,8 @@ void IJSVGExporterPathInstructionRoundData(CGFloat* data, NSInteger length, case kCGPathElementCloseSubpath: { // close command - instruction = [[[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' - dataCount:0] autorelease]; + instruction = [[IJSVGExporterPathInstruction alloc] initWithInstruction:'Z' + dataCount:0]; [instructions addObject:instruction]; break; } diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGFilterLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGFilterLayer.m index 1d96221..209356e 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGFilterLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGFilterLayer.m @@ -13,9 +13,7 @@ - (void)dealloc { - (void)[_sublayer release], _sublayer = nil; (void)CGImageRelease(_image), _image = nil; - [super dealloc]; } - (instancetype)init @@ -59,7 +57,7 @@ _hostingLayer.frame = CGRectMake(frame.origin.x + (frame.size.width / 2.f - width / 2.f), frame.origin.y + (frame.size.height / 2.f - height / 2.f), width, height); - _hostingLayer.contents = (id)_image; + _hostingLayer.contents = (__bridge id)_image; } - (NSArray*>*)debugLayers diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGradientLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGradientLayer.m index 72afbe0..41dd8cf 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGradientLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGradientLayer.m @@ -11,12 +11,6 @@ @implementation IJSVGGradientLayer -- (void)dealloc -{ - (void)([_gradient release]), _gradient = nil; - [super dealloc]; -} - - (BOOL)requiresBackingScaleHelp { return YES; @@ -24,10 +18,7 @@ - (void)setGradient:(IJSVGGradient*)newGradient { - if (_gradient != nil) { - (void)([_gradient release]), _gradient = nil; - } - _gradient = [newGradient retain]; + _gradient = newGradient; // lets check its alpha properties on the colors BOOL hasAlphaChannel = NO; diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGroupLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGroupLayer.m index 33a7e28..a08b3a4 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGroupLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGGroupLayer.m @@ -13,12 +13,6 @@ @implementation IJSVGGroupLayer -- (void)dealloc -{ - (void)[_viewBox release], _viewBox = nil; - [super dealloc]; -} - - (CGRect)innerBoundingBox { return self.outerBoundingBox; diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGImageLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGImageLayer.m index 2cd89d2..e121a50 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGImageLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGImageLayer.m @@ -10,17 +10,10 @@ @implementation IJSVGImageLayer -- (void)dealloc -{ - (void)[_image release], _image = nil; - (void)[_imageLayer release], _imageLayer = nil; - [super dealloc]; -} - - (id)initWithImage:(IJSVGImage*)image { if((self = [super init]) != nil) { - _image = image.retain; + _image = image; } return self; } @@ -40,7 +33,7 @@ - (void)reloadContent { if(_imageLayer == nil) { - _imageLayer = [IJSVGBasicLayer layer].retain; + _imageLayer = [IJSVGBasicLayer layer]; _imageLayer.contentsGravity = kCAGravityResize; _imageLayer.affineTransform = CGAffineTransformMakeScale(1.f, -1.f); _imageLayer.contents = (id)_image.CGImage; diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGLayer.m index 45d2a95..37c4b30 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGLayer.m @@ -15,17 +15,6 @@ @implementation IJSVGLayer -- (void)dealloc -{ - (void)([_filter release]), _filter = nil; - (void)([_clipLayer release]), _clipLayer = nil; - (void)([_maskLayer release]), _maskLayer = nil; - (void)([_clipRule release]), _clipRule = nil; - (void)([_fillRule release]), _fillRule = nil; - (void)([_maskingLayer release]), _maskingLayer = nil; - [super dealloc]; -} - - (instancetype)init { if((self = [super init]) != nil) { @@ -287,7 +276,7 @@ + (NSArray*)deepestSublayersOfLayer:(CALayer*)layer { - NSMutableArray* arr = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* arr = [[NSMutableArray alloc] init]; for (CALayer* subLayer in layer.sublayers) { if (subLayer.sublayers.count != 0) { NSArray* moreLayers = [self deepestSublayersOfLayer:(IJSVGLayer*)subLayer]; @@ -393,14 +382,11 @@ } _convertMasksToPaths = flag; if (flag == YES) { - if (_maskingLayer != nil) { - (void)([_maskingLayer release]), _maskingLayer = nil; - } - _maskingLayer = [(IJSVGLayer*)self.mask retain]; + _maskingLayer = (IJSVGLayer*)self.mask; self.mask = nil; } else { self.mask = _maskingLayer; - (void)([_maskingLayer release]), _maskingLayer = nil; + _maskingLayer = nil; } } diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGPatternLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGPatternLayer.m index b68c42a..51a62e2 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGPatternLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGPatternLayer.m @@ -20,13 +20,6 @@ @implementation IJSVGPatternLayer -- (void)dealloc -{ - (void)([_pattern release]), _pattern = nil; - (void)([_patternNode release]), _patternNode = nil; - [super dealloc]; -} - - (BOOL)requiresBackingScaleHelp { return YES; @@ -35,7 +28,7 @@ void IJSVGPatternDrawingCallBack(void* info, CGContextRef ctx) { // reassign the layer - IJSVGPatternLayer* layer = (IJSVGPatternLayer*)info; + IJSVGPatternLayer* layer = (__bridge IJSVGPatternLayer*)info; CGSize size = layer.cellSize; CGContextSaveGState(ctx); CGRect rect = CGRectMake(0.f, 0.f, size.width, size.height); @@ -109,7 +102,7 @@ void IJSVGPatternDrawingCallBack(void* info, CGContextRef ctx) if(_patternNode.viewBox != nil && _patternNode.viewBox.isZeroRect == NO) { if(_patternNode.units == IJSVGUnitObjectBoundingBox) { IJSVGUnitRect* viewBox = nil; - viewBox = [[_patternNode.viewBox copyByConvertingToUnitsLengthType:IJSVGUnitLengthTypePercentage] autorelease]; + viewBox = [_patternNode.viewBox copyByConvertingToUnitsLengthType:IJSVGUnitLengthTypePercentage]; _viewBox = [viewBox computeValue:rect.size]; } } diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGRootLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGRootLayer.m index 45f5555..83aed73 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGRootLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGRootLayer.m @@ -14,7 +14,7 @@ { if(self.viewBox != nil) { CGRect viewBox = [self.viewBox computeValue:CGSizeZero]; - __block IJSVGRootLayer* weakSelf = self; + __weak IJSVGRootLayer* weakSelf = self; IJSVGViewBoxDrawingBlock drawingBlock = ^(CGSize size) { // we have to make sure we set the backing scale factor once // we know how scale this will be drawn at @@ -43,7 +43,7 @@ - (void)propagateBackingScalePropertiesToSublayers { - __block IJSVGRootLayer* weakSelf = self; + __weak IJSVGRootLayer* weakSelf = self; for(CALayer* layer in self.sublayers) { [IJSVGLayer recursivelyWalkLayer:layer withBlock:^(CALayer* propLayer, BOOL *stop) { diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGShapeLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGShapeLayer.m index b1ae5ad..150a8f5 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGShapeLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGShapeLayer.m @@ -11,16 +11,6 @@ @implementation IJSVGShapeLayer -- (void)dealloc -{ - (void)([_filter release]), _filter = nil; - (void)([_clipLayer release]), _clipLayer = nil; - (void)([_maskLayer release]), _maskLayer = nil; - (void)([_maskingLayer release]), _maskingLayer = nil; - (void)([_clipRule release]), _clipRule = nil; - [super dealloc]; -} - - (CALayer *)rootLayer { return [IJSVGLayer rootLayerForLayer:self]; @@ -97,14 +87,11 @@ } _convertMasksToPaths = flag; if (flag == YES) { - if (_maskingLayer != nil) { - (void)([_maskingLayer release]), _maskingLayer = nil; - } - _maskingLayer = [(IJSVGLayer*)self.mask retain]; + _maskingLayer = (IJSVGLayer*)self.mask; self.mask = nil; } else { self.mask = _maskingLayer; - (void)([_maskingLayer release]), _maskingLayer = nil; + _maskingLayer = nil; } } diff --git a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGTransformLayer.m b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGTransformLayer.m index c375302..15bbdaa 100644 --- a/Framework/IJSVG/IJSVG/Source/Layers/IJSVGTransformLayer.m +++ b/Framework/IJSVG/IJSVG/Source/Layers/IJSVGTransformLayer.m @@ -24,16 +24,6 @@ @synthesize filter = _filter; @synthesize innerBoundingBox; -- (void)dealloc -{ - (void)[_filter release], _filter = nil; - (void)[_maskLayer release], _maskLayer = nil; - (void)[_fillRule release], _fillRule = nil; - (void)[_clipRule release], _clipRule = nil; - (void)[_clipLayer release], _clipLayer = nil; - [super dealloc]; -} - - (CALayer *)referencedLayer { return self.sublayers.firstObject; diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.h b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.h index 341fd54..c6cc96f 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.h +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.h @@ -12,7 +12,7 @@ } -@property (nonatomic, retain) NSColor* color; +@property (nonatomic, strong) NSColor* color; @property (nonatomic, assign) BOOL isNoneOrTransparent; + (IJSVGNode*)colorNodeWithColor:(NSColor*)color; diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.m index b574e2e..451d62a 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGColorNode.m @@ -12,13 +12,12 @@ - (void)dealloc { - (void)[_color release], _color = nil; - [super dealloc]; + (void)_color, _color = nil; } + (IJSVGNode*)colorNodeWithColor:(NSColor *)color { - return [[[self alloc] initWithColor:color] autorelease]; + return [[self alloc] initWithColor:color]; } - (id)initWithColor:(NSColor*)color { diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGDef.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGDef.m index eb438b5..a8188b8 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGDef.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGDef.m @@ -10,12 +10,6 @@ @implementation IJSVGDef -- (void)dealloc -{ - (void)([_dict release]), _dict = nil; - [super dealloc]; -} - - (id)init { if ((self = [super init]) != nil) { diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilter.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilter.m index b1ef82b..88b79a0 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilter.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilter.m @@ -36,9 +36,6 @@ CIContext* context = manager.CIContext; CGImageRef outputImage = [context createCGImage:image fromRect:image.extent]; -// NSImage* nimage = [[[NSImage alloc] initWithCGImage:outputImage -// size:NSMakeSize(CGImageGetWidth(outputImage), -// CGImageGetHeight(outputImage))] autorelease]; layer.filter = filter; return outputImage; } diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilterEffect.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilterEffect.m index 7a643ba..a3af479 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilterEffect.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGFilterEffect.m @@ -15,9 +15,9 @@ static NSDictionary* _elementClassMap = nil; + (void)load { - _elementClassMap = [@{ + _elementClassMap = @{ @"fegaussianblur": IJSVGFilterEffectGaussianBlur.class - } retain]; + }; } + (Class)effectClassForElementName:(NSString*)name @@ -71,13 +71,6 @@ static NSDictionary* _elementClassMap = nil; return IJSVGFilterEffectEdgeModeNone; } -- (void)dealloc -{ - (void)[_primitiveReference release], _primitiveReference = nil; - (void)[_stdDeviation release], _stdDeviation = nil; - [super dealloc]; -} - - (CIImage*)processImage:(CIImage*)image { return image; diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGForeignObject.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGForeignObject.m index cf4dc7d..f12153f 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGForeignObject.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGForeignObject.m @@ -10,10 +10,4 @@ @implementation IJSVGForeignObject -- (void)dealloc -{ - (void)([_requiredExtension release]), _requiredExtension = nil; - [super dealloc]; -} - @end diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGradient.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGradient.m index a9c60fa..2c2cdbe 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGradient.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGradient.m @@ -15,29 +15,21 @@ - (void)dealloc { - (void)([_x1 release]), _x1 = nil; - (void)([_x2 release]), _x2 = nil; - (void)([_y1 release]), _y1 = nil; - (void)([_y2 release]), _y2 = nil; - (void)([_gradient release]), _gradient = nil; - (void)([_privateColorList release]), _privateColorList = nil; if (_CGGradient != nil) { CGGradientRelease(_CGGradient); } - [super dealloc]; } - (id)copyWithZone:(NSZone*)zone { IJSVGGradient* clone = [super copyWithZone:zone]; - clone.gradient = [[self.gradient copy] autorelease]; + clone.gradient = [self.gradient copy]; return clone; } - (void)setColorList:(IJSVGColorList*)list { - (void)([_privateColorList release]), _privateColorList = nil; - _privateColorList = list.retain; + _privateColorList = list; if (_CGGradient != nil) { CGGradientRelease(_CGGradient); _CGGradient = nil; @@ -48,7 +40,7 @@ colors:(NSArray**)someColors { NSArray* stops = gradient.children; - NSMutableArray* colors = [[[NSMutableArray alloc] initWithCapacity:stops.count] autorelease]; + NSMutableArray* colors = [[NSMutableArray alloc] initWithCapacity:stops.count]; CGFloat* stopsParams = (CGFloat*)malloc(stops.count * sizeof(CGFloat)); NSInteger i = 0; @@ -72,7 +64,7 @@ - (IJSVGColorList*)colorList { - IJSVGColorList* sheet = [[[IJSVGColorList alloc] init] autorelease]; + IJSVGColorList* sheet = [[IJSVGColorList alloc] init]; NSInteger num = self.gradient.numberOfColorStops; for (NSInteger i = 0; i < num; i++) { NSColor* color; diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.h b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.h index 6866fd5..a519aa6 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.h +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.h @@ -16,7 +16,7 @@ NSMutableArray* _children; } -@property (nonatomic, readonly) NSArray* children; +@property (weak, nonatomic, readonly) NSArray* children; - (void)addChild:(IJSVGNode*)child; diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.m index 2cb13de..2641170 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGGroup.m @@ -12,8 +12,7 @@ - (void)dealloc { - (void)([_children release]), _children = nil; - [super dealloc]; + (void)(_children), _children = nil; } - (id)init @@ -27,7 +26,7 @@ - (void)prepareFromCopy { if(_children != nil) { - (void)[_children release], _children = nil; + (void)_children, _children = nil; } _children = [[NSMutableArray alloc] init]; } @@ -37,8 +36,8 @@ IJSVGGroup* node = [super copyWithZone:zone]; [node prepareFromCopy]; - for (IJSVGNode* childNode in _children) { - childNode = [[childNode copy] autorelease]; + for (__strong IJSVGNode* childNode in _children) { + childNode = [childNode copy]; childNode.parentNode = node; [node addChild:childNode]; } diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGImage.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGImage.m index 3f8d1c7..fd8df05 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGImage.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGImage.m @@ -15,8 +15,6 @@ - (void)dealloc { (void)(CGImageRelease(CGImage)), CGImage = nil; - (void)([_image release]), _image = nil; - [super dealloc]; } - (void)loadFromString:(NSString*)encodedString @@ -43,16 +41,13 @@ } // set the image against the container - NSImage* anImage = [[[NSImage alloc] initWithData:data] autorelease]; + NSImage* anImage = [[NSImage alloc] initWithData:data]; [self setImage:anImage]; } - (void)setImage:(NSImage*)anImage { - if (_image != nil) { - (void)([_image release]), _image = nil; - } - _image = [anImage retain]; + _image = anImage; _intrinsicSize = (CGSize)_image.size; if (CGImage != nil) { diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGLinearGradient.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGLinearGradient.m index f09edad..027dba1 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGLinearGradient.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGLinearGradient.m @@ -36,7 +36,7 @@ colorSpace:IJSVGColor.defaultColorSpace]; free(stopsParams); - return [grad autorelease]; + return grad; } - (void)drawInContextRef:(CGContextRef)ctx diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGNode.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGNode.m index 00aff73..2cfd1bb 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGNode.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGNode.m @@ -19,32 +19,6 @@ - (void)dealloc { (void)free(_strokeDashArray), _strokeDashArray = NULL; - (void)([_x release]), _x = nil; - (void)([_y release]), _y = nil; - (void)([_width release]), _width = nil; - (void)([_height release]), _height = nil; - (void)([_opacity release]), _opacity = nil; - (void)([_offset release]), _offset = nil; - (void)([_fillOpacity release]), _fillOpacity = nil; - (void)([_strokeOpacity release]), _strokeOpacity = nil; - (void)([_strokeWidth release]), _strokeWidth = nil; - (void)([_strokeDashOffset release]), _strokeDashOffset = nil; - (void)([_unicode release]), _unicode = nil; - (void)([_fill release]), _fill = nil; - (void)([_stroke release]), _stroke = nil; - (void)([_transforms release]), _transforms = nil; - (void)([_identifier release]), _identifier = nil; - (void)([_name release]), _name = nil; - (void)([_title release]), _title = nil; - (void)([_desc release]), _desc = nil; - (void)([_className release]), _className = nil; - (void)([_classNameList release]), _classNameList = nil; - (void)([_clipPath release]), _clipPath = nil; - (void)([_svg release]), _svg = nil; - (void)([_mask release]), _mask = nil; - (void)([_viewBox release]), _viewBox = nil; - (void)([_filter release]), _filter = nil; - [super dealloc]; } + (IJSVGNodeType)typeForString:(NSString*)string @@ -284,15 +258,13 @@ - (void)setFill:(IJSVGNode*)fill { NSAssert([fill matchesTraits:IJSVGNodeTraitPaintable] || fill == nil, @"Fill must a paintable node."); - (void)[_fill release], _fill = nil; - _fill = [fill retain]; + _fill = fill; } - (void)setStroke:(IJSVGNode*)stroke { NSAssert([stroke matchesTraits:IJSVGNodeTraitPaintable]|| stroke == nil, @"Stroke must be a paintable node."); - (void)[_stroke release], _stroke = nil; - _stroke = [stroke retain]; + _stroke = stroke; } // winding rule can inherit.. @@ -356,7 +328,7 @@ - (NSArray*)lineDashPattern { - NSMutableArray* arr = [[[NSMutableArray alloc] initWithCapacity:self.strokeDashArrayCount] autorelease]; + NSMutableArray* arr = [[NSMutableArray alloc] initWithCapacity:self.strokeDashArrayCount]; for (NSInteger i = 0; i < self.strokeDashArrayCount; i++) { [arr addObject:@((CGFloat)self.strokeDashArray[i])]; } diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGPath.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGPath.m index 2a391d2..83a18db 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGPath.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGPath.m @@ -15,7 +15,6 @@ if(_path != NULL) { (void)CGPathRelease(_path), _path = NULL; } - [super dealloc]; } - (id)init diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.h b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.h index d8d6179..ed0a8f4 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.h +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.h @@ -11,12 +11,12 @@ @interface IJSVGRadialGradient : IJSVGGradient -@property (nonatomic, retain) IJSVGUnitLength* cx; -@property (nonatomic, retain) IJSVGUnitLength* cy; -@property (nonatomic, retain) IJSVGUnitLength* fx; -@property (nonatomic, retain) IJSVGUnitLength* fy; -@property (nonatomic, retain) IJSVGUnitLength* fr; -@property (nonatomic, retain) IJSVGUnitLength* r; +@property (nonatomic, strong) IJSVGUnitLength* cx; +@property (nonatomic, strong) IJSVGUnitLength* cy; +@property (nonatomic, strong) IJSVGUnitLength* fx; +@property (nonatomic, strong) IJSVGUnitLength* fy; +@property (nonatomic, strong) IJSVGUnitLength* fr; +@property (nonatomic, strong) IJSVGUnitLength* r; + (NSGradient*)parseGradient:(NSXMLElement*)element gradient:(IJSVGRadialGradient*)gradient; diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.m index 0dec61d..9ddb2dc 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRadialGradient.m @@ -13,13 +13,12 @@ - (void)dealloc { - (void)([_cx release]), _cx = nil; - (void)([_cy release]), _cy = nil; - (void)([_fx release]), _fx = nil; - (void)([_fy release]), _fy = nil; - (void)([_fr release]), _fr = nil; - (void)([_r release]), _r = nil; - [super dealloc]; + (void)(_cx), _cx = nil; + (void)(_cy), _cy = nil; + (void)(_fx), _fx = nil; + (void)(_fy), _fy = nil; + (void)(_fr), _fr = nil; + (void)(_r), _r = nil; } - (id)copyWithZone:(NSZone*)zone @@ -91,9 +90,9 @@ CGFloat* colorStops = [self.class computeColorStops:gradient colors:&colors]; - NSGradient* ret = [[[NSGradient alloc] initWithColors:colors + NSGradient* ret = [[NSGradient alloc] initWithColors:colors atLocations:colorStops - colorSpace:IJSVGColor.defaultColorSpace] autorelease]; + colorSpace:IJSVGColor.defaultColorSpace]; free(colorStops); return ret; } diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRootNode.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRootNode.m index 67e33e5..d2f10ca 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRootNode.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGRootNode.m @@ -10,12 +10,6 @@ @implementation IJSVGRootNode -- (void)dealloc -{ - (void)[_intrinsicSize release], _intrinsicSize = nil; - [super dealloc]; -} - - (instancetype)init { if((self = [super init]) != nil) { diff --git a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGText.m b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGText.m index fac42b9..c6d1c66 100644 --- a/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGText.m +++ b/Framework/IJSVG/IJSVG/Source/Nodes/IJSVGText.m @@ -10,12 +10,6 @@ @implementation IJSVGText -- (void)dealloc -{ - (void)([_text release]), _text = nil; - [super dealloc]; -} - - (IJSVGText*)copyWithZone:(NSZone*)zone { IJSVGText* node = [super copyWithZone:zone]; diff --git a/Framework/IJSVG/IJSVG/Source/Parsing/IJSVGParser.m b/Framework/IJSVG/IJSVG/Source/Parsing/IJSVGParser.m index 141c6f5..cd30f26 100644 --- a/Framework/IJSVG/IJSVG/Source/Parsing/IJSVGParser.m +++ b/Framework/IJSVG/IJSVG/Source/Parsing/IJSVGParser.m @@ -78,7 +78,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; + (void)load { - _IJSVGAttributeDictionaryFloats = [@{ + _IJSVGAttributeDictionaryFloats = @{ IJSVGAttributeX : @"x", IJSVGAttributeY : @"y", IJSVGAttributeWidth : @"width", @@ -87,22 +87,22 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; IJSVGAttributeStrokeOpacity : @"strokeOpacity", IJSVGAttributeStrokeWidth : @"strokeWidth", IJSVGAttributeStrokeDashOffset : @"strokeDashOffset", - IJSVGAttributeFillOpacity : @"fillOpacity" } retain]; - _IJSVGAttributeDictionaryNodes = [@{ + IJSVGAttributeFillOpacity : @"fillOpacity" }; + _IJSVGAttributeDictionaryNodes = @{ IJSVGAttributeClipPath : @"clipPath", - IJSVGAttributeMask : @"mask" } retain]; - _IJSVGAttributeDictionaryUnits = [@{ + IJSVGAttributeMask : @"mask" }; + _IJSVGAttributeDictionaryUnits = @{ IJSVGAttributeGradientUnits : @"units", IJSVGAttributeMaskUnits : @"units", IJSVGAttributePatternUnits : @"units", IJSVGAttributeMaskContentUnits : @"contentUnits", IJSVGAttributePatternContentUnits : @"contentUnits" - } retain]; - _IJSVGAttributeDictionaryTransforms = [@{ + }; + _IJSVGAttributeDictionaryTransforms = @{ IJSVGAttributeTransform : @"transforms", IJSVGAttributeGradientTransform : @"transforms", IJSVGAttributePatternTransform : @"transforms" - } retain]; + }; } + (IJSVGParser*)groupForFileURL:(NSURL*)aURL @@ -124,17 +124,9 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; error:(NSError**)error delegate:(id)delegate { - return [[[self.class alloc] initWithFileURL:aURL + return [[self.class alloc] initWithFileURL:aURL error:error - delegate:delegate] autorelease]; -} - -- (void)dealloc -{ - (void)([_detachedElements release]), _detachedElements = nil; - (void)([_rootNode release]), _rootNode = nil; - (void)([_styleSheet release]), _styleSheet = nil; - [super dealloc]; + delegate:delegate]; } - (id)initWithSVGString:(NSString*)string @@ -177,14 +169,12 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; anError = nil; if (![self _validateParse:&anError]) { *error = anError; - (void)([_document release]), _document = nil; - (void)([self release]), self = nil; return nil; } // we have actually finished with the document at this point // so just get rid of it - (void)([_document release]), _document = nil; + _document = nil; } return self; } @@ -193,9 +183,9 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; { @try { NSError* error; - NSXMLDocument* doc = [[[NSXMLDocument alloc] initWithData:data - options:0 - error:&error] autorelease]; + NSXMLDocument* doc = [[NSXMLDocument alloc] initWithData:data + options:0 + error:&error]; return doc != nil && error == nil; } @catch (NSException* exception) { } @@ -227,12 +217,10 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; error:(NSError**)error { if (error) { - *error = [[[NSError alloc] initWithDomain:IJSVGErrorDomain - code:code - userInfo:nil] autorelease]; + *error = [[NSError alloc] initWithDomain:IJSVGErrorDomain + code:code + userInfo:nil]; } - (void)([_document release]), _document = nil; - (void)([self release]), self = nil; return nil; } @@ -248,9 +236,9 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; _rootNode.bounds.size.width == 0 || _rootNode.bounds.size.height == 0) { if (error != NULL) { - *error = [[[NSError alloc] initWithDomain:IJSVGErrorDomain - code:IJSVGErrorInvalidViewBox - userInfo:nil] autorelease]; + *error = [[NSError alloc] initWithDomain:IJSVGErrorDomain + code:IJSVGErrorInvalidViewBox + userInfo:nil]; } return NO; } @@ -326,7 +314,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; CGRect computedBounds = CGRectZero; IJSVGUnitType unitType = [node contentUnitsWithReferencingNodeBounds:&computedBounds]; NSMutableDictionary* attributes = nil; - attributes = [[[NSMutableDictionary alloc] initWithCapacity:element.attributes.count] autorelease]; + attributes = [[NSMutableDictionary alloc] initWithCapacity:element.attributes.count]; for(NSXMLNode* attributeNode in element.attributes) { attributes[attributeNode.name] = attributeNode.stringValue; } @@ -361,7 +349,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; node.identifier = value; [self detachElement:element withIdentifier:value - parentNode:node.parentNode ?: _rootNode]; + parentNode:node.parentNode ?: self->_rootNode]; }); // class list @@ -407,7 +395,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; // transforms IJSVGAttributesParse(_IJSVGAttributeDictionaryTransforms, ^id (NSString* value) { - NSMutableArray* transforms = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* transforms = [[NSMutableArray alloc] init]; [transforms addObjectsFromArray:[IJSVGTransform transformsForString:value]]; if(node.transforms != nil) { [transforms addObjectsFromArray:node.transforms]; @@ -762,7 +750,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; withIdentifier:(NSString*)identifier parentNode:(IJSVGNode*)parentNode { - element = [element.copy autorelease]; + element = element.copy; [element detach]; // its important that we remove the ID attribute @@ -770,7 +758,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; NSMutableDictionary* scopedDetachedElements = nil; if((scopedDetachedElements = [_detachedElements objectForKey:parentNode]) == nil) { - scopedDetachedElements = [[[NSMutableDictionary alloc] init] autorelease]; + scopedDetachedElements = [[NSMutableDictionary alloc] init]; [_detachedElements setObject:scopedDetachedElements forKey:parentNode]; } scopedDetachedElements[identifier] = element; @@ -812,10 +800,10 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (NSXMLElement*)mergedElement:(NSXMLElement*)element withReferenceElement:(NSXMLElement*)reference { - NSXMLElement* copy = [[reference copy] autorelease]; - for (NSXMLNode* attribute in element.attributes) { + NSXMLElement* copy = [reference copy]; + for (__strong NSXMLNode* attribute in element.attributes) { [copy removeAttributeForName:attribute.name]; - attribute = [[attribute copy] autorelease]; + attribute = [attribute copy]; [copy addAttribute:attribute]; } return copy; @@ -832,7 +820,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseFilterElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGFilter* node = [[[IJSVGFilter alloc] init] autorelease]; + IJSVGFilter* node = [[IJSVGFilter alloc] init]; node.type = IJSVGNodeTypeFilter; node.name = element.localName; @@ -849,7 +837,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; parentNode:(IJSVGNode*)parentNode { Class effectClass = [IJSVGFilterEffect effectClassForElementName:element.localName]; - IJSVGFilterEffect* node = [[[effectClass alloc] init] autorelease]; + IJSVGFilterEffect* node = [[effectClass alloc] init]; node.type = IJSVGNodeTypeFilterEffect; node.name = element.localName; @@ -870,7 +858,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseLinearGradientElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGLinearGradient* node = [[[IJSVGLinearGradient alloc] init] autorelease]; + IJSVGLinearGradient* node = [[IJSVGLinearGradient alloc] init]; node.units = IJSVGUnitObjectBoundingBox; node.type = IJSVGNodeTypeLinearGradient; node.name = element.localName; @@ -898,7 +886,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseRadialGradientElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGRadialGradient* node = [[[IJSVGRadialGradient alloc] init] autorelease]; + IJSVGRadialGradient* node = [[IJSVGRadialGradient alloc] init]; node.units = IJSVGUnitObjectBoundingBox; node.type = IJSVGNodeTypeRadialGradient; node.name = element.localName; @@ -925,7 +913,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseStopElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGNode* node = [[[IJSVGNode alloc] init] autorelease]; + IJSVGNode* node = [[IJSVGNode alloc] init]; node.type = IJSVGNodeTypeStop; node.name = element.localName; @@ -943,7 +931,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parsePathElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.type = IJSVGNodeTypePath; node.name = element.localName; node.parentNode = parentNode; @@ -970,7 +958,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseLineElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.type = IJSVGNodeTypeLine; node.primitiveType = kIJSVGPrimitivePathTypeLine; node.parentNode = parentNode; @@ -1008,7 +996,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parsePolyLineElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.type = IJSVGNodeTypePolyline; node.primitiveType = kIJSVGPrimitivePathTypePolyLine; node.parentNode = parentNode; @@ -1033,7 +1021,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parsePolygonElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.type = IJSVGNodeTypePolygon; node.primitiveType = kIJSVGPrimitivePathTypePolygon; node.parentNode = parentNode; @@ -1058,7 +1046,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseEllipseElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.name = element.localName; node.primitiveType = kIJSVGPrimitivePathTypeEllipse; node.type = IJSVGNodeTypeEllipse; @@ -1109,7 +1097,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseCircleElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.name = element.localName; node.primitiveType = kIJSVGPrimitivePathTypeCircle; node.type = IJSVGNodeTypeCircle; @@ -1156,7 +1144,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; parentNode:(IJSVGNode*)parentNode nodeType:(IJSVGNodeType)nodeType { - IJSVGGroup* node = [[[IJSVGGroup alloc] init] autorelease]; + IJSVGGroup* node = [[IJSVGGroup alloc] init]; node.type = nodeType; node.name = element.localName; node.parentNode = parentNode; @@ -1203,7 +1191,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseSVGElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGRootNode* node = [[[IJSVGRootNode alloc] init] autorelease]; + IJSVGRootNode* node = [[IJSVGRootNode alloc] init]; [self parseSVGElement:element ontoNode:node parentNode:parentNode]; @@ -1213,7 +1201,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseRectElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPath* node = [[[IJSVGPath alloc] init] autorelease]; + IJSVGPath* node = [[IJSVGPath alloc] init]; node.type = IJSVGNodeTypeRect; node.primitiveType = kIJSVGPrimitivePathTypeRect; node.name = element.localName; @@ -1284,7 +1272,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; { CGRect bounds = CGRectZero; IJSVGUnitType units = [parentNode contentUnitsWithReferencingNodeBounds:&bounds]; - IJSVGImage* node = [[[IJSVGImage alloc] init] autorelease]; + IJSVGImage* node = [[IJSVGImage alloc] init]; node.type = IJSVGNodeTypeImage; node.name = element.localName; node.parentNode = parentNode; @@ -1323,7 +1311,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; parentNode:parentNode]; // its important that we remove the xlink attribute or hell breaks loose - NSXMLElement* elementWithoutXLink = [element.copy autorelease]; + NSXMLElement* elementWithoutXLink = element.copy; [elementWithoutXLink removeAttributeForName:IJSVGAttributeXLink]; NSXMLElement* shadowElement = [self mergedElement:elementWithoutXLink withReferenceElement:detachedElement]; @@ -1335,7 +1323,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parsePatternElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGPattern* node = [[[IJSVGPattern alloc] init] autorelease]; + IJSVGPattern* node = [[IJSVGPattern alloc] init]; node.type = IJSVGNodeTypePattern; node.name = element.localName; node.parentNode = parentNode; @@ -1360,7 +1348,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseClipPathElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGGroup* node = [[[IJSVGGroup alloc] init] autorelease]; + IJSVGGroup* node = [[IJSVGGroup alloc] init]; node.type = IJSVGNodeTypeClipPath; node.name = element.localName; node.parentNode = parentNode; @@ -1380,7 +1368,7 @@ static NSDictionary* _IJSVGAttributeDictionaryTransforms = nil; - (IJSVGNode*)parseMaskElement:(NSXMLElement*)element parentNode:(IJSVGNode*)parentNode { - IJSVGGroup* node = [[[IJSVGGroup alloc] init] autorelease]; + IJSVGGroup* node = [[IJSVGGroup alloc] init]; node.type = IJSVGNodeTypeMask; node.name = element.localName; node.parentNode = parentNode; diff --git a/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGLayerTree.m b/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGLayerTree.m index aee9884..16d43a8 100644 --- a/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGLayerTree.m +++ b/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGLayerTree.m @@ -31,13 +31,6 @@ @synthesize style = _style; -- (void)dealloc -{ - (void)([_viewPortStack release]), _viewPortStack = nil; - (void)([_style release]), _style = nil; - [super dealloc]; -} - - (id)init { if ((self = [super init]) != nil) { @@ -379,7 +372,7 @@ - (NSArray*>*)drawableLayersForNodes:(NSArray*)nodes { NSMutableArray*>* layers = nil; - layers = [[[NSMutableArray alloc] initWithCapacity:nodes.count] autorelease]; + layers = [[NSMutableArray alloc] initWithCapacity:nodes.count]; for(IJSVGNode* node in nodes) { CALayer* layer = [self drawableLayerForNode:node]; if(layer != nil) { @@ -549,16 +542,16 @@ - (IJSVGLayer*)drawableLayerForImageNode:(IJSVGImage*)image { - IJSVGImageLayer* layer = [[[IJSVGImageLayer alloc] initWithImage:image] autorelease]; - // make sure we set the width and height correctly, - // as this may not be exactly the same as the size of the - // given image - CGRect frame = layer.frame; - frame.size.width = image.width.value; - frame.size.height = image.height.value; - layer.frame = frame; - [layer setNeedsLayout]; - return layer; + IJSVGImageLayer* layer = [[IJSVGImageLayer alloc] initWithImage:image]; + // make sure we set the width and height correctly, + // as this may not be exactly the same as the size of the + // given image + CGRect frame = layer.frame; + frame.size.width = image.width.value; + frame.size.height = image.height.value; + layer.frame = frame; + [layer setNeedsLayout]; + return layer; } @end diff --git a/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGRenderingStyle.m b/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGRenderingStyle.m index d4ba601..1011a36 100644 --- a/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGRenderingStyle.m +++ b/Framework/IJSVG/IJSVG/Source/Rendering/IJSVGRenderingStyle.m @@ -10,14 +10,6 @@ @implementation IJSVGRenderingStyle -- (void)dealloc -{ - (void)([_fillColor release]), _fillColor = nil; - (void)([_strokeColor release]), _strokeColor = nil; - (void)([_colorList release]), _colorList = nil; - [super dealloc]; -} - - (id)init { if ((self = [super init]) != nil) { @@ -34,8 +26,7 @@ static NSArray* array = nil; if (array == nil) { array = @[ @"lineCapStyle", @"lineJoinStyle", @"lineWidth", - @"colorList", @"fillColor", @"strokeColor" ] - .retain; + @"colorList", @"fillColor", @"strokeColor" ]; } return array; } diff --git a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyle.m b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyle.m index c898520..38131aa 100644 --- a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyle.m +++ b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyle.m @@ -11,12 +11,6 @@ @implementation IJSVGStyle -- (void)dealloc -{ - (void)([_dict release]), _dict = nil; - [super dealloc]; -} - - (id)init { if ((self = [super init]) != nil) { @@ -44,7 +38,7 @@ + (IJSVGStyle*)parseStyleString:(NSString*)string { - IJSVGStyle* style = [[[self.class alloc] init] autorelease]; + IJSVGStyle* style = [[self.class alloc] init]; NSInteger length = string.length; NSInteger index = 0; NSString* key = nil; @@ -111,10 +105,10 @@ - (IJSVGStyle*)mergedStyle:(IJSVGStyle*)style { // create the new style - IJSVGStyle* newStyle = [[[IJSVGStyle alloc] init] autorelease]; + IJSVGStyle* newStyle = [[IJSVGStyle alloc] init]; // grab the current style - NSMutableDictionary* dict = [[[self properties] mutableCopy] autorelease]; + NSMutableDictionary* dict = [[self properties] mutableCopy]; // overwride the style with the new styles [dict addEntriesFromDictionary:[style properties]]; diff --git a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheet.m b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheet.m index e574625..0d894a2 100644 --- a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheet.m +++ b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheet.m @@ -21,24 +21,10 @@ @implementation IJSVGStyleSheetSelectorListItem -- (void)dealloc -{ - (void)([_rule release]), _rule = nil; - (void)([_selector release]), _selector = nil; - [super dealloc]; -} - @end @implementation IJSVGStyleSheet -- (void)dealloc -{ - (void)([_selectors release]), _selectors = nil; - (void)([_rules release]), _rules = nil; - [super dealloc]; -} - - (id)init { if ((self = [super init]) != nil) { @@ -50,20 +36,20 @@ - (NSArray*)selectorsWithSelectorString:(NSString*)string { - NSMutableArray* array = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* array = [[NSMutableArray alloc] init]; // split the string by the comma, as it could be multiple NSArray* comp = [string componentsSeparatedByString:@","]; NSCharacterSet* whiteSpaceCharSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; // create a selector or reuse one already being used - for (NSString* selectorName in comp) { + for (__strong NSString* selectorName in comp) { selectorName = [selectorName stringByTrimmingCharactersInSet:whiteSpaceCharSet]; IJSVGStyleSheetSelector* selector = nil; // create a new selector if not found if ((selector = [_selectors objectForKey:selectorName]) == nil) { - selector = [[[IJSVGStyleSheetSelector alloc] initWithSelectorString:selectorName] autorelease]; + selector = [[IJSVGStyleSheetSelector alloc] initWithSelectorString:selectorName]; if (selector != nil) { [_selectors setObject:selector forKey:selectorName]; @@ -146,7 +132,7 @@ { // append the rule onto the list within // this style sheet - IJSVGStyleSheetRule* aRule = [[[IJSVGStyleSheetRule alloc] init] autorelease]; + IJSVGStyleSheetRule* aRule = [[IJSVGStyleSheetRule alloc] init]; aRule.style = [IJSVGStyle parseStyleString:rule]; aRule.selectors = selectors; [_rules addObject:aRule]; @@ -154,15 +140,15 @@ - (IJSVGStyle*)styleForNode:(IJSVGNode*)node { - IJSVGStyle* style = [[[IJSVGStyle alloc] init] autorelease]; - NSMutableArray* matchedRules = [[[NSMutableArray alloc] init] autorelease]; + IJSVGStyle* style = [[IJSVGStyle alloc] init]; + NSMutableArray* matchedRules = [[NSMutableArray alloc] init]; for (IJSVGStyleSheetRule* rule in _rules) { IJSVGStyleSheetSelector* matchedSelector = nil; if ([rule matchesNode:node selector:&matchedSelector]) { // make a wrapper for the selector with the rule IJSVGStyleSheetSelectorListItem* listItem = nil; - listItem = [[[IJSVGStyleSheetSelectorListItem alloc] init] autorelease]; + listItem = [[IJSVGStyleSheetSelectorListItem alloc] init]; listItem.rule = rule; listItem.selector = matchedSelector; diff --git a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetRule.m b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetRule.m index e26a6e6..a04c44c 100644 --- a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetRule.m +++ b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetRule.m @@ -10,13 +10,6 @@ @implementation IJSVGStyleSheetRule -- (void)dealloc -{ - (void)([_selectors release]), _selectors = nil; - (void)([_style release]), _style = nil; - [super dealloc]; -} - - (BOOL)matchesNode:(IJSVGNode*)node selector:(IJSVGStyleSheetSelector**)matchedSelector { diff --git a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelector.m b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelector.m index 0f66ad6..d867680 100644 --- a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelector.m +++ b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelector.m @@ -242,13 +242,6 @@ BOOL IJSVGStyleSheetMatchSelector(IJSVGNode * node, IJSVGStyleSheetSelectorRaw * return YES; } -- (void)dealloc -{ - (void)([_rawSelectors release]), _rawSelectors = nil; - (void)([selector release]), selector = nil; - [super dealloc]; -} - - (id)initWithSelectorString:(NSString *)string { if((self = [super init]) != nil) @@ -258,7 +251,6 @@ BOOL IJSVGStyleSheetMatchSelector(IJSVGNode * node, IJSVGStyleSheetSelectorRaw * // failed to compile if([self _compile] == NO) { - (void)([self release]), self = nil; return nil; } [self _calculate]; @@ -325,8 +317,8 @@ BOOL IJSVGStyleSheetMatchSelector(IJSVGNode * node, IJSVGStyleSheetSelectorRaw * NSUInteger length = selector.length; - NSMutableArray * sels = [[[NSMutableArray alloc] init] autorelease]; - IJSVGStyleSheetSelectorRaw * rawSelector = [[[IJSVGStyleSheetSelectorRaw alloc] init] autorelease]; + NSMutableArray * sels = [[NSMutableArray alloc] init]; + IJSVGStyleSheetSelectorRaw * rawSelector = [[IJSVGStyleSheetSelectorRaw alloc] init]; for(NSUInteger i = 0; i < length; i++) { unichar c = [selector characterAtIndex:i]; @@ -384,7 +376,7 @@ BOOL IJSVGStyleSheetMatchSelector(IJSVGNode * node, IJSVGStyleSheetSelectorRaw * // reset the raw selector if(!(i == length-1)) { - rawSelector = [[[IJSVGStyleSheetSelectorRaw alloc] init] autorelease]; + rawSelector = [[IJSVGStyleSheetSelectorRaw alloc] init]; } } diff --git a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.h b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.h index 4f07755..8ae9fa6 100644 --- a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.h +++ b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.h @@ -26,7 +26,7 @@ typedef NS_ENUM(NSUInteger, IJSVGStyleSheetSelectorCombinator) { @property (nonatomic, copy) NSString* tag; @property (nonatomic, copy) NSString* identifier; @property (nonatomic, copy) NSString* combinatorString; -@property (nonatomic, retain) NSArray* classes; +@property (nonatomic, strong) NSArray* classes; @property (nonatomic, assign) IJSVGStyleSheetSelectorCombinator combinator; - (void)addClassName:(NSString*)className; diff --git a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.m b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.m index fe21169..d5efc39 100644 --- a/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.m +++ b/Framework/IJSVG/IJSVG/Source/Stylesheets/IJSVGStyleSheetSelectorRaw.m @@ -14,11 +14,10 @@ - (void)dealloc { - (void)([classes release]), classes = nil; - (void)([_identifier release]), _identifier = nil; - (void)([_tag release]), _tag = nil; - (void)([_combinatorString release]), _combinatorString = nil; - [super dealloc]; + (void)(classes), classes = nil; + (void)(_identifier), _identifier = nil; + (void)(_tag), _tag = nil; + (void)(_combinatorString), _combinatorString = nil; } - (id)init diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGThreadManager.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGThreadManager.m index 761fb9a..62f6460 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGThreadManager.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGThreadManager.m @@ -32,7 +32,7 @@ static NSMapTable* managerMap; NSMapTable* map = [self mapTable]; @synchronized (map) { if((manager = [map objectForKey:thread]) == nil) { - manager = [[[self alloc] initWithThread:thread] autorelease]; + manager = [[self alloc] initWithThread:thread]; [map setObject:manager forKey:thread]; } } @@ -46,20 +46,16 @@ static NSMapTable* managerMap; - (void)dealloc { - (void)[_userInfo release], _userInfo = nil; - (void)[_thread release], _thread = nil; - (void)[_CIContext release], _CIContext = nil; if(_pathDataStream != NULL) { (void)IJSVGPathDataStreamRelease(_pathDataStream), _pathDataStream = NULL; } - [super dealloc]; } - (id)initWithThread:(NSThread*)thread { if((self = [super init]) != nil) { // store the thread - _thread = thread.retain; + _thread = thread; // listen for teardown of the thread NSNotificationCenter* center = NSNotificationCenter.defaultCenter; @@ -103,7 +99,7 @@ static NSMapTable* managerMap; // management _CIContext = [CIContext contextWithOptions:@{ kCIImageColorSpace: NSNull.null - }].retain; + }]; } return _CIContext; } diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGTransform.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGTransform.m index b5b3b4f..d59561c 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGTransform.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGTransform.m @@ -15,7 +15,6 @@ - (void)dealloc { (void)free(_parameters); - [super dealloc]; } - (id)copyWithZone:(NSZone*)zone @@ -63,7 +62,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) + (IJSVGTransform*)transformByTranslatingX:(CGFloat)x y:(CGFloat)y { - IJSVGTransform* transform = [[[self alloc] init] autorelease]; + IJSVGTransform* transform = [[self alloc] init]; transform.command = IJSVGTransformCommandTranslate; transform.parameterCount = 2; CGFloat* params = (CGFloat*)malloc(sizeof(CGFloat) * 2); @@ -76,7 +75,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) + (IJSVGTransform*)transformByScaleX:(CGFloat)x y:(CGFloat)y { - IJSVGTransform* transform = [[[self alloc] init] autorelease]; + IJSVGTransform* transform = [[self alloc] init]; transform.command = IJSVGTransformCommandScale; transform.parameterCount = 2; CGFloat* params = (CGFloat*)malloc(sizeof(CGFloat) * 2); @@ -176,7 +175,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) + (NSArray*)transformsForString:(NSString*)string { NSMutableArray* transforms = nil; - transforms = [[[NSMutableArray alloc] init] autorelease]; + transforms = [[NSMutableArray alloc] init]; const char* charString = string.UTF8String; IJSVGParsingStringMethod** methods = NULL; @@ -193,7 +192,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) // create a new transform object and parse the parameters NSInteger count = 0; - IJSVGTransform* transform = [[[self.class alloc] init] autorelease]; + IJSVGTransform* transform = [[self.class alloc] init]; transform.command = commandType; transform.sort = [self.class sortForTransformCommand:commandType]; transform.parameters = [IJSVGUtils scanFloatsFromCString:method->parameters @@ -442,11 +441,11 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) { NSArray* trans = [self affineTransformToSVGTransformComponents:transform]; trans = [self filterUselessAffineTransformComponents:trans]; - NSMutableArray* strings = [[[NSMutableArray alloc] initWithCapacity:trans.count] autorelease]; + NSMutableArray* strings = [[NSMutableArray alloc] initWithCapacity:trans.count]; for (NSDictionary* dict in trans) { NSArray* data = dict[@"data"]; NSString* method = dict[@"name"]; - NSMutableArray* dataStrings = [[[NSMutableArray alloc] initWithCapacity:data.count] autorelease]; + NSMutableArray* dataStrings = [[NSMutableArray alloc] initWithCapacity:data.count]; for (NSNumber* number in data) { [dataStrings addObject:IJSVGShortFloatStringWithOptions(number.floatValue, floatingPointOptions)]; @@ -464,11 +463,11 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) { NSArray* trans = [self affineTransformToSVGTransformComponents:transform]; trans = [self filterUselessAffineTransformComponents:trans]; - NSMutableArray* strings = [[[NSMutableArray alloc] initWithCapacity:trans.count] autorelease]; + NSMutableArray* strings = [[NSMutableArray alloc] initWithCapacity:trans.count]; for (NSDictionary* dict in trans) { NSArray* data = dict[@"data"]; NSString* method = dict[@"name"]; - NSMutableArray* dataStrings = [[[NSMutableArray alloc] initWithCapacity:data.count] autorelease]; + NSMutableArray* dataStrings = [[NSMutableArray alloc] initWithCapacity:data.count]; for (NSNumber* number in data) { [dataStrings addObject:IJSVGShortFloatString(number.floatValue)]; } @@ -510,7 +509,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) + (NSArray*)filterUselessAffineTransformComponents:(NSArray*)components { - NSMutableArray* comps = [[[NSMutableArray alloc] initWithCapacity:components.count] autorelease]; + NSMutableArray* comps = [[NSMutableArray alloc] initWithCapacity:components.count]; NSArray* names = @[ @"translate", @"rotate", @"skewX", @"skewY" ]; for (NSDictionary* transform in components) { NSString* name = transform[@"name"]; @@ -547,7 +546,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) CGFloat rowSum = data[0] * data[1] + data[2] * data[3]; BOOL scaleBefore = rowSum != 0.f || sx == sy; - NSMutableArray* transforms = [[[NSMutableArray alloc] init] autorelease]; + NSMutableArray* transforms = [[NSMutableArray alloc] init]; // tx, ty -> translate if (data[4] != 0.f || data[5] != 0.f) { @@ -585,7 +584,7 @@ BOOL IJSVGAffineTransformScalesAndTranslates(CGAffineTransform transform) } CGFloat angle = MIN(MAX(-1.f, data[0] / sx), 1.f); - NSMutableArray* rotate = [[[NSMutableArray alloc] initWithCapacity:3] autorelease]; + NSMutableArray* rotate = [[NSMutableArray alloc] initWithCapacity:3]; [rotate addObject:@(IJSVGMathToFixed(IJSVGMathAcos(angle), precision) * ((scaleBefore ? 1.f : sy) * data[1] < 0.f ? -1.f : 1.f))]; if (rotate[0].floatValue != 0.f) { diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitLength.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitLength.m index e5b381e..9e9713d 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitLength.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitLength.m @@ -20,7 +20,7 @@ + (IJSVGUnitLength*)unitWithFloat:(CGFloat)number { - IJSVGUnitLength* unit = [[[self alloc] init] autorelease]; + IJSVGUnitLength* unit = [[self alloc] init]; unit.value = number; unit.type = IJSVGUnitLengthTypeNumber; return unit; @@ -38,7 +38,7 @@ + (IJSVGUnitLength*)unitWithFloat:(CGFloat)number type:(IJSVGUnitLengthType)type { - IJSVGUnitLength* unit = [[[self alloc] init] autorelease]; + IJSVGUnitLength* unit = [[self alloc] init]; unit.value = number; unit.type = type; return unit; @@ -171,7 +171,7 @@ return nil; } - IJSVGUnitLength* unit = [[[self alloc] init] autorelease]; + IJSVGUnitLength* unit = [[self alloc] init]; unit.value = floats[0]; unit.type = IJSVGUnitLengthTypeNumber; diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitPoint.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitPoint.m index fb73a84..e874d47 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitPoint.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitPoint.m @@ -10,17 +10,10 @@ @implementation IJSVGUnitPoint -- (void)dealloc -{ - (void)[_x release], _x = nil; - (void)[_y release], _y = nil; - [super dealloc]; -} - + (IJSVGUnitPoint*)pointWithX:(IJSVGUnitLength*)x y:(IJSVGUnitLength*)y { - IJSVGUnitPoint* point = [[[self alloc] init] autorelease]; + IJSVGUnitPoint* point = [[self alloc] init]; point.x = x; point.y = y; return point; @@ -29,8 +22,8 @@ - (id)copyWithZone:(NSZone*)zone { IJSVGUnitPoint* point = [[self.class alloc] init]; - point.x = [_x.copy autorelease]; - point.y = [_y.copy autorelease]; + point.x = _x.copy; + point.y = _y.copy; return point; } diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitRect.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitRect.m index 581e512..9fe4ee2 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitRect.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitRect.m @@ -10,17 +10,10 @@ @implementation IJSVGUnitRect -- (void)dealloc -{ - (void)[_size release], _size = nil; - (void)[_origin release], _origin = nil; - [super dealloc]; -} - + (IJSVGUnitRect*)rectWithOrigin:(IJSVGUnitPoint*)origin size:(IJSVGUnitSize*)size { - IJSVGUnitRect* rect = [[[self alloc] init] autorelease]; + IJSVGUnitRect* rect = [[self alloc] init]; rect.origin = origin; rect.size = size; return rect; @@ -50,8 +43,8 @@ - (id)copyWithZone:(NSZone *)zone { IJSVGUnitRect* rect = [[self.class alloc] init]; - rect.size = [_size.copy autorelease]; - rect.origin = [_origin.copy autorelease]; + rect.size = _size.copy; + rect.origin = _origin.copy; return rect; } diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitSize.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitSize.m index b1f0b14..2e441fe 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitSize.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUnitSize.m @@ -10,17 +10,10 @@ @implementation IJSVGUnitSize -- (void)dealloc -{ - (void)[_width release], _width = nil; - (void)[_height release], _height = nil; - [super dealloc]; -} - + (IJSVGUnitSize*)sizeWithWidth:(IJSVGUnitLength*)width height:(IJSVGUnitLength*)height { - IJSVGUnitSize* size = [[[self alloc] init] autorelease]; + IJSVGUnitSize* size = [[self alloc] init]; size.width = width; size.height = height; return size; @@ -29,8 +22,8 @@ - (id)copyWithZone:(NSZone*)zone { IJSVGUnitSize* size = [[self.class alloc] init]; - size.width = [_width.copy autorelease]; - size.height = [_height.copy autorelease]; + size.width = _width.copy; + size.height = _height.copy; return size; } diff --git a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUtils.m b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUtils.m index 33e2826..9e641d7 100644 --- a/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUtils.m +++ b/Framework/IJSVG/IJSVG/Source/Utils/IJSVGUtils.m @@ -130,7 +130,7 @@ NSString* IJSVGCompressFloatParameterArray(NSArray* strings) { char* lastCommandChars = NULL; NSInteger index = 0; - NSMutableString* string = [[[NSMutableString alloc] init] autorelease]; + NSMutableString* string = [[NSMutableString alloc] init]; for (NSString* dataString in strings) { const char* chars = dataString.UTF8String; @@ -547,7 +547,7 @@ CGFloat degrees_to_radians(CGFloat degrees) + (void)logParameters:(CGFloat*)param count:(NSInteger)count { - NSMutableString* str = [[[NSMutableString alloc] init] autorelease]; + NSMutableString* str = [[NSMutableString alloc] init]; for (NSInteger i = 0; i < count; i++) { [str appendFormat:@"%f ", param[i]]; } diff --git a/IJSVGExample/IJSVGExample.xcodeproj/project.pbxproj b/IJSVGExample/IJSVGExample.xcodeproj/project.pbxproj index 5b68a34..a628c89 100644 --- a/IJSVGExample/IJSVGExample.xcodeproj/project.pbxproj +++ b/IJSVGExample/IJSVGExample.xcodeproj/project.pbxproj @@ -23,7 +23,7 @@ 5956658019B62F4600D805FF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956657F19B62F4600D805FF /* AppDelegate.m */; }; 5956658219B62F4600D805FF /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5956658119B62F4600D805FF /* Images.xcassets */; }; 5956658519B62F4600D805FF /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5956658319B62F4600D805FF /* MainMenu.xib */; }; - 5956659119B62F4700D805FF /* IJSVGExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956659019B62F4700D805FF /* IJSVGExampleTests.m */; }; + 5956659119B62F4700D805FF /* IJSVGExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5956659019B62F4700D805FF /* IJSVGExampleTests.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; }; 595665DE19B6309C00D805FF /* test.svg in Resources */ = {isa = PBXBuildFile; fileRef = 595665DD19B6309C00D805FF /* test.svg */; }; 595665E119B630B600D805FF /* SVGView.m in Sources */ = {isa = PBXBuildFile; fileRef = 595665E019B630B600D805FF /* SVGView.m */; }; 597AC83322CFD0FC007C0E42 /* home.svg in Resources */ = {isa = PBXBuildFile; fileRef = 597AC83222CFD0FC007C0E42 /* home.svg */; }; @@ -450,7 +450,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = NO; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -492,7 +492,7 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = NO; + CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; @@ -525,6 +525,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_ENTITLEMENTS = IJSVGExample/IJSVGExample.entitlements; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = IJSVGExample/Info.plist; @@ -537,6 +538,7 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_ENTITLEMENTS = IJSVGExample/IJSVGExample.entitlements; COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = IJSVGExample/Info.plist; @@ -549,6 +551,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", @@ -569,6 +572,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", 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 ee0ac5d..d910248 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/IJSVGExample/IJSVGExample.xcodeproj/xcuserdata/curtishard.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/IJSVGExample/IJSVGExample.xcodeproj/xcuserdata/curtishard.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index c8984e0..f75caf2 100644 --- a/IJSVGExample/IJSVGExample.xcodeproj/xcuserdata/curtishard.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/IJSVGExample/IJSVGExample.xcodeproj/xcuserdata/curtishard.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -14,8 +14,8 @@ filePath = "../Framework/IJSVG/IJSVG/Source/Layers/IJSVGGradientLayer.m" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "102" - endingLineNumber = "102" + startingLineNumber = "93" + endingLineNumber = "93" landmarkName = "-drawInContext:" landmarkType = "7"> diff --git a/IJSVGExample/IJSVGExample/SVGExampleView1.m b/IJSVGExample/IJSVGExample/SVGExampleView1.m index 6787b84..89637bc 100644 --- a/IJSVGExample/IJSVGExample/SVGExampleView1.m +++ b/IJSVGExample/IJSVGExample/SVGExampleView1.m @@ -12,7 +12,7 @@ - (IJSVG *)svg { - return [[IJSVG svgNamed:@"heart"] retain]; + return [IJSVG svgNamed:@"heart"]; } @end diff --git a/IJSVGExample/IJSVGExample/SVGExampleView2.m b/IJSVGExample/IJSVGExample/SVGExampleView2.m index 07d2eda..46e83b9 100644 --- a/IJSVGExample/IJSVGExample/SVGExampleView2.m +++ b/IJSVGExample/IJSVGExample/SVGExampleView2.m @@ -12,7 +12,7 @@ - (IJSVG *)svg { - return [[IJSVG svgNamed:@"linecap"] retain]; + return [IJSVG svgNamed:@"linecap"]; } @end diff --git a/IJSVGExample/IJSVGExample/SVGExampleView3.m b/IJSVGExample/IJSVGExample/SVGExampleView3.m index e98178d..6a1cb55 100644 --- a/IJSVGExample/IJSVGExample/SVGExampleView3.m +++ b/IJSVGExample/IJSVGExample/SVGExampleView3.m @@ -12,7 +12,7 @@ - (IJSVG *)svg { - return [[IJSVG svgNamed:@"products"] retain]; + return [IJSVG svgNamed:@"products"]; } @end diff --git a/IJSVGExample/IJSVGExample/SVGExampleView4.m b/IJSVGExample/IJSVGExample/SVGExampleView4.m index bf971cd..da10bd7 100644 --- a/IJSVGExample/IJSVGExample/SVGExampleView4.m +++ b/IJSVGExample/IJSVGExample/SVGExampleView4.m @@ -12,7 +12,7 @@ - (IJSVG *)svg { - return [[IJSVG svgNamed:@"clipped"] retain]; + return [IJSVG svgNamed:@"clipped"]; } @end diff --git a/IJSVGExample/IJSVGExample/SVGExampleView5.m b/IJSVGExample/IJSVGExample/SVGExampleView5.m index 6c2e130..be20e79 100644 --- a/IJSVGExample/IJSVGExample/SVGExampleView5.m +++ b/IJSVGExample/IJSVGExample/SVGExampleView5.m @@ -12,7 +12,7 @@ - (IJSVG *)svg { - return [[IJSVG svgNamed:@"dashed"] retain]; + return [IJSVG svgNamed:@"dashed"]; } @end diff --git a/IJSVGExample/IJSVGExample/SVGExampleView6.m b/IJSVGExample/IJSVGExample/SVGExampleView6.m index d257467..bf419bc 100644 --- a/IJSVGExample/IJSVGExample/SVGExampleView6.m +++ b/IJSVGExample/IJSVGExample/SVGExampleView6.m @@ -12,7 +12,7 @@ - (IJSVG *)svg { - return [[IJSVG svgNamed:@"css"] retain]; + return [IJSVG svgNamed:@"css"]; } @end diff --git a/IJSVGExample/IJSVGExample/SVGView.m b/IJSVGExample/IJSVGExample/SVGView.m index b55f1cb..6f72ed0 100644 --- a/IJSVGExample/IJSVGExample/SVGView.m +++ b/IJSVGExample/IJSVGExample/SVGView.m @@ -10,19 +10,15 @@ @implementation SVGView -- (void)dealloc -{ - [svg release], svg = nil; - [super dealloc]; -} - - (id)initWithFrame:(NSRect)frameRect { if( ( self = [super initWithFrame:frameRect] ) != nil ) { - svg = [self svg].retain; + svg = [self svg]; svg.renderQuality = kIJSVGRenderQualityFullResolution; + + __weak SVGView* weakSelf = self; svg.renderingBackingScaleHelper = ^{ - return self.window.backingScaleFactor; + return weakSelf.window.backingScaleFactor; }; } return self;