Author: manolo
Date: 2011-01-31 05:02:55 -0800 (Mon, 31 Jan 2011)
New Revision: 8341
Log:
Added Fl_Printer::add_image(const ichar*) needed for correct memory usage by 
Fl_Paged_Device::print_window_part().

Modified:
   branches/branch-1.3/FL/Fl_Paged_Device.H
   branches/branch-1.3/FL/Fl_Printer.H
   branches/branch-1.3/src/Fl_GDI_Printer.cxx
   branches/branch-1.3/src/Fl_Paged_Device.cxx
   branches/branch-1.3/src/Fl_Printer.cxx

Modified: branches/branch-1.3/FL/Fl_Paged_Device.H
===================================================================
--- branches/branch-1.3/FL/Fl_Paged_Device.H    2011-01-30 20:22:06 UTC (rev 
8340)
+++ branches/branch-1.3/FL/Fl_Paged_Device.H    2011-01-31 13:02:55 UTC (rev 
8341)
@@ -108,26 +108,23 @@
    */
   static const page_format page_formats[NO_PAGE_FORMATS];  
   
-private:
 #ifdef __APPLE__
   struct chain_elt {
-    Fl_Image *image;
     const uchar *data;
     struct chain_elt *next;
   };
-  void add_image(Fl_Image *image, const uchar *data); // adds an image to the 
page image list
 #endif
+private:
   void traverse(Fl_Widget *widget); // finds subwindows of widget and prints 
them
 protected:
   /** \brief horizontal offset to the origin of graphics coordinates */
   int x_offset;
   /** \brief vertical offset to the origin of graphics coordinates */
   int y_offset;
-  /** \brief chained list of Fl_Image's used in this page */
-  struct chain_elt *image_list_; 
 #ifdef __APPLE__
-  /** \brief deletes the page image list */
-  void delete_image_list(); 
+  struct chain_elt *image_list_; // chained list of images used in this page
+  virtual void add_image(const uchar *data); // adds an image to the page 
image list
+  void delete_image_list(); // deletes the page image list
 #endif
   /** \brief The constructor */
   Fl_Paged_Device() : Fl_Surface_Device(NULL) {class_name( class_id);};

Modified: branches/branch-1.3/FL/Fl_Printer.H
===================================================================
--- branches/branch-1.3/FL/Fl_Printer.H 2011-01-30 20:22:06 UTC (rev 8340)
+++ branches/branch-1.3/FL/Fl_Printer.H 2011-01-31 13:02:55 UTC (rev 8341)
@@ -164,6 +164,9 @@
   void untranslate(void);
   int end_page (void);
   void end_job (void);
+#ifdef __APPLE__
+  void add_image(const uchar *data);
+#endif
   /** \brief The destructor */
   ~Fl_Printer(void);
  

Modified: branches/branch-1.3/src/Fl_GDI_Printer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_GDI_Printer.cxx  2011-01-30 20:22:06 UTC (rev 
8340)
+++ branches/branch-1.3/src/Fl_GDI_Printer.cxx  2011-01-31 13:02:55 UTC (rev 
8341)
@@ -194,7 +194,6 @@
     }
     printable_rect(&w, &h);
     origin(0, 0);
-    image_list_ = NULL;
     fl_clip_region(0);
     gc = (void *)fl_gc;
   }

Modified: branches/branch-1.3/src/Fl_Paged_Device.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Paged_Device.cxx 2011-01-30 20:22:06 UTC (rev 
8340)
+++ branches/branch-1.3/src/Fl_Paged_Device.cxx 2011-01-31 13:02:55 UTC (rev 
8341)
@@ -156,7 +156,7 @@
     if (offset + width > w) width = w - offset;
     fl_draw_image(image_data[i], delta_x + offset, delta_y, width, h, 3);
 #ifdef __APPLE__
-    add_image(NULL, image_data[i]);
+    add_image(image_data[i]);
 #else
     delete image_data[i];
 #endif
@@ -164,10 +164,9 @@
 }
 
 #ifdef __APPLE__
-void Fl_Paged_Device::add_image(Fl_Image *image, const uchar *data)
+void Fl_Paged_Device::add_image(const uchar *data)
 {
   struct chain_elt *elt =  (struct chain_elt *)calloc(sizeof(struct 
chain_elt), 1);
-  elt->image = image;
   elt->data = data;
   if (image_list_) { elt->next = image_list_; }
   image_list_ = elt;
@@ -177,7 +176,6 @@
 {
   while(image_list_) {
     struct chain_elt *next = image_list_->next;
-    if(image_list_->image) delete image_list_->image;
     if (image_list_->data) delete (uchar*) image_list_->data; // msvc6 
compilation fix
     free(image_list_);
     image_list_ = next;

Modified: branches/branch-1.3/src/Fl_Printer.cxx
===================================================================
--- branches/branch-1.3/src/Fl_Printer.cxx      2011-01-30 20:22:06 UTC (rev 
8340)
+++ branches/branch-1.3/src/Fl_Printer.cxx      2011-01-31 13:02:55 UTC (rev 
8341)
@@ -160,6 +160,13 @@
   printer->end_job();
 }
 
+#ifdef __APPLE__
+void Fl_Printer::add_image(const uchar *data)
+{
+  printer->add_image(data);
+}
+#endif
+
 Fl_Printer::~Fl_Printer(void)
 {
   delete printer;

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

Reply via email to