Backed out WIN32 color palette changes for OpenGL - caused too much

flashing...


git-svn-id: file:///fltk/svn/fltk/trunk@76 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 1998-11-08 17:02:40 +00:00
parent e278c332b3
commit 2b769f5934
4 changed files with 20 additions and 53 deletions

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Window.H,v 1.7 1998/11/08 16:47:43 mike Exp $"
// "$Id: Fl_Window.H,v 1.8 1998/11/08 17:02:38 mike Exp $"
//
// Window header file for the Fast Light Tool Kit (FLTK).
//
@ -29,7 +29,6 @@
#include "Fl_Group.H"
#define FL_WINDOW 0xF0 // all subclasses have type() >= this
#define FL_GL_WINDOW (FL_WINDOW + 1)
class Fl_Window : public Fl_Group {
@ -111,5 +110,5 @@ public:
#endif
//
// End of "$Id: Fl_Window.H,v 1.7 1998/11/08 16:47:43 mike Exp $".
// End of "$Id: Fl_Window.H,v 1.8 1998/11/08 17:02:38 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_Gl_Window.cxx,v 1.9 1998/11/08 16:37:19 mike Exp $"
// "$Id: Fl_Gl_Window.cxx,v 1.10 1998/11/08 17:02:39 mike Exp $"
//
// OpenGL window code for the Fast Light Tool Kit (FLTK).
//
@ -149,9 +149,9 @@ void Fl_Gl_Window::make_current() {
#endif
# if USE_COLORMAP
if (fl_gl_palette) {
if (fl_palette) {
fl_GetDC(fl_xid(this));
SelectPalette(fl_gc, fl_gl_palette, FALSE);
SelectPalette(fl_gc, fl_palette, FALSE);
RealizePalette(fl_gc);
}
# endif // USE_COLORMAP
@ -315,7 +315,6 @@ Fl_Gl_Window::~Fl_Gl_Window() {
void Fl_Gl_Window::init() {
end(); // we probably don't want any children
box(FL_NO_BOX);
type(FL_GL_WINDOW);
mode_ = FL_RGB | FL_DEPTH | FL_DOUBLE;
alist = 0;
context = 0;
@ -329,5 +328,5 @@ void Fl_Gl_Window::draw_overlay() {}
#endif
//
// End of "$Id: Fl_Gl_Window.cxx,v 1.9 1998/11/08 16:37:19 mike Exp $".
// End of "$Id: Fl_Gl_Window.cxx,v 1.10 1998/11/08 17:02:39 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_win32.cxx,v 1.16 1998/11/08 16:47:44 mike Exp $"
// "$Id: Fl_win32.cxx,v 1.17 1998/11/08 17:02:39 mike Exp $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
@ -227,7 +227,7 @@ static int ms2fltk(int vk, int extended) {
}
#if USE_COLORMAP
extern HPALETTE fl_select_palette(int gl); // in fl_color_win32.C
extern HPALETTE fl_select_palette(void); // in fl_color_win32.C
#endif
static Fl_Window* resize_bug_fix;
@ -388,20 +388,17 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
#if USE_COLORMAP
case WM_QUERYNEWPALETTE :
fl_GetDC(hWnd);
if (fl_select_palette(window->type() == FL_GL_WINDOW))
InvalidateRect(hWnd, NULL, FALSE);
if (fl_select_palette()) InvalidateRect(hWnd, NULL, FALSE);
break;
case WM_PALETTECHANGED:
fl_GetDC(hWnd);
if ((HWND)wParam != hWnd &&
fl_select_palette(window->type() == FL_GL_WINDOW))
UpdateColors(fl_gc);
if ((HWND)wParam != hWnd && fl_select_palette()) UpdateColors(fl_gc);
break;
case WM_CREATE :
fl_GetDC(hWnd);
fl_select_palette(window->type() == FL_GL_WINDOW);
fl_select_palette();
break;
#endif
@ -755,7 +752,7 @@ void Fl_Window::make_current() {
// for all drawing calls, so we must select it here before any
// code does any drawing...
fl_select_palette(type() == FL_GL_WINDOW);
fl_select_palette();
#endif // USE_COLORMAP
current_ = this;
@ -816,5 +813,5 @@ void Fl_Window::flush() {
}
//
// End of "$Id: Fl_win32.cxx,v 1.16 1998/11/08 16:47:44 mike Exp $".
// End of "$Id: Fl_win32.cxx,v 1.17 1998/11/08 17:02:39 mike Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: fl_color_win32.cxx,v 1.5 1998/11/08 16:37:21 mike Exp $"
// "$Id: fl_color_win32.cxx,v 1.6 1998/11/08 17:02:40 mike Exp $"
//
// WIN32 color functions for the Fast Light Tool Kit (FLTK).
//
@ -47,9 +47,6 @@ Fl_XMap fl_xmap[256];
Fl_XMap* fl_current_xmap;
HPALETTE fl_palette;
#if HAVE_GL
HPALETTE fl_gl_palette;
#endif // HAVE_GL
static void clear_xmap(Fl_XMap& xmap) {
if (xmap.pen) {
@ -187,12 +184,10 @@ void Fl::get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue) {
// Thanks to Michael Sweet @ Easy Software Products for this
HPALETTE
fl_select_palette(int gl)
fl_select_palette(void)
{
static char beenhere;
if (!beenhere) {
int i;
beenhere = 1;
//if (GetDeviceCaps(fl_gc, BITSPIXEL) > 8) return NULL;
@ -210,7 +205,7 @@ fl_select_palette(int gl)
// Build 256 colors from the standard FLTK colormap...
for (i = 0; i < nColors; i ++) {
for (int i = 0; i < nColors; i ++) {
pPal->palPalEntry[i].peRed = (fl_cmap[i] >> 24) & 255;
pPal->palPalEntry[i].peGreen = (fl_cmap[i] >> 16) & 255;
pPal->palPalEntry[i].peBlue = (fl_cmap[i] >> 8) & 255;
@ -219,33 +214,10 @@ fl_select_palette(int gl)
// Create the palette:
fl_palette = CreatePalette(pPal);
#if HAVE_GL
// Now do the OpenGL palette... Any 8-bit display will want 3:3:2 RGB,
// and doing OpenGL on anything less than 8-bits is just asking for
// disappointment!
for (i = 0; i < nColors; i ++) {
pPal->palPalEntry[i].peRed = 255 * ((i >> 5) & 7) / 7;
pPal->palPalEntry[i].peGreen = 255 * ((i >> 2) & 7) / 7;
pPal->palPalEntry[i].peBlue = 255 * (i & 3) / 3;
pPal->palPalEntry[i].peFlags = 0;
};
fl_gl_palette = CreatePalette(pPal);
#endif // HAVE_GL
}
if (gl) {
if (fl_gl_palette) {
SelectPalette(fl_gc, fl_gl_palette, FALSE);
RealizePalette(fl_gc);
}
}
else {
if (fl_palette) {
SelectPalette(fl_gc, fl_palette, FALSE);
RealizePalette(fl_gc);
}
if (fl_palette) {
SelectPalette(fl_gc, fl_palette, FALSE);
RealizePalette(fl_gc);
}
return fl_palette;
}
@ -253,5 +225,5 @@ fl_select_palette(int gl)
#endif
//
// End of "$Id: fl_color_win32.cxx,v 1.5 1998/11/08 16:37:21 mike Exp $".
// End of "$Id: fl_color_win32.cxx,v 1.6 1998/11/08 17:02:40 mike Exp $".
//