nanogui: [patch] VxWorks/generic enhancement to GdOpenScreen()


Previous by date: 9 Oct 2000 16:12:56 -0000 Re: C++ Comments in C files, Brent Thompson
Next by date: 9 Oct 2000 16:12:56 -0000 [patch] windows.h protection, Brent Thompson
Previous in thread:
Next in thread:

Subject: [patch] VxWorks/generic enhancement to GdOpenScreen()
From: Brent Thompson ####@####.####
Date: 9 Oct 2000 16:12:56 -0000
Message-Id: <39E1EDB0.2040602@nlc.com>

Greg & Co,

Here is a patch file containing the changes I've made to the
GdOpenScreen() function in the Microwindows engine code.
Basically, I've changed the #ifdef for MSDOS & ELKS to the more
generic NOSTDPAL8.  I've also added (just for consistancy) #ifdef's
for NOSTDPAL1/NOSTDPAL2/NOSTDPAL3/NOSTDPAL4 also.  These more
generic macros can be defined in the config file if the standard
palettes are not needed (thus saving memory).  Also, every new OS
(especially embedded OS's like the VxWorks I am working on) that
is ported won't have to muck on this file to save space.

Just my thoughts! :-)

BAT
-- 
Brent A. Thompson, Next Level Communications <www.nlc.com>
1776 22nd Street #100, West Des Moines, IA 50266-1444
EMail: ####@####.#### Phone: (515)991-3853

*** devopen.c	Mon Oct  9 10:53:08 2000
--- devopen.c_0.88	Mon Oct  9 10:03:22 2000
***************
*** 36,110 ****
  /*
   * Open low level graphics driver
   */
  PSD
  GdOpenScreen(void)
  {
  	PSD			psd;
  	MWPALENTRY *		stdpal;
  
  	psd = scrdev.Open(&scrdev);
  	if (!psd)
  		return NULL;
  	GdGetScreenInfo(psd, &gr_sinfo);
  
  	/* assume no user changable palette entries*/
  	gr_firstuserpalentry = (int)psd->ncolors;
  
  	/* set palette according to system colors and devpalX.c*/
  	switch((int)psd->ncolors) {
- 
- #if !defined(NOSTDPAL1) /* don't require stdpal1 if not needed */
  	case 2:		/* 1bpp*/
- 	{
- 		extern MWPALENTRY	mwstdpal1[2];
  		stdpal = mwstdpal1;
! 	}
! 	break;
! #endif /* !defined(NOSTDPAL1) */
! 
! #if !defined(NOSTDPAL2) /* don't require stdpal2 if not needed */
  	case 4:		/* 2bpp*/
- 	{
- 		extern MWPALENTRY	mwstdpal2[4];
  		stdpal = mwstdpal2;
! 	}
! 	break;
! #endif /* !defined(NOSTDPAL2) */
! 
! #if !defined(NOSTDPAL3) /* don't require stdpal3 if not needed */
  	case 8:		/* 3bpp - not fully supported*/
- #endif /* !defined(NOSTDPAL3) */
- 
- #if !defined(NOSTDPAL4) && !defined(NOSTDPAL3) /* don't require stdpal4 if not needed */
  	case 16:	/* 4bpp*/
- 	{
- 		extern MWPALENTRY	mwstdpal4[16];
  		stdpal = mwstdpal4;
! 	}
! 	break;
! #endif /* !defined(NOSTDPAL4) && !defined(NOSTDPAL3) */
! 
! #if !defined(NOSTDPAL8) /* don't require large stdpal8 if not needed */
  	case 256:	/* 8bpp*/
- 	{
- 		extern MWPALENTRY	mwstdpal8[256];
  #if xxxALPHABLEND
  		/* don't change uniform palette if alpha blending*/
  		gr_firstuserpalentry = 256;
  #else
  		/* start after last system-reserved color*/
  		gr_firstuserpalentry = FIRSTUSERPALENTRY;
  #endif
  		stdpal = mwstdpal8;
! 	} 
! 	break;
! #endif	/* !defined(NOSTDPAL8) */
! 
  	default:	/* truecolor*/
  		/* no palette*/
  		gr_firstuserpalentry = 0;
  		stdpal = NULL;
  	}
  
  	/* reset next user palette entry, write hardware palette*/
  	GdResetPalette();
--- 36,88 ----
  /*
   * Open low level graphics driver
   */
  PSD
  GdOpenScreen(void)
  {
  	PSD			psd;
  	MWPALENTRY *		stdpal;
+ 	extern MWPALENTRY	mwstdpal1[2];
+ 	extern MWPALENTRY	mwstdpal2[4];
+ 	extern MWPALENTRY	mwstdpal4[16];
+ 	extern MWPALENTRY	mwstdpal8[256];
  
  	psd = scrdev.Open(&scrdev);
  	if (!psd)
  		return NULL;
  	GdGetScreenInfo(psd, &gr_sinfo);
  
  	/* assume no user changable palette entries*/
  	gr_firstuserpalentry = (int)psd->ncolors;
  
  	/* set palette according to system colors and devpalX.c*/
  	switch((int)psd->ncolors) {
  	case 2:		/* 1bpp*/
  		stdpal = mwstdpal1;
! 		break;
  	case 4:		/* 2bpp*/
  		stdpal = mwstdpal2;
! 		break;
  	case 8:		/* 3bpp - not fully supported*/
  	case 16:	/* 4bpp*/
  		stdpal = mwstdpal4;
! 		break;
! #if !(MSDOS | ELKS)	/* don't require large stdpal8 if not fb system*/
  	case 256:	/* 8bpp*/
  #if xxxALPHABLEND
  		/* don't change uniform palette if alpha blending*/
  		gr_firstuserpalentry = 256;
  #else
  		/* start after last system-reserved color*/
  		gr_firstuserpalentry = FIRSTUSERPALENTRY;
  #endif
  		stdpal = mwstdpal8;
! 		break;
! #endif
  	default:	/* truecolor*/
  		/* no palette*/
  		gr_firstuserpalentry = 0;
  		stdpal = NULL;
  	}
  
  	/* reset next user palette entry, write hardware palette*/
  	GdResetPalette();

Previous by date: 9 Oct 2000 16:12:56 -0000 Re: C++ Comments in C files, Brent Thompson
Next by date: 9 Oct 2000 16:12:56 -0000 [patch] windows.h protection, Brent Thompson
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.