Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions Tile Cutter.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Tile Cutter" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
Expand Down Expand Up @@ -421,72 +423,63 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = "Don't Code Sign";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Tile_Cutter_Prefix.pch;
INFOPLIST_FILE = "Tile_Cutter-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "Tile Cutter";
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CODE_SIGN_IDENTITY = "Don't Code Sign";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Tile_Cutter_Prefix.pch;
INFOPLIST_FILE = "Tile_Cutter-Info.plist";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "Tile Cutter";
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_IDENTITY = "Don't Code Sign";
CODE_SIGN_IDENTITY = "";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = unsupported;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "Tile_Cutter-Info.plist";
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"-Xclang",
"-fobjc-nonfragile-abi2",
);
PREBINDING = NO;
SDKROOT = macosx10.6;
PRODUCT_NAME = "Tile Cutter";
SDKROOT = macosx;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_IDENTITY = "Don't Code Sign";
CODE_SIGN_IDENTITY = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_GC = unsupported;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OTHER_CFLAGS = (
"-Xclang",
"-fobjc-nonfragile-abi2",
);
INFOPLIST_FILE = "Tile_Cutter-Info.plist";
PREBINDING = NO;
SDKROOT = macosx10.6;
PRODUCT_NAME = "Tile Cutter";
SDKROOT = macosx;
VALID_ARCHS = "i386 x86_64";
};
name = Release;
Expand Down
22 changes: 11 additions & 11 deletions TileCutterCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ - (void) startSavingTiles

NSImage *image = [[[NSImage alloc] initWithContentsOfFile: self.inputFilename] autorelease];

progressCol = 0;
progressRow = 0;
_progressCol = 0;
_progressRow = 0;

tileRowCount = [image rowsWithTileHeight: self.tileHeight];
tileColCount = [image columnsWithTileWidth: self.tileWidth];
_tileRowCount = [image rowsWithTileHeight: self.tileHeight];
_tileColCount = [image columnsWithTileWidth: self.tileWidth];

NSSize outputImageSizeForPlist = [image size];
outputImageSizeForPlist.width /= self.contentScaleFactor;
Expand All @@ -67,13 +67,13 @@ - (void) startSavingTiles
[self.inputFilename lastPathComponent], @"Filename",
NSStringFromSize(outputImageSizeForPlist), @"Size", nil];

self.allTilesInfo = [NSMutableArray arrayWithCapacity: tileRowCount * tileColCount];
self.allTilesInfo = [NSMutableArray arrayWithCapacity: _tileRowCount * _tileColCount];

// One ImageRep for all TileOperation
NSBitmapImageRep *imageRep =
[[[NSBitmapImageRep alloc] initWithCGImage:[image CGImageForProposedRect:NULL context:NULL hints:nil]] autorelease];

for (int row = 0; row < tileRowCount; row++)
for (int row = 0; row < _tileRowCount; row++)
{
TileOperation *op = [[TileOperation alloc] init];
op.row = row;
Expand All @@ -96,11 +96,11 @@ - (void) startSavingTiles

- (void)operationDidFinishTile:(TileOperation *)op
{
progressCol++;
if (progressCol >= tileColCount)
_progressCol++;
if (_progressCol >= _tileColCount)
{
progressCol = 0;
progressRow++;
_progressCol = 0;
_progressRow++;
}

if ([self.operationsDelegate respondsToSelector: _cmd])
Expand Down Expand Up @@ -164,7 +164,7 @@ - (void)operationDidFinishSuccessfully:(TileOperation *)op
op.tilesInfo = nil;

// All Tiles Finished?
if (progressRow >= tileRowCount)
if (_progressRow >= _tileRowCount)
{
[self saveImageInfoDictionary];
}
Expand Down
6 changes: 4 additions & 2 deletions TileOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ - (void)main

if ([self isCancelled])
goto finish;

NSString *outPath = [NSString stringWithFormat:@"%@_%d_%d%@.%@", baseFilename, row, column, self.outputSuffix, extension];
//modify by jk 原配置
// NSString *outPath = [NSString stringWithFormat:@"%@_%d_%d%@.%@", baseFilename, row, column, self.outputSuffix, extension];
//新配置 tile%d
NSString *outPath = [NSString stringWithFormat:@"%@%d.%@", baseFilename, (int)row *32+ column, extension];
[bitmapData writeToFile:outPath atomically:YES];

// Add created Tile Info to tilesInfo array
Expand Down