|
|
|
@ -40,7 +40,7 @@ static void imgProviderReleaseData (void *info, const void *data, size_t size)
@@ -40,7 +40,7 @@ static void imgProviderReleaseData (void *info, const void *data, size_t size)
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
static void print_gl_window(Fl_Abstract_Printer *printer, Fl_Gl_Window *glw, int x, int y) |
|
|
|
|
static void print_gl_window(Fl_Gl_Window *glw, int x, int y, int height) |
|
|
|
|
{ |
|
|
|
|
#ifdef WIN32 |
|
|
|
|
HDC save_gc = fl_gc; |
|
|
|
@ -105,11 +105,9 @@ static void print_gl_window(Fl_Abstract_Printer *printer, Fl_Gl_Window *glw, int
@@ -105,11 +105,9 @@ static void print_gl_window(Fl_Abstract_Printer *printer, Fl_Gl_Window *glw, int
|
|
|
|
|
, provider, NULL, false, kCGRenderingIntentDefault); |
|
|
|
|
if(image == NULL) return; |
|
|
|
|
CGContextSaveGState(fl_gc); |
|
|
|
|
int w, h; |
|
|
|
|
printer->printable_rect(&w, &h); |
|
|
|
|
CGContextTranslateCTM(fl_gc, 0, h); |
|
|
|
|
CGContextTranslateCTM(fl_gc, 0, height); |
|
|
|
|
CGContextScaleCTM(fl_gc, 1.0f, -1.0f); |
|
|
|
|
CGRect rect = { { x, h - y - glw->h() }, { glw->w(), glw->h() } }; |
|
|
|
|
CGRect rect = { { x, height - y - glw->h() }, { glw->w(), glw->h() } }; |
|
|
|
|
Fl_X::q_begin_image(rect, 0, 0, glw->w(), glw->h()); |
|
|
|
|
CGContextDrawImage(fl_gc, rect, image); |
|
|
|
|
Fl_X::q_end_image(); |
|
|
|
@ -130,17 +128,11 @@ static void print_gl_window(Fl_Abstract_Printer *printer, Fl_Gl_Window *glw, int
@@ -130,17 +128,11 @@ static void print_gl_window(Fl_Abstract_Printer *printer, Fl_Gl_Window *glw, int
|
|
|
|
|
class Fl_Gl_Device_Plugin : public Fl_Device_Plugin { |
|
|
|
|
public: |
|
|
|
|
Fl_Gl_Device_Plugin() : Fl_Device_Plugin(name()) { } |
|
|
|
|
/** \brief Returns the plugin name */ |
|
|
|
|
virtual const char *name() { return "opengl.device.fltk.org"; } |
|
|
|
|
/** \brief Prints a widget
|
|
|
|
|
\param p the printer |
|
|
|
|
\param w the widget |
|
|
|
|
\param x,y offsets where to print relatively to coordinates origin |
|
|
|
|
*/ |
|
|
|
|
virtual int print(Fl_Abstract_Printer *p, Fl_Widget *w, int x, int y) { |
|
|
|
|
virtual int print(Fl_Widget *w, int x, int y, int height) { |
|
|
|
|
Fl_Gl_Window *glw = w->as_gl_window(); |
|
|
|
|
if (!glw) return 0; |
|
|
|
|
print_gl_window(p, glw, x, y); |
|
|
|
|
print_gl_window(glw, x, y, height); |
|
|
|
|
return 1;
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|