From 1366cc68d38e7044bcc0625ce713ac1fdd675601 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Tue, 22 Mar 2011 17:41:23 +0000 Subject: [PATCH] PostScript support: simplified the Fl_PostScript_Graphics_Driver class by removing the draw_scaled_image(_mono)() member functions. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8528 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_PostScript.H | 13 ++++--------- src/ps_image.cxx | 17 ++++++++++------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/FL/Fl_PostScript.H b/FL/Fl_PostScript.H index f921e2e12..24c2c3f8d 100644 --- a/FL/Fl_PostScript.H +++ b/FL/Fl_PostScript.H @@ -62,11 +62,6 @@ Times (and their bold, oblique, italic variants). */ class Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver { -private: - void draw_scaled_image(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D=3, int LD=0); - void draw_scaled_image_mono(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D=3, int LD=0); - void draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D); - void draw_scaled_image_mono(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D); public: static const char *class_id; const char *class_name() {return class_id;}; @@ -193,10 +188,10 @@ class Clip { void end_complex_polygon(){end_polygon();}; void transformed_vertex(double x, double y); - void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0){draw_scaled_image(d,x,y,w,h,w,h,delta,ldelta);}; - void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0){draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);}; - void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3){draw_scaled_image(call,data, x, y, w, h, w, h, delta);}; - void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1){draw_scaled_image_mono(call, data, x, y, w, h, w, h, delta);}; + void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0); + void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0); + void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3); + void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1); void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); }; #ifdef __APPLE__ diff --git a/src/ps_image.cxx b/src/ps_image.cxx index 6d60558ff..6e1cbfc13 100644 --- a/src/ps_image.cxx +++ b/src/ps_image.cxx @@ -195,11 +195,11 @@ static inline uchar swap_byte(const uchar b) { extern uchar **fl_mask_bitmap; -void Fl_PostScript_Graphics_Driver::draw_scaled_image(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D, int LD) { - +void Fl_PostScript_Graphics_Driver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { + double x = ix, y = iy, w = iw, h = ih; if (D<3){ //mono - draw_scaled_image_mono(data, x, y, w, h, iw, ih, D, LD); + draw_image_mono(data, ix, iy, iw, ih, D, LD); return; } @@ -262,7 +262,8 @@ void Fl_PostScript_Graphics_Driver::draw_scaled_image(const uchar *data, double } -void Fl_PostScript_Graphics_Driver::draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D) { +void Fl_PostScript_Graphics_Driver::draw_image(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D) { + double x = ix, y = iy, w = iw, h = ih; int level2_mask = 0; fprintf(output,"save\n"); @@ -348,7 +349,8 @@ void Fl_PostScript_Graphics_Driver::draw_scaled_image(Fl_Draw_Image_Cb call, voi delete[] rgbdata; } -void Fl_PostScript_Graphics_Driver::draw_scaled_image_mono(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D, int LD) { +void Fl_PostScript_Graphics_Driver::draw_image_mono(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) { + double x = ix, y = iy, w = iw, h = ih; fprintf(output,"save\n"); @@ -409,7 +411,8 @@ void Fl_PostScript_Graphics_Driver::draw_scaled_image_mono(const uchar *data, do -void Fl_PostScript_Graphics_Driver::draw_scaled_image_mono(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D) { +void Fl_PostScript_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb call, void *data, int ix, int iy, int iw, int ih, int D) { + double x = ix, y = iy, w = iw, h = ih; fprintf(output,"save\n"); int i,j,k; @@ -482,7 +485,7 @@ void Fl_PostScript_Graphics_Driver::draw(Fl_RGB_Image * rgb,int XP, int YP, int if (lang_level_>2) //when not true, not making alphamask, mixing colors instead... if (alpha_mask(di, w, h, rgb->d(),rgb->ld())) return; //everthing masked, no need for painting! push_clip(XP, YP, WP, HP); - draw_scaled_image(di, XP + cx, YP + cy, w, h, w, h, rgb->d(), rgb->ld()); + draw_image(di, XP + cx, YP + cy, w, h, rgb->d(), rgb->ld()); pop_clip(); delete[]mask; mask=0;