X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=ttf2png.c;h=9714ecd24a32ee95b99f009a6ea29d7d2cb9d38a;hb=daf02e48d96691e2a5757d4fdc8f37aa46a19ab4;hp=7ef19e14860d9590e8e748dfccde291c0779c1f1;hpb=dce059b659be249e34967837adfdd6c614e011b3;p=ttf2png.git diff --git a/ttf2png.c b/ttf2png.c index 7ef19e1..9714ecd 100644 --- a/ttf2png.c +++ b/ttf2png.c @@ -61,8 +61,8 @@ typedef struct sFont Image image; } Font; -unsigned round_to_pot(unsigned); void usage(); +unsigned round_to_pot(unsigned); void *alloc_image_data(size_t, size_t); int init_font(Font *, FT_Face, unsigned, unsigned, int); int render_grid(Font *, unsigned, unsigned, unsigned, int); @@ -271,18 +271,6 @@ int main(int argc, char **argv) return 0; } -unsigned round_to_pot(unsigned n) -{ - n -= 1; - n |= n>>1; - n |= n>>2; - n |= n>>4; - n |= n>>8; - n |= n>>16; - - return n+1; -} - void usage() { printf("ttf2png - True Type Font to PNG converter\n" @@ -307,6 +295,18 @@ void usage() " -h Print this message\n"); } +unsigned round_to_pot(unsigned n) +{ + n -= 1; + n |= n>>1; + n |= n>>2; + n |= n>>4; + n |= n>>8; + n |= n>>16; + + return n+1; +} + void *alloc_image_data(size_t a, size_t b) { void *ptr; @@ -320,14 +320,14 @@ void *alloc_image_data(size_t a, size_t b) a += c; if(apitch<0) { for(y=0; yrows; ++y) for(x=0; xwidth; ++x) @@ -727,7 +727,7 @@ int save_png(const char *fn, const Image *image, char alpha) png_info *pngi; png_byte **rows; unsigned i; - png_byte *data2; + png_byte *data2 = 0; int color; if(!strcmp(fn, "-"))