Author: manolo
Date: 2012-03-12 02:56:12 -0700 (Mon, 12 Mar 2012)
New Revision: 9277
Log:
Use a new QuartzGraphicsDriver or GDIGraphicsDriver instance when printing.

Modified:
   branches/branch-3.0/src/fltk3/DoubleWindow.cxx
   branches/branch-3.0/src/fltk3/GDIPrinter.cxx
   branches/branch-3.0/src/fltk3/cocoa.mm
   branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm

Modified: branches/branch-3.0/src/fltk3/DoubleWindow.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/DoubleWindow.cxx      2012-03-12 09:39:17 UTC 
(rev 9276)
+++ branches/branch-3.0/src/fltk3/DoubleWindow.cxx      2012-03-12 09:56:12 UTC 
(rev 9277)
@@ -3,7 +3,7 @@
 //
 // Double-buffered window code for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2012 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -81,8 +81,8 @@
  \param srcx,srcy origin in offscreen buffer of rectangle to copy
  */
 void fl_copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap, 
int srcx, int srcy) {
-  if (fltk3::graphics_driver == 
fltk3::DisplayDevice::display_device()->driver()) {
-    fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
+  if (fltk3::graphics_driver->class_name() == 
fltk3::DisplayDevice::display_device()->driver()->class_name()) {
+  fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
   }
   else { // when copy is not to the display
     fl_begin_offscreen(pixmap);

Modified: branches/branch-3.0/src/fltk3/GDIPrinter.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/GDIPrinter.cxx        2012-03-12 09:39:17 UTC 
(rev 9276)
+++ branches/branch-3.0/src/fltk3/GDIPrinter.cxx        2012-03-12 09:56:12 UTC 
(rev 9277)
@@ -3,7 +3,7 @@
 //
 // Support for WIN32 printing for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 2010 by Bill Spitzak and others.
+// Copyright 2010-2012 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -36,11 +36,12 @@
 
 fltk3::SystemPrinter::SystemPrinter(void) : fltk3::PagedDevice() {
   hPr = NULL;
-  driver(fltk3::DisplayDevice::display_device()->driver());
+  driver(new GDIGraphicsDriver);
 }
 
 fltk3::SystemPrinter::~SystemPrinter(void) {
   if (hPr) end_job();
+  delete driver();
 }
 
 static void WIN_SetupPrinterDeviceContext(HDC prHDC)

Modified: branches/branch-3.0/src/fltk3/cocoa.mm
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa.mm      2012-03-12 09:39:17 UTC (rev 
9276)
+++ branches/branch-3.0/src/fltk3/cocoa.mm      2012-03-12 09:56:12 UTC (rev 
9277)
@@ -3,7 +3,7 @@
 //
 // MacOS-Cocoa specific code for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2011 by Bill Spitzak and others.
+// Copyright 1998-2012 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -3131,7 +3131,7 @@
   fltk3::check();
   win->make_current();
   this->set_current(); // back to the fltk3::PagedDevice
-  if (this->class_name() == fltk3::Printer::class_id) {
+  if (driver()->class_name() == fltk3::QuartzGraphicsDriver::class_id) {
     // capture as transparent image the window title bar from screen
     CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt);
     CGRect rect = { { x_offset, y_offset }, { win->w(), bt } }; // print the 
title bar

Modified: branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm
===================================================================
--- branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm 2012-03-12 09:39:17 UTC 
(rev 9276)
+++ branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm 2012-03-12 09:56:12 UTC 
(rev 9277)
@@ -3,7 +3,7 @@
 //
 // Mac OS X-specific printing support (objective-c++) for the Fast Light Tool 
Kit (FLTK).
 //
-// Copyright 2010 by Bill Spitzak and others.
+// Copyright 2010-2012 by Bill Spitzak and others.
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Library General Public
@@ -41,10 +41,12 @@
   y_offset = 0;
   scale_x = scale_y = 1.;
   gc = 0;
-  driver(fltk3::DisplayDevice::display_device()->driver());
+  driver(new QuartzGraphicsDriver);
 }
 
-fltk3::SystemPrinter::~SystemPrinter(void) {}
+fltk3::SystemPrinter::~SystemPrinter(void) {
+  delete driver();
+}
 
 int fltk3::SystemPrinter::start_job (int pagecount, int *frompage, int *topage)
 //printing using a Quartz graphics context

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to