Root/plplot/patches/050-linuxvga-320x240x16M.patch

1Index: plplot-5.9.7/drivers/linuxvga.c
2===================================================================
3--- plplot-5.9.7.orig/drivers/linuxvga.c 2011-01-30 19:15:09.000000000 +0100
4+++ plplot-5.9.7/drivers/linuxvga.c 2011-01-30 19:17:08.000000000 +0100
5@@ -39,8 +39,8 @@
6 
7 /* INDENT ON */
8 
9-static PLINT vgax = 639;
10-static PLINT vgay = 479;
11+static PLINT vgax = 319;
12+static PLINT vgay = 239;
13 
14 /* A flag to tell us whether we are in text or graphics mode */
15 
16@@ -53,6 +53,7 @@
17 static int mode = TEXT_MODE;
18 static int col = 1;
19 static int totcol = 16;
20+static int vgacol = 0;
21 
22 #define CLEAN 0
23 #define DIRTY 1
24@@ -95,7 +96,7 @@
25 /* What kind of VGA mode one wants is set up here.
26  * It can be easyly made interactive! */
27 
28- mode = G640x480x16; /* See <vga.h> for a list */
29+ mode = G320x240x16M32; /* See <vga.h> for a list */
30     if ( vga_hasmode( mode ) )
31         vga_setmode( mode );
32     else
33@@ -111,7 +112,7 @@
34 
35     totcol = vga_getcolors();
36 
37- plP_setpxl( 2.5, 2.5 ); /* My best guess. Seems to work okay. */
38+ plP_setpxl( 1.0, 1.0 );
39     plP_setphy( 0, vgax, 0, vgay );
40 }
41 
42@@ -163,6 +164,7 @@
43 
44     /* vga_setmode(mode); */
45     vga_clear(); /* just clean it */
46+ vga_setcolor(vgacol); /* restore color (reset by vga_clear()) */
47 
48     page_state = CLEAN;
49 }
50@@ -202,24 +204,34 @@
51 void
52 plD_state_vga( PLStream *pls, PLINT op )
53 {
54+ int r, g, b;
55+
56     switch ( op )
57     {
58     case PLSTATE_WIDTH:
59         break;
60 
61     case PLSTATE_COLOR0:
62- if ( pls->color )
63+ if ( !pls->color )
64         {
65- /* Maybe it would be wiser to use a set of 16 relevant colors only
66- * and just fix it to black if col is exceeded 16. */
67-
68- col = ( pls->icol0 ) % totcol; /* Color modulo # of colors
69- * avail */
70- vga_setcolor( col );
71+ r = g = b = pls->icol0 ? 0xff : 0;
72         }
73- break;
74-
75+ else
76+ {
77+ r = pls->curcolor.r, g = pls->curcolor.g, b = pls->curcolor.b;
78+ }
79+ vgacol = vga_setrgbcolor (r, g, b);
80+ break;
81     case PLSTATE_COLOR1:
82+ if ( !pls->color )
83+ {
84+ r = g = b = pls->curcolor.r;
85+ }
86+ else
87+ {
88+ r = pls->curcolor.r, g = pls->curcolor.g, b = pls->curcolor.b;
89+ }
90+ vgacol = vga_setrgbcolor( r, g, b );
91         break;
92     }
93 }
94

Archive Download this file



interactive