From 596a9375305969f8104a9cd536c808cf15289074 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 2 Dec 2021 10:54:40 +0100 Subject: [PATCH] PostScript output: initialise member variables in Fl_Cairo_Graphics_Driver constructor. Also, remove inadequate Fl_Surface_Device::push_current(this) call in Fl_Posix_Printer_Driver::begin_job(). --- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H | 7 ------- src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx | 11 ++++++++--- src/drivers/Posix/Fl_Posix_Printer_Driver.cxx | 1 - src/drivers/PostScript/Fl_PostScript.cxx | 2 +- .../PostScript/Fl_PostScript_Graphics_Driver.H | 2 ++ 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H index aff73c4f2..7237028fd 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.H @@ -44,17 +44,13 @@ public: }; Clip * clip_; - int lang_level_; int gap_; - int pages_; cairo_t *cr() { return cairo_; } PangoLayout *pango_layout() {return pango_layout_;} void check_status(void); enum SHAPE shape_; - int linewidth_;// need for clipping, lang level 1-2 - int linestyle_;// unsigned char cr_,cg_,cb_; char linedash_[256];//should be enough void concat(); // transform ror scalable dradings... @@ -68,9 +64,6 @@ public: int left_margin; int top_margin; - double pw_, ph_; - - uchar bg_r, bg_g, bg_b; void transformed_draw(const char* s, int n, double x, double y); //precise text placing // implementation of drawing methods diff --git a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx index f6db07cda..df7ea100c 100644 --- a/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx +++ b/src/drivers/Cairo/Fl_Cairo_Graphics_Driver.cxx @@ -64,7 +64,14 @@ static void draw_image_cb(void *data, int x, int y, int w, uchar *buf) { } -Fl_Cairo_Graphics_Driver::Fl_Cairo_Graphics_Driver() : Fl_Graphics_Driver() {} +Fl_Cairo_Graphics_Driver::Fl_Cairo_Graphics_Driver() : Fl_Graphics_Driver() { + cairo_ = NULL; + pango_layout_ = NULL; + clip_ = NULL; + scale_x = scale_y = 1; + angle = 0; + left_margin = top_margin = 0; +} Fl_Cairo_Graphics_Driver::~Fl_Cairo_Graphics_Driver() {} @@ -192,8 +199,6 @@ void Fl_Cairo_Graphics_Driver::polygon(int x0, int y0, int x1, int y1, int x2, i } void Fl_Cairo_Graphics_Driver::line_style(int style, int width, char* dashes) { - linewidth_=width; - linestyle_=style; if(dashes){ if(dashes != linedash_) strcpy(linedash_,dashes); diff --git a/src/drivers/Posix/Fl_Posix_Printer_Driver.cxx b/src/drivers/Posix/Fl_Posix_Printer_Driver.cxx index b93a5ec28..a81596d5d 100644 --- a/src/drivers/Posix/Fl_Posix_Printer_Driver.cxx +++ b/src/drivers/Posix/Fl_Posix_Printer_Driver.cxx @@ -327,7 +327,6 @@ int Fl_Posix_Printer_Driver::begin_job(int pages, int *firstpage, int *lastpage, return 2; } ps->close_command(pclose); - Fl_Surface_Device::push_current(this); return ps->start_postscript(pages, format, layout); // start printing } diff --git a/src/drivers/PostScript/Fl_PostScript.cxx b/src/drivers/PostScript/Fl_PostScript.cxx index 515450ce1..11d61e4f3 100644 --- a/src/drivers/PostScript/Fl_PostScript.cxx +++ b/src/drivers/PostScript/Fl_PostScript.cxx @@ -122,9 +122,9 @@ static const double dashes_cap[5][7]={ Fl_PostScript_Graphics_Driver::Fl_PostScript_Graphics_Driver(void) { close_cmd_ = 0; +#if ! USE_PANGO //lang_level_ = 3; lang_level_ = 2; -#if ! USE_PANGO mask = 0; #endif ps_filename_ = NULL; diff --git a/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H b/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H index 4a0584036..9f7b1068c 100644 --- a/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H +++ b/src/drivers/PostScript/Fl_PostScript_Graphics_Driver.H @@ -48,6 +48,8 @@ public: enum Fl_Paged_Device::Page_Format page_format_; char *ps_filename_; int nPages; + double pw_, ph_; + uchar bg_r, bg_g, bg_b; Fl_PostScript_Graphics_Driver(); ~Fl_PostScript_Graphics_Driver();