Use Fl_Graphics_Driver::default_driver() when convenient.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12088 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
f08c414485
commit
c530cdeda6
@ -759,7 +759,7 @@ inline void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int
|
||||
\returns 1 if true alpha blending supported by platform
|
||||
\returns 0 not supported so FLTK will use screen door transparency
|
||||
*/
|
||||
inline char fl_can_do_alpha_blending() {return Fl_Display_Device::display_device()->driver()->can_do_alpha_blending();}
|
||||
inline char fl_can_do_alpha_blending() {return Fl_Graphics_Driver::default_driver().can_do_alpha_blending();}
|
||||
|
||||
FL_EXPORT uchar *fl_read_image(uchar *p,int X,int Y,int W,int H,int alpha=0);
|
||||
|
||||
|
@ -34,7 +34,7 @@ Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
|
||||
}
|
||||
|
||||
void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
return Fl_Display_Device::display_device()->driver()->delete_bitmask(bm);
|
||||
return Fl_Graphics_Driver::default_driver().delete_bitmask(bm);
|
||||
}
|
||||
|
||||
// Create a 1-bit mask used for alpha blending
|
||||
|
@ -314,7 +314,7 @@ Fl_RGB_Image::~Fl_RGB_Image() {
|
||||
}
|
||||
|
||||
void Fl_RGB_Image::uncache() {
|
||||
Fl_Display_Device::display_device()->driver()->uncache(this, id_, mask_);
|
||||
Fl_Graphics_Driver::default_driver().uncache(this, id_, mask_);
|
||||
}
|
||||
|
||||
Fl_Image *Fl_RGB_Image::copy(int W, int H) {
|
||||
|
@ -79,7 +79,7 @@ Fl_Pixmap::~Fl_Pixmap() {
|
||||
|
||||
void Fl_Pixmap::uncache() {
|
||||
if (id_) {
|
||||
Fl_Display_Device::display_device()->driver()->uncache_pixmap(id_);
|
||||
Fl_Graphics_Driver::default_driver().uncache_pixmap(id_);
|
||||
id_ = 0;
|
||||
}
|
||||
|
||||
|
@ -3245,7 +3245,7 @@ void Fl_Cocoa_Window_Driver::make_current()
|
||||
q_release_context();
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
fl_window = i->xid;
|
||||
((Fl_Quartz_Graphics_Driver*)Fl_Display_Device::display_device()->driver())->high_resolution( mapped_to_retina() );
|
||||
((Fl_Quartz_Graphics_Driver&)Fl_Graphics_Driver::default_driver()).high_resolution( mapped_to_retina() );
|
||||
|
||||
NSGraphicsContext *nsgc;
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
@ -3255,7 +3255,7 @@ void Fl_Cocoa_Window_Driver::make_current()
|
||||
#endif
|
||||
nsgc = through_Fl_X_flush ? [NSGraphicsContext currentContext] : [NSGraphicsContext graphicsContextWithWindow:fl_window];
|
||||
gc = (CGContextRef)[nsgc graphicsPort];
|
||||
Fl_Display_Device::display_device()->driver()->gc(gc);
|
||||
Fl_Graphics_Driver::default_driver().gc(gc);
|
||||
CGContextSaveGState(gc); // native context
|
||||
// antialiasing must be deactivated because it applies to rectangles too
|
||||
// and escapes even clipping!!!
|
||||
@ -3283,13 +3283,13 @@ void Fl_Cocoa_Window_Driver::make_current()
|
||||
|
||||
// Give the Quartz context back to the system
|
||||
void Fl_Cocoa_Window_Driver::q_release_context(Fl_Cocoa_Window_Driver *x) {
|
||||
CGContextRef gc = (CGContextRef)Fl_Display_Device::display_device()->driver()->gc();
|
||||
CGContextRef gc = (CGContextRef)Fl_Graphics_Driver::default_driver().gc();
|
||||
if (x && x->shown() && x->gc != gc) return;
|
||||
if (!gc) return;
|
||||
CGContextRestoreGState(gc); // match the CGContextSaveGState's of make_current
|
||||
CGContextRestoreGState(gc);
|
||||
CGContextFlush(gc);
|
||||
Fl_Display_Device::display_device()->driver()->gc(0);
|
||||
Fl_Graphics_Driver::default_driver().gc(0);
|
||||
#if defined(FLTK_USE_CAIRO)
|
||||
if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0); // capture gc changes automatically to update the cairo context adequately
|
||||
#endif
|
||||
|
@ -2267,13 +2267,13 @@ HWND fl_window = NULL;
|
||||
|
||||
// Here we ensure only one GetDC is ever in place.
|
||||
HDC fl_GetDC(HWND w) {
|
||||
HDC gc = (HDC)Fl_Display_Device::display_device()->driver()->gc();
|
||||
HDC gc = (HDC)Fl_Graphics_Driver::default_driver().gc();
|
||||
if (gc) {
|
||||
if (w == fl_window && fl_window != NULL) return gc;
|
||||
if (fl_window) fl_release_dc(fl_window, gc); // ReleaseDC
|
||||
}
|
||||
gc = GetDC(w);
|
||||
Fl_Display_Device::display_device()->driver()->gc(gc);
|
||||
Fl_Graphics_Driver::default_driver().gc(gc);
|
||||
fl_save_dc(w, gc);
|
||||
fl_window = w;
|
||||
// calling GetDC seems to always reset these: (?)
|
||||
|
@ -616,7 +616,7 @@ void Fl_X11_Screen_Driver::open_display() {
|
||||
fl_open_display(d);
|
||||
// the unique GC used by all X windows
|
||||
GC gc = XCreateGC(fl_display, RootWindow(fl_display, fl_screen), 0, 0);
|
||||
Fl_Display_Device::display_device()->driver()->gc(gc);
|
||||
Fl_Graphics_Driver::default_driver().gc(gc);
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,7 +136,7 @@ void Fl_Cocoa_Screen_Driver::beep(int type) {
|
||||
|
||||
|
||||
void Fl_Cocoa_Screen_Driver::flush() {
|
||||
CGContextRef gc = (CGContextRef)Fl_Display_Device::display_device()->driver()->gc();
|
||||
CGContextRef gc = (CGContextRef)Fl_Graphics_Driver::default_driver().gc();
|
||||
if (gc)
|
||||
CGContextFlush(gc);
|
||||
}
|
||||
|
@ -903,36 +903,36 @@ static const char *_fontNames[] = {
|
||||
};
|
||||
|
||||
void Fl_PostScript_Graphics_Driver::font(int f, int s) {
|
||||
Fl_Graphics_Driver *driver = Fl_Display_Device::display_device()->driver();
|
||||
driver->font(f,s); // Use display fonts for font measurement
|
||||
Fl_Graphics_Driver& driver = Fl_Graphics_Driver::default_driver();
|
||||
driver.font(f,s); // Use display fonts for font measurement
|
||||
Fl_Graphics_Driver::font(f, s);
|
||||
Fl_Font_Descriptor *desc = driver->font_descriptor();
|
||||
Fl_Font_Descriptor *desc = driver.font_descriptor();
|
||||
this->font_descriptor(desc);
|
||||
if (f < FL_FREE_FONT) {
|
||||
fprintf(output, "/%s SF\n" , _fontNames[f]);
|
||||
float ps_size = driver->scale_font_for_PostScript(desc, s);
|
||||
float ps_size = driver.scale_font_for_PostScript(desc, s);
|
||||
clocale_printf("%.1f FS\n", ps_size);
|
||||
}
|
||||
}
|
||||
|
||||
double Fl_PostScript_Graphics_Driver::width(const char *s, int n) {
|
||||
return Fl_Display_Device::display_device()->driver()->width(s, n);
|
||||
return Fl_Graphics_Driver::default_driver().width(s, n);
|
||||
}
|
||||
|
||||
double Fl_PostScript_Graphics_Driver::width(unsigned u) {
|
||||
return Fl_Display_Device::display_device()->driver()->width(u);
|
||||
return Fl_Graphics_Driver::default_driver().width(u);
|
||||
}
|
||||
|
||||
int Fl_PostScript_Graphics_Driver::height() {
|
||||
return Fl_Display_Device::display_device()->driver()->height();
|
||||
return Fl_Graphics_Driver::default_driver().height();
|
||||
}
|
||||
|
||||
int Fl_PostScript_Graphics_Driver::descent() {
|
||||
return Fl_Display_Device::display_device()->driver()->descent();
|
||||
return Fl_Graphics_Driver::default_driver().descent();
|
||||
}
|
||||
|
||||
void Fl_PostScript_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
|
||||
Fl_Display_Device::display_device()->driver()->text_extents(c, n, dx, dy, w, h);
|
||||
Fl_Graphics_Driver::default_driver().text_extents(c, n, dx, dy, w, h);
|
||||
}
|
||||
|
||||
|
||||
@ -998,7 +998,7 @@ static uchar *calc_mask(uchar *img, int w, int h, Fl_Color bg)
|
||||
void Fl_PostScript_Graphics_Driver::transformed_draw_extra(const char* str, int n, double x, double y, int w, bool rtl)
|
||||
{
|
||||
// scale for bitmask computation is set to 1 when we can't expect to have scalable fonts
|
||||
float scale = Fl_Display_Device::display_device()->driver()->scale_bitmap_for_PostScript();
|
||||
float scale = Fl_Graphics_Driver::default_driver().scale_bitmap_for_PostScript();
|
||||
Fl_Fontsize old_size = size();
|
||||
Fl_Font fontnum = Fl_Graphics_Driver::font();
|
||||
int w_scaled = (int)(w * (scale + 0.5));
|
||||
|
@ -56,7 +56,7 @@ int Fl_WinAPI_Screen_Driver::visual(int flags)
|
||||
{
|
||||
fl_GetDC(0);
|
||||
if (flags & FL_DOUBLE) return 0;
|
||||
HDC gc = (HDC)Fl_Display_Device::display_device()->driver()->gc();
|
||||
HDC gc = (HDC)Fl_Graphics_Driver::default_driver().gc();
|
||||
if (!(flags & FL_INDEX) &&
|
||||
GetDeviceCaps(gc,BITSPIXEL) <= 8) return 0;
|
||||
if ((flags & FL_RGB8) && GetDeviceCaps(gc,BITSPIXEL)<24) return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user