#INCLUDES = -I../debug -D__MEMORY_ALLOCATION__
INCLUDES =
-#OFLAGS = -O4 -Os
+OFLAGS = -O4 -Os
#OFLAGS = -O4 -ffast-math -finline-functions
#OFLAGS = -O4 -finline-functions
#OFLAGS += -mtune=pentium3 -mmmx -msse -msse2 -m3dnow
#OFLAGS += -minline-all-stringops -fsingle-precision-constant
#OFLAGS += -malign-double
CFLAGS += -W -Wall -Wextra -g
-CFLAGS += -std=c99 -D_XOPEN_SOURCE=500
CFLAGS += $(OFLAGS) $(INCLUDES) $(OPTIONS)
LDFLAGS += -g $(LDOPTS) $(OPTIONS)
MV = mv
ifneq (, $(findstring linux, $(MAKE_HOST)))
# Linux
+CFLAGS += -std=c99 -D_XOPEN_SOURCE=500
else ifneq (, $(findstring mingw, $(MAKE_HOST)))
# Windows MinGw
+CFLAGS += -DPDC_WIDE
#LDLIBS += -lws2_32
LDOPT = winlnk
else ifneq (, $(findstring cygwin, $(MAKE_HOST)))
# Windows CygWin
+CFLAGS += -DPDC_WIDE
LDOPT = winlnk
else ifneq (, $(findstring msdos, $(MAKE_HOST)))
# MSDOS
int colormap = 2;
float gf[3] = { 1.0f, 1.0f, 1.0f };
-int mode = 0;
+int mode = 1;
char *help =
"<i> Move up\n"
fprintf (fd, "usage: %s [-g gamma] [-h] [-t|-w] [-v int] <file>\n", progname);
fprintf (fd, " -g: gamma correction (%.1f:%.1f:%.1f)\n", gf[0], gf[1], gf[2]);
fprintf (fd, " -h: help message\n");
- fprintf (fd, " -t: thin mode (%s)\n", (mode == 0) ? "on" : "off");
+ fprintf (fd, " -t: thin mode (%s)\n", (mode == 1) ? "on" : "off");
fprintf (fd, " -v: verbose level (%d)\n", verbose);
- fprintf (fd, " -w: wide mode (%s)\n", (mode == 1) ? "on" : "off");
+ fprintf (fd, " -w: wide mode (%s)\n", (mode == 2) ? "on" : "off");
fprintf (fd, "%s version %s\n", progname, version);
return ret;
}
break;
case 't':
- mode = 0;
+ mode = 1;
break;
case 'v':
arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
verbose = atoi (arg);
break;
case 'w':
- mode = 1;
+ mode = 2;
break;
case 'h':
default:
int stop = 0;
while (!stop) {
- int width = min (image->width - xcursor, COLS);
+ int width = min (image->width - xcursor, COLS / mode);
int height = min (image->height - ycursor, LINES);
int x, y;
for (y = 0; y < height; y++) {
//color_t *color = findcolor (correction (image->red[ind], gf[0]), correction (image->green[ind], gf[1]), correction (image->blue[ind], gf[2]), colormap);
attron (COLOR_PAIR (color->code));
- move (y, x);
+ move (y, x * mode);
cchar_t tmp;
wchar_t tmp_wchar[2] = {0};
tmp_wchar[0] = (wchar_t) ' ';
setcchar (&tmp, tmp_wchar, A_NORMAL, 0, NULL);
add_wch (&tmp);
+ if (mode == 2) {
+ move (y, x * mode + 1);
+ add_wch (&tmp);
+ }
}
}
refresh ();
switch (getch ()) {
case KEY_UP:
case 'i':
- if (image->height - ycursor > LINES) {
+ if (ycursor > 0) {
ycursor--;
}
break;
case KEY_LEFT:
case 'j':
- if (image->width - xcursor > COLS) {
+ if (xcursor > 0) {
xcursor--;
}
break;
case KEY_DOWN:
case 'k':
- if (ycursor < 0) {
+ if (image->height - ycursor > LINES) {
ycursor++;
}
break;
case KEY_RIGHT:
case 'l':
- if (xcursor < 0) {
+ if (image->width - xcursor > COLS / mode) {
xcursor++;
}
break;