diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 95419af07..a2e12df5c 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -4287,7 +4287,7 @@ static CALayer *get_titlebar_layer(Fl_Window *win) } -void Fl_Cocoa_Screen_Driver::draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h) +void Fl_Cocoa_Window_Driver::draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 CGContextSaveGState(gc); @@ -4315,7 +4315,7 @@ void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, CGColorSpaceRelease(cspace); CGContextScaleCTM(auxgc, 2, 2); if (layer) { - Fl_Cocoa_Screen_Driver::draw_layer_to_context(layer, auxgc, w(), htop); + Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, auxgc, w(), htop); } else { CGImageRef img = Fl_X::CGImage_from_window_rect(pWindow, 0, -htop, w(), htop); CGContextSaveGState(auxgc); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm index 30fec61e1..3d53e579b 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm +++ b/src/drivers/Cocoa/Fl_Cocoa_Printer_Driver.mm @@ -21,7 +21,7 @@ #include #include "../Quartz/Fl_Quartz_Printer_Graphics_Driver.H" #include "../Darwin/Fl_Darwin_System_Driver.H" -#include "Fl_Cocoa_Screen_Driver.H" +#include "Fl_Cocoa_Window_Driver.H" #include #include @@ -404,7 +404,7 @@ void Fl_Cocoa_Printer_Driver::draw_decorated_window(Fl_Window *win, int x_offset CGContextSaveGState(gc); CGContextTranslateCTM(gc, x_offset - 0.5, y_offset + bt - 0.5); CGContextScaleCTM(gc, 1, -1); - Fl_Cocoa_Screen_Driver::draw_layer_to_context(layer, gc, win->w(), bt); + Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, gc, win->w(), bt); CGContextRestoreGState(gc); } else { @@ -412,7 +412,7 @@ void Fl_Cocoa_Printer_Driver::draw_decorated_window(Fl_Window *win, int x_offset CGContextRef gc = CGBitmapContextCreate(NULL, 2*win->w(), 2*bt, 8, 0, cspace, kCGImageAlphaPremultipliedLast); CGColorSpaceRelease(cspace); CGContextScaleCTM(gc, 2, 2); - Fl_Cocoa_Screen_Driver::draw_layer_to_context(layer, gc, win->w(), bt); + Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, gc, win->w(), bt); Fl_RGB_Image *image = new Fl_RGB_Image((const uchar*)CGBitmapContextGetData(gc), 2*win->w(), 2*bt, 4, CGBitmapContextGetBytesPerRow(gc)); // 10.2 int ori_x, ori_y; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 063985b7e..59cd6ce1e 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -26,7 +26,6 @@ #define FL_COCOA_SCREEN_DRIVER_H #include -#include /* Move everything here that manages the native screen interface. @@ -40,12 +39,6 @@ class Fl_Window; -#ifdef __OBJC__ -@class CALayer; -#else -class CALayer; -#endif // __OBJC__ - class FL_EXPORT Fl_Cocoa_Screen_Driver : public Fl_Screen_Driver { @@ -93,7 +86,6 @@ public: int insertion_point_location(int *px, int *py, int *pheight); virtual int dnd(int use_selection); virtual int compose(int &del); - static void draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h); }; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index a9bc4b68a..0e4244ba7 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -30,6 +30,12 @@ class Fl_Image; class Fl_Window; +#ifdef __OBJC__ +@class CALayer; +#else +class CALayer; +#endif // __OBJC__ + /* Move everything here that manages the native window interface. @@ -91,6 +97,7 @@ public: virtual void capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right); //this one is in Fl_cocoa.mm because it uses Objective-c virtual void wait_for_expose(); + static void draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h); };