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
This commit is contained in:
Manolo Gouy 2016-09-26 16:43:10 +00:00
parent 45e6be7316
commit 5b5ba880f5
3 changed files with 8 additions and 4 deletions

View File

@ -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 \

View File

@ -19,7 +19,7 @@
#include <FL/Fl_Printer.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Window_Driver.H>
#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)

View File

@ -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();