mirror of
https://github.com/fltk/fltk.git
synced 2026-06-01 23:06:54 +08:00
Fix for STR#3316: use same value for the size argument of glGenLists() and glDeleteLists()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11789 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+8
-5
@@ -56,6 +56,7 @@ double gl_width(uchar c) {return fl_width(c);}
|
|||||||
|
|
||||||
static Fl_Font_Descriptor *gl_fontsize;
|
static Fl_Font_Descriptor *gl_fontsize;
|
||||||
|
|
||||||
|
#define GENLISTSIZE 256
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
# define USE_OksiD_style_GL_font_selection 1 // Most hosts except OSX
|
# define USE_OksiD_style_GL_font_selection 1 // Most hosts except OSX
|
||||||
#endif
|
#endif
|
||||||
@@ -74,7 +75,9 @@ void gl_font(int fontid, int size) {
|
|||||||
if (!fl_fontsize->listbase) {
|
if (!fl_fontsize->listbase) {
|
||||||
|
|
||||||
#ifdef USE_OksiD_style_GL_font_selection
|
#ifdef USE_OksiD_style_GL_font_selection
|
||||||
fl_fontsize->listbase = glGenLists(0x10000);
|
#undef GENLISTSIZE
|
||||||
|
#define GENLISTSIZE 0x10000
|
||||||
|
fl_fontsize->listbase = glGenLists(GENLISTSIZE);
|
||||||
#else // Fltk-1.1.8 style GL font selection
|
#else // Fltk-1.1.8 style GL font selection
|
||||||
|
|
||||||
#if defined (USE_X11) // X-windows options follow, either XFT or "plain" X
|
#if defined (USE_X11) // X-windows options follow, either XFT or "plain" X
|
||||||
@@ -87,14 +90,14 @@ void gl_font(int fontid, int size) {
|
|||||||
XFontStruct *font = fl_X_core_font();
|
XFontStruct *font = fl_X_core_font();
|
||||||
int base = font->min_char_or_byte2;
|
int base = font->min_char_or_byte2;
|
||||||
int count = font->max_char_or_byte2-base+1;
|
int count = font->max_char_or_byte2-base+1;
|
||||||
fl_fontsize->listbase = glGenLists(256);
|
fl_fontsize->listbase = glGenLists(GENLISTSIZE);
|
||||||
glXUseXFont(font->fid, base, count, fl_fontsize->listbase+base);
|
glXUseXFont(font->fid, base, count, fl_fontsize->listbase+base);
|
||||||
# elif defined(WIN32)
|
# elif defined(WIN32)
|
||||||
// this is unused because USE_OksiD_style_GL_font_selection == 1
|
// this is unused because USE_OksiD_style_GL_font_selection == 1
|
||||||
int base = fl_fontsize->metr.tmFirstChar;
|
int base = fl_fontsize->metr.tmFirstChar;
|
||||||
int count = fl_fontsize->metr.tmLastChar-base+1;
|
int count = fl_fontsize->metr.tmLastChar-base+1;
|
||||||
HFONT oldFid = (HFONT)SelectObject(fl_gc, fl_fontsize->fid);
|
HFONT oldFid = (HFONT)SelectObject(fl_gc, fl_fontsize->fid);
|
||||||
fl_fontsize->listbase = glGenLists(256);
|
fl_fontsize->listbase = glGenLists(GENLISTSIZE);
|
||||||
wglUseFontBitmaps(fl_gc, base, count, fl_fontsize->listbase+base);
|
wglUseFontBitmaps(fl_gc, base, count, fl_fontsize->listbase+base);
|
||||||
SelectObject(fl_gc, oldFid);
|
SelectObject(fl_gc, oldFid);
|
||||||
# endif
|
# endif
|
||||||
@@ -154,8 +157,8 @@ void gl_remove_displaylist_fonts()
|
|||||||
past->next = f->next;
|
past->next = f->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// It would be nice if this next line was in a desctructor somewhere
|
// It would be nice if this next line was in a destructor somewhere
|
||||||
glDeleteLists(f->listbase, 256);
|
glDeleteLists(f->listbase, GENLISTSIZE);
|
||||||
|
|
||||||
Fl_Font_Descriptor* tmp = f;
|
Fl_Font_Descriptor* tmp = f;
|
||||||
f = f->next;
|
f = f->next;
|
||||||
|
|||||||
Reference in New Issue
Block a user