summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2010-04-06 17:38:27 +0000
committerManolo Gouy <Manolo>2010-04-06 17:38:27 +0000
commit24b8386bf18f0ae1b07b3126e4ef90d80064fd8c (patch)
tree598971eeefe856fd559db77670e67f01ec1c6067 /src
parentf44190d356137367367aeb5ac00fd48c133f0a60 (diff)
Fl_Gl_Device_Plugin: more device-independant API
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7458 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Abstract_Printer.cxx6
-rw-r--r--src/Fl_Gl_Device_Plugin.cxx18
2 files changed, 10 insertions, 14 deletions
diff --git a/src/Fl_Abstract_Printer.cxx b/src/Fl_Abstract_Printer.cxx
index e36758d34..0490dcc68 100644
--- a/src/Fl_Abstract_Printer.cxx
+++ b/src/Fl_Abstract_Printer.cxx
@@ -66,7 +66,11 @@ void Fl_Abstract_Printer::print_widget(Fl_Widget* widget, int delta_x, int delta
if (widget->as_gl_window()) {
Fl_Plugin_Manager pm("fltk:device");
Fl_Device_Plugin *pi = (Fl_Device_Plugin*)pm.plugin("opengl.device.fltk.org");
- if (pi) drawn_by_plugin = pi->print(this, widget, 0, 0);
+ if (pi) {
+ int width, height;
+ this->printable_rect(&width, &height);
+ drawn_by_plugin = pi->print(widget, 0, 0, height);
+ }
}
if (!drawn_by_plugin) {
widget->draw();
diff --git a/src/Fl_Gl_Device_Plugin.cxx b/src/Fl_Gl_Device_Plugin.cxx
index f8e1e1021..f8fc3f8f6 100644
--- a/src/Fl_Gl_Device_Plugin.cxx
+++ b/src/Fl_Gl_Device_Plugin.cxx
@@ -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
, 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
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;
}
};