diff options
| author | Manolo Gouy <Manolo> | 2016-09-23 07:47:57 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-09-23 07:47:57 +0000 |
| commit | 63e33b1be3e2af253cd8adf10a5eac7e72a5fc7e (patch) | |
| tree | cd0aa1d9ae7cdf6b67e01245d82231c5245bdf2d /src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx | |
| parent | 0e336558537bd0af1c3bb2434a277091824e637c (diff) | |
Fl_Quartz_Graphics_Driver: separate CoreText- and ATSU-based code using new, derived classes.
FLTK for the Mac OS platform draws text using 2 distinct system APIs depending on the
version of the running OS. Classes Fl_CoreText_Graphics_Driver and Fl_ATSU_Graphics_Driver are defined
and implement the same virtual functions of class Fl_Quartz_Graphics_Driver using
CoreText and ATSU, respectively. The app allocates an object of one of these derived
classes according to the running OS version.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11967 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx')
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx index 8d5cff37b..fd31e7030 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx @@ -19,6 +19,7 @@ #include "../../config_lib.h" #include "Fl_Quartz_Graphics_Driver.H" +#include "../Darwin/Fl_Darwin_System_Driver.H" #include <FL/x.H> /* @@ -27,7 +28,20 @@ */ Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() { - return new Fl_Quartz_Graphics_Driver(); +#if HAS_ATSU + static int option = 0; // 0: not initialized, 1: use CoreText, 2: use ATSU + if (!option) { + option = 2; + if (Fl_Darwin_System_Driver::calc_mac_os_version() >= Fl_Quartz_Graphics_Driver::CoreText_threshold) { + option = 1; + } + } + if (option == 2) return new Fl_ATSU_Graphics_Driver(); +#endif // HAS_ATSU +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + return new Fl_CoreText_Graphics_Driver(); +#endif + return NULL; // should not happen } char Fl_Quartz_Graphics_Driver::can_do_alpha_blending() { |
