From 627256158c473226463e3a145b6f0fff952abe58 Mon Sep 17 00:00:00 2001 From: Nate Weaver Date: Sun, 8 Jul 2012 00:31:21 -0500 Subject: [PATCH] Fix ICON plugin masks (whoops). Release pattern resources. --- .../Icon Editor/ICONWindowController.m | 16 ++++-- .../Pattern Editor/PatternWindowController.m | 5 ++ .../PatternWindowController.xib | 51 ++++++++++--------- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/Cocoa/Plug-Ins/Icon Editor/ICONWindowController.m b/Cocoa/Plug-Ins/Icon Editor/ICONWindowController.m index f231ae1..13d3e3e 100644 --- a/Cocoa/Plug-Ins/Icon Editor/ICONWindowController.m +++ b/Cocoa/Plug-Ins/Icon Editor/ICONWindowController.m @@ -83,13 +83,12 @@ resData = [[resource data] retain]; planes[0] = (unsigned char*) [resData bytes]; - - for (NSUInteger i = 0; i < [resData length]; ++i) - planes[0][i] ^= 0xff; - + NSUInteger plane0length = 0; + if( [resType isEqualToString: @"ICN#"] ) { planes[1] = planes[0] + (4 * 32); // 32 lines a 4 bytes. + plane0length = 4 * 32; bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:32 pixelsHigh:32 bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace bytesPerRow:4 bitsPerPixel:1] autorelease]; @@ -97,6 +96,7 @@ else if( [resType isEqualToString: @"ics#"] || [resType isEqualToString: @"CURS"] ) { planes[1] = planes[0] + (2 * 16); // 16 lines a 2 bytes. + plane0length = 2 * 16; bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:16 pixelsHigh:16 bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace bytesPerRow:2 bitsPerPixel:1] autorelease]; @@ -104,6 +104,7 @@ else if( [resType isEqualToString: @"icm#"] ) { planes[1] = planes[0] + (2 * 12); // 12 lines a 2 bytes. + plane0length = 2 * 12; bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:16 pixelsHigh:12 bitsPerSample:1 samplesPerPixel:2 hasAlpha:YES isPlanar:YES colorSpaceName:NSCalibratedWhiteColorSpace bytesPerRow:2 bitsPerPixel:1] autorelease]; @@ -111,7 +112,12 @@ else bir = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:planes pixelsWide:32 pixelsHigh:32 bitsPerSample:1 samplesPerPixel:1 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedWhiteColorSpace - bytesPerRow:4 bitsPerPixel:1] autorelease]; + bytesPerRow:4 bitsPerPixel:1] autorelease]; + + if (plane0length > 0) { + for (NSUInteger i = 0; i < plane0length; ++i) + planes[0][i] ^= 0xff; + } [resImage addRepresentation:bir]; [imageView setImage: resImage]; diff --git a/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.m b/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.m index 32d4611..a05370e 100644 --- a/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.m +++ b/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.m @@ -63,6 +63,11 @@ return self; } +- (void)dealloc { + [resource release]; + [super dealloc]; +} + - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName { return [resource defaultWindowTitle]; diff --git a/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.xib b/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.xib index bac8c59..5958098 100644 --- a/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.xib +++ b/Cocoa/Plug-Ins/Pattern Editor/PatternWindowController.xib @@ -44,11 +44,12 @@ NSWindow + {100, 100} 256 - + 268 @@ -64,7 +65,7 @@ _NS:9 YES - + 130560 33554432 _NS:9 @@ -79,8 +80,10 @@ {478, 309} + {{0, 0}, {1920, 1178}} + {100, 122} {10000000000000, 10000000000000} YES @@ -99,7 +102,7 @@ imageView - + 17 @@ -150,12 +153,12 @@ 2 - - + + 6 0 - + 6 1 @@ -167,11 +170,11 @@ 3 - + 4 0 - + 4 1 @@ -183,8 +186,8 @@ 3 - - + + 5 0 @@ -199,8 +202,8 @@ 3 - - + + 3 0 @@ -220,35 +223,35 @@ 7 - + - + 8 - - + + 13 - + 14 - + 15 - + 16 - + @@ -265,10 +268,10 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - - - + + + + com.apple.InterfaceBuilder.CocoaPlugin