1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-12-23 01:53:20 +02:00

zgv: basic truecolor support for the thumbnail browser

also add the Makefile patch that's needed for compilation (previously forgotten)
This commit is contained in:
David Kühling 2011-01-23 20:07:20 +01:00
parent 0e75785f17
commit 0e5906dde6
2 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,73 @@
Index: zgv-5.9/config.mk
===================================================================
--- zgv-5.9.orig/config.mk 2011-01-22 20:49:48.000000000 +0100
+++ zgv-5.9/config.mk 2011-01-23 12:45:27.000000000 +0100
@@ -7,8 +7,8 @@
# Set the C compiler to use, and options for it.
# This is likely to be what you'll want for most systems:
#
-CC=gcc
-CFLAGS=-O2 -Wall -fomit-frame-pointer -finline-functions
+#CC=gcc
+#CFLAGS=-O2 -Wall -fomit-frame-pointer -finline-functions
#
# If you're brave enough to try compiling zgv on a non-x86 system :-),
# this might be a better bet:
@@ -37,7 +37,7 @@
# MANDIR to directory for man page.
# Usually it will be simpler to just set PREFIX.
#
-PREFIX=/usr/local
+PREFIX=/usr/
# In theory it would be nice to put the info file and man page under
# /usr/local/share. However, it's not clear if this is widely
@@ -59,7 +59,7 @@
# Set the location/filename of the system-wide configuration file. You
# may prefer to have this under /etc, for example.
#
-RCFILE=$(PREFIX)/etc/zgv.conf
+RCFILE=/etc/zgv.conf
# Normally `make install' will update your `dir' file (in INFODIR),
Index: zgv-5.9/src/Makefile
===================================================================
--- zgv-5.9.orig/src/Makefile 2011-01-23 12:43:07.000000000 +0100
+++ zgv-5.9/src/Makefile 2011-01-23 12:53:52.000000000 +0100
@@ -13,8 +13,8 @@
# having /usr/local/{include,lib} like this is apparently needed for
# FreeBSD, but shouldn't cause problems on Linux.
#
-CFLAGS+=-I/usr/local/include
-ZGV_LIBS=-L/usr/local/lib
+#CFLAGS+=-I/usr/local/include
+#ZGV_LIBS=-L/usr/local/lib
CFLAGS+=-DBACKEND_$(BACKEND)
@@ -47,7 +47,7 @@
modesel.o readpcd.o readtiff.o readprf.o zgv_io.o
zgv: $(ZGV_OBJS)
- $(CC) $(CFLAGS) -o zgv $(ZGV_OBJS) $(ZGV_LIBS)
+ $(CC) $(LDFLAGS) $(CFLAGS) -o zgv $(ZGV_OBJS) $(ZGV_LIBS)
bdf2h: bdf2h.o
$(CC) $(CFLAGS) -o bdf2h bdf2h.o
@@ -134,10 +134,10 @@
../fonts/helvR12.bdf \
../fonts/helvB12.bdf \
../fonts/helvR18.bdf
- ./bdf2h 0 <../fonts/timI12.bdf >fontbmps.h
- ./bdf2h 1 <../fonts/helvR08.bdf >>fontbmps.h
- ./bdf2h 2 <../fonts/helvR12.bdf >>fontbmps.h
- ./bdf2h 2b <../fonts/helvB12.bdf >>fontbmps.h
- ./bdf2h 3 <../fonts/helvR18.bdf >>fontbmps.h
+ zgv-bdf2h 0 <../fonts/timI12.bdf >fontbmps.h
+ zgv-bdf2h 1 <../fonts/helvR08.bdf >>fontbmps.h
+ zgv-bdf2h 2 <../fonts/helvR12.bdf >>fontbmps.h
+ zgv-bdf2h 2b <../fonts/helvB12.bdf >>fontbmps.h
+ zgv-bdf2h 3 <../fonts/helvR18.bdf >>fontbmps.h
rcfile_opt.h rcfile_var.h rcfile_short.h: options.src mkopts.awk
$(AWK) -f mkopts.awk <options.src

View File

@ -0,0 +1,89 @@
Index: zgv-5.9/src/zgv.c
===================================================================
--- zgv-5.9.orig/src/zgv.c 2011-01-23 19:09:28.000000000 +0100
+++ zgv-5.9/src/zgv.c 2011-01-23 19:43:52.000000000 +0100
@@ -254,6 +254,7 @@
int fs_vgamode=G640x480x256; /* current video mode for selector */
int fs_scrnwide,fs_scrnhigh; /* width/height of selector mode */
+int fs_bypp;
/* stuff for checking old directories (to avoid symlink loops in
* recursive update).
@@ -2225,6 +2226,32 @@
return(buf);
}
+static void drawscansegment_332(unsigned char *colors, int x, int y, int length)
+{
+ unsigned char *conv = colors;
+ int bypp = fs_bypp;
+
+ if (bypp != 1)
+ {
+ int i, j, k;
+ conv = malloc(length*bypp);
+ for (i = 0, j=0; i < length; i++)
+ {
+ int c332=colors[i];
+ int r = c332>>5, g = (c332>>2)&0x7, b = (c332&0x3);
+ int crgb = vga_setrgbcolor((r<<5)+16,(g<<5)+16,(b<<6)+32);
+ for (k = 0; k < bypp; k++) {
+ conv[j++] = crgb>>(k*8) & 0xff;
+ }
+ }
+ }
+
+ vga_drawscansegment(conv, x, y, length*bypp);
+ if (conv != colors)
+ {
+ free(conv);
+ }
+}
void showgifdir(int startfrom,int unshow,int drawdirmsg,int do_one_only)
{
@@ -2322,7 +2349,7 @@
{
memset(image,idx_medium,96);
for(y=-2;y<62;y++)
- vga_drawscansegment(image,
+ drawscansegment_332(image,
xpos+(BARWIDTH-80)/2-2,ypos+y+GDFYBIT+9,96);
free(image);
}
@@ -2370,7 +2397,7 @@
if(image!=NULL)
{
for(y=0;y<h;y++)
- vga_drawscansegment(image+y*(fs_vgamode==G640x480x16?w8:w),xwant,
+ drawscansegment_332(image+y*(fs_vgamode==G640x480x16?w8:w),xwant,
ypos+y+GDFYBIT+39-h/2,fs_vgamode==G640x480x16?w8:w);
free(image);
}
@@ -2678,6 +2705,7 @@
fs_scrnwide=vga_getxdim();
fs_scrnhigh=vga_getydim();
+fs_bypp=vga_getmodeinfo(vga_getcurrentmode())->bytesperpixel;
msgbox_draw_ok=1;
gdfsiz=3-cfg.smallfstext;
@@ -2777,7 +2805,7 @@
{
memset(tmp,idx_medium,fs_scrnwide);
for(n=0;n<fs_scrnhigh;n++)
- vga_drawscanline(n,tmp);
+ drawscansegment_332(tmp,0,n,fs_scrnwide);
free(tmp);
}
}
@@ -2937,7 +2965,7 @@
memset(tmp,idx_medium,96);
for(y=-3;y<63;y++)
- vga_drawscansegment(tmp,xpos+(BARWIDTH-80)/2-3,ypos+y+GDFYBIT+9,96);
+ drawscansegment_332(tmp,xpos+(BARWIDTH-80)/2-3,ypos+y+GDFYBIT+9,96);
}