From 5b5ba880f5c517eb2206c63b3def45ce60cc7136 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 26 Sep 2016 16:43:10 +0000 Subject: MacOS platform: the printer's graphics driver should also call Fl_Graphics_Driver::newMainGraphicsDriver() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11982 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Makefile | 1 - src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm | 6 ++++-- src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 271ce867d..0e767b404 100644 --- a/src/Makefile +++ b/src/Makefile @@ -223,7 +223,6 @@ QUARTZCPPFILES = \ drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx \ drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx \ drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx \ - drivers/Quartz/Fl_Quartz_Printer_Graphics_Driver.cxx \ drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx \ drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx \ drivers/Quartz/Fl_Quartz_Copy_Surface_Driver.cxx \ diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm index 5c0e7ba75..e5fb88ff1 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm @@ -19,7 +19,7 @@ #include #include #include -#include "../Quartz/Fl_Quartz_Printer_Graphics_Driver.H" +#include "../Quartz/Fl_Quartz_Graphics_Driver.H" #include "../Darwin/Fl_Darwin_System_Driver.H" #include "Fl_Cocoa_Window_Driver.H" @@ -81,7 +81,9 @@ Fl_Cocoa_Printer_Driver::Fl_Cocoa_Printer_Driver(void) x_offset = 0; y_offset = 0; scale_x = scale_y = 1.; - driver(new Fl_Quartz_Printer_Graphics_Driver); + Fl_Quartz_Graphics_Driver *d = (Fl_Quartz_Graphics_Driver*)Fl_Graphics_Driver::newMainGraphicsDriver(); + d->is_printer_ = Fl_Graphics_Driver::PRINTER; + driver(d); } Fl_Paged_Device* Fl_Paged_Device::newPrinterDriver(void) diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H index 216554f86..b46b94000 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H @@ -41,20 +41,23 @@ struct Fl_Fontdesc; */ class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver { friend class Fl_Font_Descriptor; + friend class Fl_Cocoa_Printer_Driver; protected: CGContextRef gc_; int p_size; typedef struct { float x; float y; } XPOINT; XPOINT *p; bool high_resolution_; + driver_feature is_printer_; // protected constructor to ensure only derived classes are allocated Fl_Quartz_Graphics_Driver() : Fl_Graphics_Driver(), gc_(NULL), p_size(0), p(NULL) { high_resolution_ = false; + is_printer_ = (driver_feature)0; } public: static const int CoreText_threshold; // min Mac OS version for CoreText virtual ~Fl_Quartz_Graphics_Driver() { if (p) free(p); } - virtual int has_feature(driver_feature mask) { return mask & NATIVE; } + virtual int has_feature(driver_feature mask) { return mask & (NATIVE | is_printer_); } virtual void gc(void *ctxt) {if (ctxt != gc_) global_gc(); gc_ = (CGContextRef)ctxt; } virtual void *gc() {return gc_;} char can_do_alpha_blending(); -- cgit v1.2.3