1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 18:18:26 +02:00

plplot: make svgalib based video mode work somewhat.

This commit is contained in:
David Kühling 2011-01-08 14:24:37 +01:00
parent e7a8a44f77
commit e188763f7c
2 changed files with 55 additions and 2 deletions

View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=plplot
PKG_VERSION:=5.9.7
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)/$(PKG_VERSION)%20Source
PKG_MD5SUM:=c53c484ed93ce8446513c31707551b5b
@ -117,7 +117,7 @@ endef
define Package/plplot-linuxvga
$(call Package/plplot/Default)
DEPENDS:= +svgalib
DEPENDS:= +plplot +svgalib
TITLE+= (svgalib driver)
endef

View File

@ -0,0 +1,53 @@
Index: plplot-5.9.7/drivers/linuxvga.c
===================================================================
--- plplot-5.9.7.orig/drivers/linuxvga.c 2011-01-08 12:20:09.000000000 +0100
+++ plplot-5.9.7/drivers/linuxvga.c 2011-01-08 12:27:34.000000000 +0100
@@ -39,8 +39,8 @@
/* INDENT ON */
-static PLINT vgax = 639;
-static PLINT vgay = 479;
+static PLINT vgax = 319;
+static PLINT vgay = 239;
/* A flag to tell us whether we are in text or graphics mode */
@@ -95,7 +95,7 @@
/* What kind of VGA mode one wants is set up here.
* It can be easyly made interactive! */
- mode = G640x480x16; /* See <vga.h> for a list */
+ mode = G320x240x16M32; /* See <vga.h> for a list */
if ( vga_hasmode( mode ) )
vga_setmode( mode );
else
@@ -202,6 +202,13 @@
void
plD_state_vga( PLStream *pls, PLINT op )
{
+ static const int vga_palette[16] = {
+ 0x000000, 0x000080, 0x008000, 0x008080,
+ 0x800000, 0x800080, 0x808000, 0xc0c0c0,
+ 0x808080, 0x0000ff, 0x00ff00, 0x00ffff,
+ 0xff0000, 0xff00ff, 0xffff00, 0xffffff
+ };
+
switch ( op )
{
case PLSTATE_WIDTH:
@@ -210,11 +217,9 @@
case PLSTATE_COLOR0:
if ( pls->color )
{
- /* Maybe it would be wiser to use a set of 16 relevant colors only
- * and just fix it to black if col is exceeded 16. */
-
- col = ( pls->icol0 ) % totcol; /* Color modulo # of colors
- * avail */
+ /* fix to make it work with true-color mode */
+ if (col < 16)
+ col = vga_palette[col];
vga_setcolor( col );
}
break;