mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 08:06:35 +08:00
Added Fl_Printer::add_image(const ichar*) needed for correct memory usage by
Fl_Paged_Device::print_window_part(). git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8341 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -108,26 +108,23 @@ public:
|
||||
*/
|
||||
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);};
|
||||
|
||||
@@ -164,6 +164,9 @@ public:
|
||||
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);
|
||||
|
||||
|
||||
@@ -194,7 +194,6 @@ int Fl_System_Printer::start_page (void)
|
||||
}
|
||||
printable_rect(&w, &h);
|
||||
origin(0, 0);
|
||||
image_list_ = NULL;
|
||||
fl_clip_region(0);
|
||||
gc = (void *)fl_gc;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int
|
||||
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 @@ void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int
|
||||
}
|
||||
|
||||
#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 @@ void Fl_Paged_Device::delete_image_list()
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -160,6 +160,13 @@ void Fl_Printer::end_job (void)
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user