OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | Index: zgv-5.9/src/zgv.c |
| 2 | =================================================================== |
| 3 | --- zgv-5.9.orig/src/zgv.c 2011-01-23 19:09:28.000000000 +0100 |
| 4 | +++ zgv-5.9/src/zgv.c 2011-02-03 22:20:30.000000000 +0100 |
| 5 | @@ -148,7 +148,8 @@ |
| 6 | |
| 7 | |
| 8 | /* from 18-bit RGB (as used by VGA palette) to 3:3:2 palette index */ |
| 9 | -#define MAKE332COL(r,g,b) (((r)>>3)*32+((g)>>3)*4+((b)>>4)) |
| 10 | +#define MAKE332COL(r,g,b) vga_setrgbcolor(((r)<<2)+2, ((g)<<2)+2, ((b)<<2)+2); |
| 11 | +//(((r)>>3)*32+((g)>>3)*4+((b)>>4)) |
| 12 | |
| 13 | /* colour indicies used for filenames-only selector */ |
| 14 | #define LIGHT 2 |
| 15 | @@ -254,6 +255,7 @@ |
| 16 | |
| 17 | int fs_vgamode=G640x480x256; /* current video mode for selector */ |
| 18 | int fs_scrnwide,fs_scrnhigh; /* width/height of selector mode */ |
| 19 | +int fs_bypp; |
| 20 | |
| 21 | /* stuff for checking old directories (to avoid symlink loops in |
| 22 | * recursive update). |
| 23 | @@ -2225,6 +2227,32 @@ |
| 24 | return(buf); |
| 25 | } |
| 26 | |
| 27 | +static void drawscansegment_332(unsigned char *colors, int x, int y, int length) |
| 28 | +{ |
| 29 | + unsigned char *conv = colors; |
| 30 | + int bypp = fs_bypp; |
| 31 | + |
| 32 | + if (bypp > 1) |
| 33 | + { |
| 34 | + int i, j, k; |
| 35 | + conv = malloc(length*bypp); |
| 36 | + for (i = 0, j=0; i < length; i++) |
| 37 | + { |
| 38 | + int c332=colors[i]; |
| 39 | + int r = c332>>5, g = (c332>>2)&0x7, b = (c332&0x3); |
| 40 | + int crgb = vga_setrgbcolor((r<<5)+16,(g<<5)+16,(b<<6)+32); |
| 41 | + for (k = 0; k < bypp; k++) { |
| 42 | + conv[j++] = crgb>>(k*8) & 0xff; |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + vga_drawscansegment(conv, x, y, length*(bypp < 1 ? 1 : bypp)); |
| 48 | + if (conv != colors) |
| 49 | + { |
| 50 | + free(conv); |
| 51 | + } |
| 52 | +} |
| 53 | |
| 54 | void showgifdir(int startfrom,int unshow,int drawdirmsg,int do_one_only) |
| 55 | { |
| 56 | @@ -2317,14 +2345,12 @@ |
| 57 | /* load and draw thumbnail file (or undraw it) */ |
| 58 | if(unshow) |
| 59 | { |
| 60 | - image=malloc(96); |
| 61 | if(image!=NULL) |
| 62 | { |
| 63 | - memset(image,idx_medium,96); |
| 64 | - for(y=-2;y<62;y++) |
| 65 | - vga_drawscansegment(image, |
| 66 | - xpos+(BARWIDTH-80)/2-2,ypos+y+GDFYBIT+9,96); |
| 67 | - free(image); |
| 68 | + gl_fillbox(xpos+(BARWIDTH-80)/2-2,ypos-2+GDFYBIT+9,96,62+2, |
| 69 | + idx_medium); |
| 70 | + gl_fillbox(xpos+(BARWIDTH-80)/2-2,ypos-2+GDFYBIT+9,96,62+2, |
| 71 | + idx_medium); |
| 72 | } |
| 73 | } |
| 74 | else |
| 75 | @@ -2370,7 +2396,7 @@ |
| 76 | if(image!=NULL) |
| 77 | { |
| 78 | for(y=0;y<h;y++) |
| 79 | - vga_drawscansegment(image+y*(fs_vgamode==G640x480x16?w8:w),xwant, |
| 80 | + drawscansegment_332(image+y*(fs_vgamode==G640x480x16?w8:w),xwant, |
| 81 | ypos+y+GDFYBIT+39-h/2,fs_vgamode==G640x480x16?w8:w); |
| 82 | free(image); |
| 83 | } |
| 84 | @@ -2666,7 +2692,10 @@ |
| 85 | /* fs_vgamode is known to be valid at this point. */ |
| 86 | |
| 87 | if(fs_vgamode!=vga_getcurrentmode()) |
| 88 | +{ |
| 89 | vga_setmode(fs_vgamode); |
| 90 | + gl_setcontextvga(vga_getcurrentmode()); |
| 91 | +} |
| 92 | else |
| 93 | { |
| 94 | /* the palette-setting makes sure we don't have a possibly-crazy palette |
| 95 | @@ -2678,6 +2707,7 @@ |
| 96 | |
| 97 | fs_scrnwide=vga_getxdim(); |
| 98 | fs_scrnhigh=vga_getydim(); |
| 99 | +fs_bypp=vga_getmodeinfo(vga_getcurrentmode())->bytesperpixel; |
| 100 | |
| 101 | msgbox_draw_ok=1; |
| 102 | gdfsiz=3-cfg.smallfstext; |
| 103 | @@ -2734,10 +2764,11 @@ |
| 104 | { |
| 105 | /* no-thumbnails selector */ |
| 106 | barheight=GDFYBIT+6; |
| 107 | - idx_medium=MIDGREY; idx_dark=DARK; idx_light=LIGHT; idx_black=BLACK; |
| 108 | - idx_marked=MARKEDCOL; |
| 109 | - idx_blacknz=BLACK; |
| 110 | - if(fs_vgamode==G640x480x16) idx_medium=0; |
| 111 | + idx_medium=MAKE332COL(cfg.medium.r,cfg.medium.g,cfg.medium.b); |
| 112 | + idx_dark =MAKE332COL(cfg.dark.r ,cfg.dark.g ,cfg.dark.b ); |
| 113 | + idx_light =MAKE332COL(cfg.light.r ,cfg.light.g ,cfg.light.b ); |
| 114 | + idx_black =MAKE332COL(cfg.black.r ,cfg.black.g ,cfg.black.b ); |
| 115 | + idx_marked=MAKE332COL(cfg.marked.r,cfg.marked.g,cfg.marked.b); |
| 116 | } |
| 117 | |
| 118 | if(!(cfg.xvpic_index && cfg.perfectindex)) |
| 119 | @@ -2772,14 +2803,7 @@ |
| 120 | |
| 121 | if(idx_medium) |
| 122 | { |
| 123 | - /* clear screen with `medium' (i.e. background) colour. */ |
| 124 | - if((tmp=malloc(fs_scrnwide))!=NULL) |
| 125 | - { |
| 126 | - memset(tmp,idx_medium,fs_scrnwide); |
| 127 | - for(n=0;n<fs_scrnhigh;n++) |
| 128 | - vga_drawscanline(n,tmp); |
| 129 | - free(tmp); |
| 130 | - } |
| 131 | + gl_clearscreen(idx_medium); |
| 132 | } |
| 133 | #ifndef BACKEND_SVGALIB |
| 134 | else |
| 135 | @@ -2932,12 +2956,8 @@ |
| 136 | |
| 137 | void clear_xvpic(int xpos,int ypos) |
| 138 | { |
| 139 | -unsigned char tmp[96]; |
| 140 | -int y; |
| 141 | - |
| 142 | -memset(tmp,idx_medium,96); |
| 143 | -for(y=-3;y<63;y++) |
| 144 | - vga_drawscansegment(tmp,xpos+(BARWIDTH-80)/2-3,ypos+y+GDFYBIT+9,96); |
| 145 | +gl_fillbox(xpos+(BARWIDTH-80)/2-3,ypos-3+GDFYBIT+9, |
| 146 | + 96, 63+3, idx_medium); |
| 147 | } |
| 148 | |
| 149 | |
| 150 | Index: zgv-5.9/src/rbmenu.c |
| 151 | =================================================================== |
| 152 | --- zgv-5.9.orig/src/rbmenu.c 2011-01-29 13:15:39.000000000 +0100 |
| 153 | +++ zgv-5.9/src/rbmenu.c 2011-01-29 13:16:14.000000000 +0100 |
| 154 | @@ -235,6 +235,8 @@ |
| 155 | unsigned char distnum; |
| 156 | int xr,xg,xb,dist,distquan,f; |
| 157 | |
| 158 | +return vga_setrgbcolor((r<<2)+2, (g<<2)+2, (b<<2)+2); |
| 159 | + |
| 160 | rgb=((b<<12)|(g<<6)|r); |
| 161 | distnum=0; |
| 162 | distquan=20000; /* standard arbitrary bignum */ |
| 163 |
