Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 60227 Details for
Bug 94567
Summary mode patch for media-gfx/optipng
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Summary mode patch for optipng 0.4.8
optipng-0.4.8-summary-mode.patch (text/plain), 9.45 KB, created by
René Rhéaume (a.k.a. repzilon, rener)
on 2005-05-30 17:47:44 UTC
(
hide
)
Description:
Summary mode patch for optipng 0.4.8
Filename:
MIME Type:
Creator:
René Rhéaume (a.k.a. repzilon, rener)
Created:
2005-05-30 17:47:44 UTC
Size:
9.45 KB
patch
obsolete
>diff -urp optipng-0.4.8/src/optipng.c optipng-0.4.8.summary/src/optipng.c >--- optipng-0.4.8/src/optipng.c 2005-05-09 23:46:00 -0500 >+++ optipng-0.4.8.summary/src/optipng.c 2005-05-14 14:53:28 -0500 >@@ -72,6 +72,7 @@ static const char *msg_short_help = > " -k, -keep\t\tkeep a backup of the input files\n" > " -log\t\tlog messages to \"optipng.log\"\n" > " -q, -quiet\t\tquiet mode\n" >+ " -s, -summary\tsummary mode\n" > "Examples:\n" > " optipng -o5 file.png\t\t\t(moderately slow)\n" > " optipng -o7 file.png\t\t\t(very slow)\n" >@@ -92,6 +93,7 @@ static const char *msg_help = > " -k, -keep\t\tkeep a backup of the input files\n" > " -log\t\tlog messages to \"optipng.log\"\n" > " -q, -quiet\t\tquiet mode\n" >+ " -s, -summary\tsummary mode\n" > "Advanced options:\n" > " -zc <levels>\tzlib compression levels (1-9)\t\tdefault 9\n" > " -zm <levels>\tzlib memory levels (1-9)\t\tdefault 8\n" >@@ -229,7 +231,7 @@ static struct cmdline_struct > int has_files; > int help, ver; > int interlace; >- int keep, log, quiet; >+ int keep, log, quiet, summary; > int nb, nc, no, np, nz; > int fix, force, full, preserve; > bitset compr_level_table, mem_level_table, strategy_table, filter_table; >@@ -795,9 +797,12 @@ opng_read_png(FILE *infile) > } > } > >- opng_get_image_info(read_ptr, read_info_ptr, read_end_info_ptr, 0); >- opng_print_image_info(1, 1, 1); >- opng_printf("\n"); >+ if (!cmdline.summary) >+ { >+ opng_get_image_info(read_ptr, read_info_ptr, read_end_info_ptr, 0); >+ opng_print_image_info(1, 1, 1); >+ opng_printf("\n"); >+ } > > png_debug(0, "Attempting to reduce image\n"); > reductions = OPNG_REDUCE_ALL; >@@ -814,13 +819,13 @@ opng_read_png(FILE *infile) > > if (reductions != OPNG_REDUCE_NONE) > { >- if (reductions & (OPNG_REDUCE_BIT_DEPTH | OPNG_REDUCE_COLOR_TYPE)) >+ if ((reductions & (OPNG_REDUCE_BIT_DEPTH | OPNG_REDUCE_COLOR_TYPE)) && !cmdline.summary) > { > opng_printf("The image is losslessly reduced to "); > opng_print_image_info(0, 1, 0); > opng_printf("\n"); > } >- if (reductions & OPNG_REDUCE_PALETTE) >+ if ((reductions & OPNG_REDUCE_PALETTE) && !cmdline.summary) > opng_printf( > "The color palette or transparency is losslessly reduced.\n"); > } >@@ -1047,7 +1052,8 @@ opng_minimize_idat(void) > } > > /* Iterate through the "hyper-rectangle" (zc, zm, zs, f). */ >- opng_printf("Trying...\n"); >+ if (!cmdline.summary) >+ opng_printf("Trying...\n"); > for (filter = FILTER_MIN; filter <= FILTER_MAX; ++filter) > if (BITSET_GET(filter_table, filter)) > for (strategy = STRATEGY_MIN; strategy <= STRATEGY_MAX; ++strategy) >@@ -1074,20 +1080,25 @@ opng_minimize_idat(void) > mem_level >= MEM_LEVEL_MIN; --mem_level) > if (BITSET_GET(mem_level_table, mem_level)) > { >- opng_printf( >- " zc = %d zm = %d zs = %d f = %d\t\t", >- compr_level, mem_level, strategy, filter); >+ if (!cmdline.summary) >+ opng_printf( >+ " zc = %d zm = %d zs = %d f = %d\t\t", >+ compr_level, mem_level, strategy, filter); > opng_write_png(NULL, > compr_level, mem_level, strategy, filter); > if (opng_info.idat_size > PNG_MAX_UINT) > { >- opng_printf("IDAT too big ... abandoned at "); >- opng_progress(1); >- opng_printf("\n"); >+ if (!cmdline.summary) >+ { >+ opng_printf("IDAT too big ... abandoned at "); >+ opng_progress(1); >+ opng_printf("\n"); >+ } > continue; > } >- opng_printf("IDAT size = %lu\n", >- (unsigned long)opng_info.idat_size); >+ if (!cmdline.summary) >+ opng_printf("IDAT size = %lu\n", >+ (unsigned long)opng_info.idat_size); > if (opng_info.best_idat_size < opng_info.idat_size) > continue; > if (opng_info.best_idat_size == opng_info.idat_size >@@ -1123,7 +1134,8 @@ opng_optimize_png(const char *filename) > char bak_filename[FILENAME_MAX]; > const char *err_msg; > >- opng_printf("** Processing %s\n", filename); >+ if (!cmdline.summary) >+ opng_printf("** Processing %s\n", filename); > > memset(&opng_info, 0, sizeof(opng_info)); > opng_info.valid = 1; >@@ -1172,21 +1184,27 @@ opng_optimize_png(const char *filename) > > init_file_size = opng_info.file_size; > init_idat_size = opng_info.total_idat_size = opng_info.idat_size; >- opng_printf("Input file size = %lu bytes\n", >- (unsigned long)init_file_size); >- opng_printf("Input IDAT size = %lu bytes\n", >- (unsigned long)init_idat_size); >+ if (!cmdline.summary) >+ { >+ opng_printf("Input file size = %lu bytes\n", >+ (unsigned long)init_file_size); >+ opng_printf("Input IDAT size = %lu bytes\n", >+ (unsigned long)init_idat_size); >+ } > > if (replace >= 2 && cmdline.nz) > opng_printf("!Warning: IDAT recompression is enforced.\n"); > if (replace >= 2 || !cmdline.nz) > { > opng_minimize_idat(); >- opng_printf("\nThe best parameters are:\n" >- " zc = %d zm = %d zs = %d f = %d\t\tIDAT size = %lu\n", >- opng_info.best_compr_level, opng_info.best_mem_level, >- opng_info.best_strategy, opng_info.best_filter, >- (unsigned long)opng_info.best_idat_size); >+ if (!cmdline.summary) >+ { >+ opng_printf("\nThe best parameters are:\n" >+ " zc = %d zm = %d zs = %d f = %d\t\tIDAT size = %lu\n", >+ opng_info.best_compr_level, opng_info.best_mem_level, >+ opng_info.best_strategy, opng_info.best_filter, >+ (unsigned long)opng_info.best_idat_size); >+ } > if (opng_info.reductions != OPNG_REDUCE_NONE) > { > if (opng_info.best_file_size < init_file_size) >@@ -1201,15 +1219,37 @@ opng_optimize_png(const char *filename) > opng_info.total_idat_size = opng_info.best_idat_size; > } > >- if (!replace) >+ if (cmdline.summary) > { >- opng_printf("\n%s is already optimized.\n\n", filename); >- return; >+ if (!replace) >+ { >+ opng_printf("%12u %11u %3u%% %s (%s)\n", >+ init_file_size, init_file_size, 100, filename, >+ "already optimized"); >+ return; >+ } >+ if (cmdline.no) >+ { >+ opng_printf("%12u %11u %3u%% %s (zc=%d zm=%d zs=%d f=%d, %s)\n", >+ init_file_size, init_file_size, 100, filename, >+ opng_info.best_compr_level, opng_info.best_mem_level, >+ opng_info.best_strategy, opng_info.best_filter, >+ (unsigned long)opng_info.best_idat_size, "simulation"); >+ return; >+ } > } >- if (cmdline.no) >+ else > { >- opng_printf("\nSimulation mode: %s not changed.\n\n", filename); >- return; >+ if (!replace) >+ { >+ opng_printf("\n%s is already optimized.\n\n", filename); >+ return; >+ } >+ if (cmdline.no) >+ { >+ opng_printf("\nSimulation mode: %s not changed.\n\n", filename); >+ return; >+ } > } > > /* Rename the input and write the output. */ >@@ -1269,13 +1309,26 @@ opng_optimize_png(const char *filename) > remove(bak_filename); > } > >- opng_printf("\nNew file size = %lu bytes (", >- (unsigned long)opng_info.file_size); >- opng_print_size_difference(init_file_size, opng_info.file_size, 0); >- opng_printf(")\nNew IDAT size = %lu bytes (", >- (unsigned long)opng_info.idat_size); >- opng_print_size_difference(init_idat_size, opng_info.idat_size, 1); >- opng_printf(")\n\n"); >+ >+ if (cmdline.summary) >+ { >+ opng_printf("%12u %11u %3u%% %s (zc=%d zm=%d zs=%d f=%d)\n", >+ init_file_size, opng_info.file_size, >+ opng_info.file_size * 100 / init_file_size, filename, >+ opng_info.best_compr_level, opng_info.best_mem_level, >+ opng_info.best_strategy, opng_info.best_filter, >+ (unsigned long)opng_info.best_idat_size); >+ } >+ else >+ { >+ opng_printf("\nNew file size = %lu bytes (", >+ (unsigned long)opng_info.file_size); >+ opng_print_size_difference(init_file_size, opng_info.file_size, 0); >+ opng_printf(")\nNew IDAT size = %lu bytes (", >+ (unsigned long)opng_info.idat_size); >+ opng_print_size_difference(init_idat_size, opng_info.idat_size, 1); >+ opng_printf(")\n\n"); >+ } > } > > >@@ -1372,6 +1425,11 @@ parse_args(int argc, char *argv[]) > cmdline.quiet = 1; > continue; > } >+ if (strcmp(arg, "s") == 0 || strcmp(arg, "summary") == 0) >+ { >+ cmdline.summary = 1; >+ continue; >+ } > if (strcmp(arg, "fix") == 0) > { > cmdline.fix = 1; >@@ -1594,7 +1652,8 @@ main(int argc, char *argv[]) > > result = EXIT_SUCCESS; > >- opng_printf(msg_intro); >+ if (!cmdline.summary || !cmdline.has_files) >+ opng_printf(msg_intro); > if (cmdline.ver) > { > opng_printf(msg_license);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 94567
:
60224
|
60226
| 60227