remove tabs

This commit is contained in:
Sean Barrett 2014-07-07 07:46:39 -07:00
parent 1dcaa6059e
commit e454b82a78

View File

@ -18,26 +18,26 @@ int main(int argc, char **argv)
fprintf(stderr, "Usage: herringbone_map {inputfile} {output-width} {output-height} {outputfile}\n"); fprintf(stderr, "Usage: herringbone_map {inputfile} {output-width} {output-height} {outputfile}\n");
return 1; return 1;
} else { } else {
char *filename = argv[1]; char *filename = argv[1];
int out_w = atoi(argv[2]); int out_w = atoi(argv[2]);
int out_h = atoi(argv[3]); int out_h = atoi(argv[3]);
char *outfile = argv[4]; char *outfile = argv[4];
unsigned char *pixels, *out_pixels; unsigned char *pixels, *out_pixels;
stbhw_tileset ts; stbhw_tileset ts;
int w,h; int w,h;
pixels = stbi_load(filename, &w, &h, 0, 3); pixels = stbi_load(filename, &w, &h, 0, 3);
if (pixels == 0) { if (pixels == 0) {
fprintf(stderr, "Could open input file '%s'\n", filename); fprintf(stderr, "Could open input file '%s'\n", filename);
} }
if (!stbhw_build_tileset_from_image(&ts, pixels, w*3, w, h)) { if (!stbhw_build_tileset_from_image(&ts, pixels, w*3, w, h)) {
fprintf(stderr, "Error: %s\n", stbhw_get_last_error()); fprintf(stderr, "Error: %s\n", stbhw_get_last_error());
return 1; return 1;
} }
free(pixels); free(pixels);
#ifdef DEBUG_OUTPUT #ifdef DEBUG_OUTPUT
{ {
@ -66,17 +66,17 @@ int main(int argc, char **argv)
} }
#endif #endif
out_pixels = malloc(out_w * out_h * 3); out_pixels = malloc(out_w * out_h * 3);
if (!stbhw_generate_image(&ts, NULL, out_pixels, out_w*3, out_w, out_h)) { if (!stbhw_generate_image(&ts, NULL, out_pixels, out_w*3, out_w, out_h)) {
fprintf(stderr, "Error: %s\n", stbhw_get_last_error()); fprintf(stderr, "Error: %s\n", stbhw_get_last_error());
return 1; return 1;
} }
stbi_write_png(argv[4], out_w, out_h, 3, out_pixels, out_w*3); stbi_write_png(argv[4], out_w, out_h, 3, out_pixels, out_w*3);
free(out_pixels); free(out_pixels);
stbhw_free_tileset(&ts); stbhw_free_tileset(&ts);
return 0; return 0;
} }
} }