From 868ab9696fb51628afac1ea10f7df6a27907a089 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 14 Feb 2023 11:52:21 +0100 Subject: Rename class Fl_Display_Cairo_Graphics_Driver to Fl_X11_Cairo_Graphics_Driver --- .../Cairo/Fl_Display_Cairo_Graphics_Driver.H | 37 ------------- .../Cairo/Fl_Display_Cairo_Graphics_Driver.cxx | 64 ---------------------- src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.H | 37 +++++++++++++ src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx | 64 ++++++++++++++++++++++ src/drivers/Wayland/fl_wayland_platform_init.cxx | 6 +- src/drivers/X11/Fl_X11_Window_Driver.cxx | 8 +-- src/drivers/X11/fl_X11_platform_init.cxx | 6 +- src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx | 10 ++-- src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx | 10 ++-- 9 files changed, 121 insertions(+), 121 deletions(-) delete mode 100644 src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.H delete mode 100644 src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.cxx create mode 100644 src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.H create mode 100644 src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx (limited to 'src/drivers') diff --git a/src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.H b/src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.H deleted file mode 100644 index 7c514b1cf..000000000 --- a/src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.H +++ /dev/null @@ -1,37 +0,0 @@ -// -// Support for using Cairo to draw into X11 windows for the Fast Light Tool Kit (FLTK). -// -// Copyright 2022 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// https://www.fltk.org/COPYING.php -// -// Please see the following page on how to report bugs and issues: -// -// https://www.fltk.org/bugs.php -// - -/* \file - Declaration of class Fl_Display_Cairo_Graphics_Driver. -*/ - -#ifndef FL_DISPLAY_CAIRO_GRAPHICS_DRIVER_H -# define FL_DISPLAY_CAIRO_GRAPHICS_DRIVER_H - -#include "Fl_Cairo_Graphics_Driver.H" - -class Fl_Display_Cairo_Graphics_Driver : public Fl_Cairo_Graphics_Driver { -private: - static void *gc_; -public: - void scale(float f) FL_OVERRIDE; - float scale() {return Fl_Graphics_Driver::scale();} - void gc(void *value) FL_OVERRIDE; - void* gc() FL_OVERRIDE; - void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) FL_OVERRIDE; - }; - -#endif // FL_DISPLAY_CAIRO_GRAPHICS_DRIVER_H diff --git a/src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.cxx deleted file mode 100644 index 02df902d8..000000000 --- a/src/drivers/Cairo/Fl_Display_Cairo_Graphics_Driver.cxx +++ /dev/null @@ -1,64 +0,0 @@ -// -// Support for using Cairo to draw into X11 windows for the Fast Light Tool Kit (FLTK). -// -// Copyright 2022 by Bill Spitzak and others. -// -// This library is free software. Distribution and use rights are outlined in -// the file "COPYING" which should have been included with this file. If this -// file is missing or damaged, see the license at: -// -// https://www.fltk.org/COPYING.php -// -// Please see the following page on how to report bugs and issues: -// -// https://www.fltk.org/bugs.php -// - -/* \file - Implementation of class Fl_Display_Cairo_Graphics_Driver . -*/ - -#include "Fl_Display_Cairo_Graphics_Driver.H" -#include -#include -#include -#include - - -void *Fl_Display_Cairo_Graphics_Driver::gc_ = NULL; -GC fl_gc; - - -ulong fl_xpixel(uchar r,uchar g,uchar b) { - return 0; -} -ulong fl_xpixel(Fl_Color i) { - return 0; -} - - -void Fl_Display_Cairo_Graphics_Driver::scale(float f) { - Fl_Graphics_Driver::scale(f); - if (cairo_) { - cairo_restore(cairo_); - cairo_save(cairo_); - cairo_scale(cairo_, f, f); - cairo_translate(cairo_, 0.5, 0.5); - } -} - - -void Fl_Display_Cairo_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { - XCopyArea(fl_display, pixmap, fl_window, (GC)Fl_Graphics_Driver::default_driver().gc(), int(srcx*scale()), int(srcy*scale()), int(w*scale()), int(h*scale()), int(x*scale()), int(y*scale())); -} - - -void Fl_Display_Cairo_Graphics_Driver::gc(void *value) { - gc_ = value; - fl_gc = (GC)gc_; -} - - -void *Fl_Display_Cairo_Graphics_Driver::gc() { - return gc_; -} diff --git a/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.H b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.H new file mode 100644 index 000000000..3ac7ca88a --- /dev/null +++ b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.H @@ -0,0 +1,37 @@ +// +// Support for using Cairo to draw into X11 windows for the Fast Light Tool Kit (FLTK). +// +// Copyright 2022-2023 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +/* \file + Declaration of class Fl_X11_Cairo_Graphics_Driver. +*/ + +#ifndef FL_DISPLAY_CAIRO_GRAPHICS_DRIVER_H +# define FL_DISPLAY_CAIRO_GRAPHICS_DRIVER_H + +#include "Fl_Cairo_Graphics_Driver.H" + +class Fl_X11_Cairo_Graphics_Driver : public Fl_Cairo_Graphics_Driver { +private: + static void *gc_; +public: + void scale(float f) FL_OVERRIDE; + float scale() {return Fl_Graphics_Driver::scale();} + void gc(void *value) FL_OVERRIDE; + void* gc() FL_OVERRIDE; + void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) FL_OVERRIDE; + }; + +#endif // FL_DISPLAY_CAIRO_GRAPHICS_DRIVER_H diff --git a/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx new file mode 100644 index 000000000..d673c3dfa --- /dev/null +++ b/src/drivers/Cairo/Fl_X11_Cairo_Graphics_Driver.cxx @@ -0,0 +1,64 @@ +// +// Support for using Cairo to draw into X11 windows for the Fast Light Tool Kit (FLTK). +// +// Copyright 2022-2023 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +/* \file + Implementation of class Fl_X11_Cairo_Graphics_Driver. +*/ + +#include "Fl_X11_Cairo_Graphics_Driver.H" +#include +#include +#include +#include + + +void *Fl_X11_Cairo_Graphics_Driver::gc_ = NULL; +GC fl_gc; + + +ulong fl_xpixel(uchar r,uchar g,uchar b) { + return 0; +} +ulong fl_xpixel(Fl_Color i) { + return 0; +} + + +void Fl_X11_Cairo_Graphics_Driver::scale(float f) { + Fl_Graphics_Driver::scale(f); + if (cairo_) { + cairo_restore(cairo_); + cairo_save(cairo_); + cairo_scale(cairo_, f, f); + cairo_translate(cairo_, 0.5, 0.5); + } +} + + +void Fl_X11_Cairo_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { + XCopyArea(fl_display, pixmap, fl_window, (GC)Fl_Graphics_Driver::default_driver().gc(), int(srcx*scale()), int(srcy*scale()), int(w*scale()), int(h*scale()), int(x*scale()), int(y*scale())); +} + + +void Fl_X11_Cairo_Graphics_Driver::gc(void *value) { + gc_ = value; + fl_gc = (GC)gc_; +} + + +void *Fl_X11_Cairo_Graphics_Driver::gc() { + return gc_; +} diff --git a/src/drivers/Wayland/fl_wayland_platform_init.cxx b/src/drivers/Wayland/fl_wayland_platform_init.cxx index 5154e6232..9b6be2878 100644 --- a/src/drivers/Wayland/fl_wayland_platform_init.cxx +++ b/src/drivers/Wayland/fl_wayland_platform_init.cxx @@ -1,7 +1,7 @@ // // Wayland-specific code to initialize wayland support. // -// Copyright 2022 by Bill Spitzak and others. +// Copyright 2022-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -24,7 +24,7 @@ #ifdef FLTK_USE_X11 # include "../Xlib/Fl_Xlib_Copy_Surface_Driver.H" # include -# include "../Cairo/Fl_Display_Cairo_Graphics_Driver.H" +# include "../Cairo/Fl_X11_Cairo_Graphics_Driver.H" # include "../X11/Fl_X11_Screen_Driver.H" # include "../X11/Fl_X11_Window_Driver.H" # include "../Xlib/Fl_Xlib_Image_Surface_Driver.H" @@ -119,7 +119,7 @@ Fl_System_Driver *Fl_System_Driver::newSystemDriver() { Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { #ifdef FLTK_USE_X11 - if (!attempt_wayland()) return new Fl_Display_Cairo_Graphics_Driver(); + if (!attempt_wayland()) return new Fl_X11_Cairo_Graphics_Driver(); #endif return new Fl_Wayland_Graphics_Driver(); } diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 531886f7a..7285bc152 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -20,7 +20,7 @@ #include "Fl_X11_Screen_Driver.H" #if FLTK_USE_CAIRO # include -# include "../Cairo/Fl_Display_Cairo_Graphics_Driver.H" +# include "../Cairo/Fl_X11_Cairo_Graphics_Driver.H" #else # include "../Xlib/Fl_Xlib_Graphics_Driver.H" #endif // FLTK_USE_CAIRO @@ -173,7 +173,7 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay) pWindow->clear_damage(FL_DAMAGE_ALL); } #if FLTK_USE_CAIRO - ((Fl_Display_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_); + ((Fl_X11_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_); #endif if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) { fl_clip_region(i->region); i->region = 0; @@ -205,7 +205,7 @@ void Fl_X11_Window_Driver::flush_overlay() cairo_t *overlay_cairo = cairo_create(s); cairo_surface_destroy(s); cairo_save(overlay_cairo); - ((Fl_Display_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(overlay_cairo); + ((Fl_X11_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(overlay_cairo); #endif pWindow->as_overlay_window()->draw_overlay(); #if FLTK_USE_CAIRO @@ -418,7 +418,7 @@ void Fl_X11_Window_Driver::make_current() { cairo_surface_destroy(s); cairo_save(cairo_); } - ((Fl_Display_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_); + ((Fl_X11_Cairo_Graphics_Driver*)fl_graphics_driver)->set_cairo(cairo_); } fl_graphics_driver->scale(scale); #elif USE_XFT diff --git a/src/drivers/X11/fl_X11_platform_init.cxx b/src/drivers/X11/fl_X11_platform_init.cxx index 1388beefd..477978b97 100644 --- a/src/drivers/X11/fl_X11_platform_init.cxx +++ b/src/drivers/X11/fl_X11_platform_init.cxx @@ -1,7 +1,7 @@ // // X11-specific code to initialize wayland support. // -// Copyright 2022 by Bill Spitzak and others. +// Copyright 2022-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -18,7 +18,7 @@ #include #include "../Xlib/Fl_Xlib_Copy_Surface_Driver.H" #if FLTK_USE_CAIRO -# include "../Cairo/Fl_Display_Cairo_Graphics_Driver.H" +# include "../Cairo/Fl_X11_Cairo_Graphics_Driver.H" #else # include "../Xlib/Fl_Xlib_Graphics_Driver.H" #endif @@ -133,7 +133,7 @@ FL_EXPORT Fl_Fontdesc* fl_fonts = (Fl_Fontdesc*)built_in_table; Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { #if FLTK_USE_CAIRO - return new Fl_Display_Cairo_Graphics_Driver(); + return new Fl_X11_Cairo_Graphics_Driver(); #else return new Fl_Xlib_Graphics_Driver(); #endif diff --git a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx index e4bbe29ef..014314def 100644 --- a/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Copy_Surface_Driver.cxx @@ -1,7 +1,7 @@ // // Copy-to-clipboard code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -22,7 +22,7 @@ #include "../X11/Fl_X11_Screen_Driver.H" #if FLTK_USE_CAIRO # include -# include "../Cairo/Fl_Display_Cairo_Graphics_Driver.H" +# include "../Cairo/Fl_X11_Cairo_Graphics_Driver.H" # include #else # include "Fl_Xlib_Graphics_Driver.H" @@ -32,7 +32,7 @@ Fl_Xlib_Copy_Surface_Driver::Fl_Xlib_Copy_Surface_Driver(int w, int h) : Fl_Copy_Surface_Driver(w, h) { #if FLTK_USE_CAIRO - driver(new Fl_Display_Cairo_Graphics_Driver()); + driver(new Fl_X11_Cairo_Graphics_Driver()); #else driver(new Fl_Xlib_Graphics_Driver()); #endif @@ -46,7 +46,7 @@ Fl_Xlib_Copy_Surface_Driver::Fl_Xlib_Copy_Surface_Driver(int w, int h) : Fl_Copy cairo_surface_destroy(surf); cairo_scale(cairo_, 1/s, 1/s); cairo_save(cairo_); - ((Fl_Display_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); + ((Fl_X11_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); #endif driver()->push_no_clip(); fl_window = xid; @@ -78,7 +78,7 @@ void Fl_Xlib_Copy_Surface_Driver::set_current() { oldwindow = fl_window; fl_window = xid; #if FLTK_USE_CAIRO - ((Fl_Display_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); + ((Fl_X11_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); #endif } diff --git a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx index 240ced649..bcaf7d46a 100644 --- a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx @@ -1,7 +1,7 @@ // // Draw-to-image code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -19,7 +19,7 @@ #include "../../Fl_Screen_Driver.H" #if FLTK_USE_CAIRO # include -# include "../Cairo/Fl_Display_Cairo_Graphics_Driver.H" +# include "../Cairo/Fl_X11_Cairo_Graphics_Driver.H" #else # include "Fl_Xlib_Graphics_Driver.H" #endif // FLTK_USE_CAIRO @@ -38,12 +38,12 @@ Fl_Xlib_Image_Surface_Driver::Fl_Xlib_Image_Surface_Driver(int w, int h, int hig offscreen = (Fl_Offscreen)XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), w, h, fl_visual->depth); } #if FLTK_USE_CAIRO - driver(new Fl_Display_Cairo_Graphics_Driver()); + driver(new Fl_X11_Cairo_Graphics_Driver()); cairo_surface_t *s = cairo_xlib_surface_create(fl_display, offscreen, fl_visual->visual, w, h); cairo_ = cairo_create(s); cairo_surface_destroy(s); cairo_save(cairo_); - ((Fl_Display_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); + ((Fl_X11_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); #else driver(new Fl_Xlib_Graphics_Driver()); #endif @@ -63,7 +63,7 @@ void Fl_Xlib_Image_Surface_Driver::set_current() { pre_window = fl_window; fl_window = offscreen; #if FLTK_USE_CAIRO - ((Fl_Display_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); + ((Fl_X11_Cairo_Graphics_Driver*)driver())->set_cairo(cairo_); #endif } -- cgit v1.2.3