diff options
author | Yaniv Kamay <ykamay@redhat.com> | 2009-12-28 00:07:23 +0200 |
---|---|---|
committer | Yaniv Kamay <ykamay@redhat.com> | 2009-12-28 12:34:45 +0200 |
commit | ff2e0dbdb7fd2cc93588f83bfc531c4834ef5cff (patch) | |
tree | 9f02e3912a1052600f532035ab6976baffa0d168 /tools | |
parent | 321d375b5e5078bd297215963f923f54306d736e (diff) | |
download | spice-ff2e0dbdb7fd2cc93588f83bfc531c4834ef5cff.tar.gz spice-ff2e0dbdb7fd2cc93588f83bfc531c4834ef5cff.tar.xz spice-ff2e0dbdb7fd2cc93588f83bfc531c4834ef5cff.zip |
use spaces instead of tabs in bitmap_to_c and icon_to_c output
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bitmap_to_c.c | 20 | ||||
-rw-r--r-- | tools/icon_to_c.c | 18 |
2 files changed, 21 insertions, 17 deletions
diff --git a/tools/bitmap_to_c.c b/tools/bitmap_to_c.c index 3329d5ed..e9cd4db2 100644 --- a/tools/bitmap_to_c.c +++ b/tools/bitmap_to_c.c @@ -30,6 +30,8 @@ #define TRUE 1 #define FALSE 0 +#define TAB " " + #define ERROR(str) printf("%s: error: %s\n", prog_name, str); exit(-1); static char *prog_name = NULL; @@ -185,8 +187,8 @@ static void do_dump_with_alpha_conversion(const Pixmap *pixmap, FILE *f) for (i = 0; i < pixmap->height; i++) { uint8_t *now = line; for (j = 0; j < pixmap->width; j++, now += 4) { - if ((line_size++ % 6) == 0) { - fprintf(f, "\n\t\t"); + if ((line_size++ % 4) == 0) { + fprintf(f, "\n" TAB); } double alpha = (double)now[3] / 0xff; put_char(f, alpha * now[0]); @@ -207,8 +209,8 @@ static void do_dump_32bpp(const Pixmap *pixmap, FILE *f) for (i = 0; i < pixmap->height; i++) { uint8_t *now = line; for (j = 0; j < pixmap->width; j++, now += 4) { - if ((line_size++ % 6) == 0) { - fprintf(f, "\n\t\t"); + if ((line_size++ % 4) == 0) { + fprintf(f, "\n" TAB); } put_char(f, now[0]); put_char(f, now[1]); @@ -228,8 +230,8 @@ static void do_dump_24bpp(const Pixmap *pixmap, FILE *f) for (i = 0; i < pixmap->height; i++) { uint8_t *now = line; for (j = 0; j < pixmap->width; j++, now += 3) { - if ((line_size++ % 6) == 0) { - fprintf(f, "\n\t\t"); + if ((line_size++ % 4) == 0) { + fprintf(f, "\n" TAB); } put_char(f, now[0]); put_char(f, now[1]); @@ -259,9 +261,9 @@ static int pixmap_to_c_struct(const Pixmap *pixmap, const char *dest_file, const uint32_t data_size = pixmap->width * sizeof(uint32_t) * pixmap->height; fprintf(f, "static const struct {\n" - "\tuint32_t width;\n" - "\tuint32_t height;\n" - "\tuint8_t pixel_data[%u];\n" + TAB "uint32_t width;\n" + TAB "uint32_t height;\n" + TAB "uint8_t pixel_data[%u];\n" "} %s = { %u, %u, {", data_size, image_name, pixmap->width, pixmap->height); diff --git a/tools/icon_to_c.c b/tools/icon_to_c.c index 79ae5fac..0d37ca9f 100644 --- a/tools/icon_to_c.c +++ b/tools/icon_to_c.c @@ -29,6 +29,8 @@ #define TRUE 1 #define FALSE 0 +#define TAB " " + #define ERROR(str) printf("%s: error: %s\n", prog_name, str); exit(-1); static char *prog_name = NULL; @@ -213,10 +215,10 @@ static int icon_to_c_struct(const Icon *icon, const char *dest_file, const char uint32_t mask_stride = ALIGN(icon->width, 8) / 8; uint32_t mask_size = mask_stride * icon->height; fprintf(f, "static const struct {\n" - "\tuint32_t width;\n" - "\tuint32_t height;\n" - "\tuint8_t pixmap[%u];\n" - "\tuint8_t mask[%u];\n" + TAB "uint32_t width;\n" + TAB "uint32_t height;\n" + TAB "uint8_t pixmap[%u];\n" + TAB "uint8_t mask[%u];\n" "} %s = { %u, %u, {", pixmap_size, mask_size, image_name, icon->width, icon->height); @@ -226,8 +228,8 @@ static int icon_to_c_struct(const Icon *icon, const char *dest_file, const char for (i = 0; i < icon->height; i++) { uint8_t *now = line; for (j = 0; j < icon->width; j++, now += 4) { - if ((line_size++ % 6) == 0) { - fprintf(f, "\n\t\t"); + if ((line_size++ % 4) == 0) { + fprintf(f, "\n" TAB); } put_char(f, now[0]); put_char(f, now[1]); @@ -239,14 +241,14 @@ static int icon_to_c_struct(const Icon *icon, const char *dest_file, const char fseek(f, -1, SEEK_CUR); - fprintf(f, "},\n\n\t\t{"); + fprintf(f, "},\n\n" TAB TAB "{"); line = (uint8_t *)(icon->mask + ((icon->height - 1) * mask_stride)); line_size = 0; for (i = 0; i < icon->height; i++) { for (j = 0; j < mask_stride; j++) { if (line_size && (line_size % 12) == 0) { - fprintf(f, "\n\t\t "); + fprintf(f, "\n" TAB); } line_size++; put_char(f, line[j]); |