Imported from libpng-1.0.9beta10.tar

This commit is contained in:
Glenn Randers-Pehrson
2001-01-15 22:01:20 -06:00
parent 5e5c1e1f56
commit fbbb5ecb52
100 changed files with 2541 additions and 1279 deletions

View File

@@ -11,7 +11,6 @@
Meulen for the "diamond" and "radial waves" patterns, respectively.
to do:
- stdout/stderr don't work! need message window (maybe scrollable?)
- handle quoted command-line args (especially filenames with spaces)
- finish resizable checkerboard-gradient (sizes 4-128?)
- use %.1023s to simplify truncation of title-bar string?
@@ -25,10 +24,12 @@
- 1.03: modified to allow abbreviated options
- 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
fixed command-line parsing bug
- 1.10: enabled "message window" (console), thanks to David Geldreich
- 1.20: added runtime MMX-enabling/disabling and new -mmx* options
---------------------------------------------------------------------------
Copyright (c) 1998-2000 Greg Roelofs. All rights reserved.
Copyright (c) 1998-2001 Greg Roelofs. All rights reserved.
This software is provided "as is," without warranty of any kind,
express or implied. In no event shall the author or contributors
@@ -55,7 +56,7 @@
#define PROGNAME "rpng2-win"
#define LONGNAME "Progressive PNG Viewer for Windows"
#define VERSION "1.04 of 19 March 2000"
#define VERSION "1.20 of 4 January 2001"
#include <stdio.h>
#include <stdlib.h>
@@ -64,6 +65,7 @@
#include <time.h>
#include <math.h> /* only for PvdM background code */
#include <windows.h>
#include <conio.h> /* only for _getch() */
/* all for PvdM background code: */
#ifndef PI
@@ -239,6 +241,16 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
memset(&rpng2_info, 0, sizeof(mainprog_info));
/* Next reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
* incantation. */
AllocConsole();
freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout);
/* Set the default value for our display-system exponent, i.e., the
* product of the CRT exponent and the exponent corresponding to
* the frame-buffer's lookup table (LUT), if any. This is not an
@@ -354,6 +366,14 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
}
} else if (!strncmp(*argv, "-timing", 2)) {
timing = TRUE;
#if (defined(__i386__) || defined(_M_IX86))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
rpng2_info.nommxcombine = TRUE;
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
rpng2_info.nommxinterlace = TRUE;
#endif
} else {
if (**argv != '-') {
filename = *argv;
@@ -401,25 +421,47 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* usage screen */
if (error) {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
int ch;
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng2_version_info();
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]"
" file.png\n\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
#if (defined(__i386__) || defined(_M_IX86))
" %*s [-nommxfilters] [-nommxcombine] [-nommxinterlace]\n"
#endif
" %*s file.png\n\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
"\t\t to the product of the lookup-table exponent (varies)\n"
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
" bg \tdesired background color in 7-character hex RGB format\n"
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images; overrides -bgpat\n"
"\t\t used with transparent images; overrides -bgpat option\n"
" pat \tdesired background pattern number (1-%d); used with\n"
"\t\t transparent images; overrides -bgcolor\n"
"\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n"
#if (defined(__i386__) || defined(_M_IX86))
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
"\t\t combining rows, and expanding interlacing, respectively\n"
#endif
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
"\n", PROGNAME, default_display_exponent, num_bgpat);
"Press Q or Esc to quit this usage screen.\n"
"\n", PROGNAME,
#if (defined(__i386__) || defined(_M_IX86))
strlen(PROGNAME), " ",
#endif
strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
exit(1);
} else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n",
PROGNAME);
}