Implement Fl_Quartz_Copy_Surface_Driver::draw_decorated_window()
The window title is copied in vectorial form when the titlebar is layer-backed.
This commit is contained in:
parent
277cee73b0
commit
b2c027fa83
@ -64,6 +64,7 @@ public:
|
||||
void origin(int *x, int *y);
|
||||
void origin(int x, int y);
|
||||
int printable_rect(int *w, int *h);
|
||||
virtual void draw_decorated_window(Fl_Window *win, int x_offset, int y_offset);
|
||||
};
|
||||
|
||||
|
||||
@ -91,6 +92,7 @@ protected:
|
||||
virtual void set_current() = 0;
|
||||
virtual void translate(int x, int y) = 0;
|
||||
virtual void untranslate() = 0;
|
||||
virtual void draw_decorated_window(Fl_Window *win, int x_offset, int y_offset);
|
||||
int printable_rect(int *w, int *h);
|
||||
/** Each platform implements this function its own way.
|
||||
It returns an object implementing all virtual functions
|
||||
|
@ -63,6 +63,10 @@ int Fl_Copy_Surface::printable_rect(int *w, int *h) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Fl_Copy_Surface::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) {
|
||||
if (platform_surface) platform_surface->draw_decorated_window(win, x_offset, y_offset);
|
||||
}
|
||||
|
||||
/**
|
||||
\cond DriverDev
|
||||
\addtogroup DriverDeveloper
|
||||
@ -72,6 +76,11 @@ int Fl_Copy_Surface_Driver::printable_rect(int *w, int *h) {
|
||||
*w = width; *h = height;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Fl_Copy_Surface_Driver::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) {
|
||||
Fl_Widget_Surface::draw_decorated_window(win, x_offset, y_offset);
|
||||
}
|
||||
|
||||
/**
|
||||
\}
|
||||
\endcond
|
||||
|
@ -37,6 +37,7 @@ protected:
|
||||
void set_current();
|
||||
void translate(int x, int y);
|
||||
void untranslate();
|
||||
virtual void draw_decorated_window(Fl_Window *win, int x_offset, int y_offset);
|
||||
};
|
||||
|
||||
#endif /* Fl_Quartz_Copy_Surface_Driver_H */
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <FL/platform.H>
|
||||
#include "Fl_Quartz_Graphics_Driver.H"
|
||||
#include "Fl_Quartz_Copy_Surface_Driver.H"
|
||||
#include "../Cocoa/Fl_Cocoa_Window_Driver.H"
|
||||
|
||||
/**
|
||||
\cond DriverDev
|
||||
@ -98,6 +99,22 @@ void Fl_Quartz_Copy_Surface_Driver::untranslate() {
|
||||
CGContextRestoreGState(gc);
|
||||
}
|
||||
|
||||
void Fl_Quartz_Copy_Surface_Driver::draw_decorated_window(Fl_Window *win, int x_offset, int y_offset) {
|
||||
CALayer *layer = Fl_Cocoa_Window_Driver::driver(win)->get_titlebar_layer();
|
||||
if (!layer) {
|
||||
return Fl_Widget_Surface::draw_decorated_window(win, x_offset, y_offset);
|
||||
}
|
||||
CGContextRef gc = (CGContextRef)driver()->gc();
|
||||
CGContextSaveGState(gc);
|
||||
int bt = win->decorated_h() - win->h();
|
||||
CGContextTranslateCTM(gc, x_offset - 0.5, y_offset + bt - 0.5);
|
||||
float s = Fl::screen_scale(win->screen_num());
|
||||
CGContextScaleCTM(gc, 1/s, s >= 1 ? -1/s : -1);
|
||||
Fl_Cocoa_Window_Driver::draw_layer_to_context(layer, gc, win->w() * s, bt);
|
||||
CGContextRestoreGState(gc);
|
||||
draw(win, x_offset, y_offset + bt); // print the window inner part
|
||||
}
|
||||
|
||||
#endif // FL_CFG_GFX_QUARTZ
|
||||
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user