Simplify using Fl_XXX_Graphics_Driver::copy_offscreen() instead of Fl_Scalable_Graphics_Driver::copy_offscreen_unscaled()

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12395 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2017-08-20 20:18:15 +00:00
parent 4331fdf46b
commit c2d5cf4067
6 changed files with 7 additions and 12 deletions

View File

@ -479,8 +479,6 @@ protected:
virtual void pie_unscaled(float x, float y, float w, float h, double a1, double a2)=0;
virtual void line_style(int style, int width=0, char* dashes=0);
virtual void line_style_unscaled(int style, float width, char* dashes)=0;
virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
virtual void copy_offscreen_unscaled(float x, float y, float w, float h, Fl_Offscreen pixmap, float srcx, float srcy)=0;
void draw_image_rescale(void *buf, Fl_Draw_Image_Cb cb, int X, int Y, int W, int H, int D, int L, bool mono, float s);
virtual void draw_image_unscaled(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0)=0;
virtual void draw_image_unscaled(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3)=0;

View File

@ -444,10 +444,6 @@ void Fl_Scalable_Graphics_Driver::line_style(int style, int width, char* dashes)
line_style_unscaled(style, line_width_, dashes);
}
void Fl_Scalable_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
copy_offscreen_unscaled(x * scale_, y * scale_, w * scale_, h * scale_, pixmap, srcx * scale_, srcy * scale_);
}
/* read the image data from a pointer or with a callback, scale it, and draw it */
void Fl_Scalable_Graphics_Driver::draw_image_rescale(void *buf, Fl_Draw_Image_Cb cb,
int X, int Y, int W, int H, int D, int L, bool mono, float s) {

View File

@ -83,7 +83,7 @@ public:
#if ! defined(FL_DOXYGEN)
void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy);
#endif
virtual void copy_offscreen_unscaled(float x, float y, float w, float h, Fl_Offscreen pixmap, float srcx, float srcy);
virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
void add_rectangle_to_region(Fl_Region r, int x, int y, int w, int h);
Fl_Region XRectangleRegion(int x, int y, int w, int h);
void XDestroyRegion(Fl_Region r);

View File

@ -104,11 +104,11 @@ HDC fl_makeDC(HBITMAP bitmap) {
return new_gc;
}
void Fl_GDI_Graphics_Driver::copy_offscreen_unscaled(float x, float y, float w, float h, Fl_Offscreen bitmap, float srcx, float srcy) {
void Fl_GDI_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen bitmap, int srcx, int srcy) {
HDC new_gc = CreateCompatibleDC(gc_);
int save = SaveDC(new_gc);
SelectObject(new_gc, bitmap);
BitBlt(gc_, x, y, w, h, new_gc, srcx, srcy, SRCCOPY);
BitBlt(gc_, x*scale_, y*scale_, w*scale_, h*scale_, new_gc, srcx*scale_, srcy*scale_, SRCCOPY);
RestoreDC(new_gc, save);
DeleteDC(new_gc);
}

View File

@ -127,7 +127,7 @@ public:
virtual double width_unscaled(unsigned int c);
virtual void text_extents_unscaled(const char*, int n, int& dx, int& dy, int& w, int& h);
virtual Fl_Fontsize size_unscaled();
virtual void copy_offscreen_unscaled(float x, float y, float w, float h, Fl_Offscreen pixmap, float srcx, float srcy);
virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
#if ! defined(FL_DOXYGEN)
void copy_offscreen_with_alpha(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
#endif

View File

@ -105,8 +105,9 @@ float Fl_Xlib_Graphics_Driver::scale() {
return scale_;
}
void Fl_Xlib_Graphics_Driver::copy_offscreen_unscaled(float x, float y, float w, float h, Fl_Offscreen pixmap, float srcx, float srcy) {
XCopyArea(fl_display, pixmap, fl_window, gc_, srcx, srcy, w, h, x+offset_x_*scale_, y+offset_y_*scale_);
void Fl_Xlib_Graphics_Driver::copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
XCopyArea(fl_display, pixmap, fl_window, gc_, srcx*scale_, srcy*scale_, w*scale_, h*scale_, (x+offset_x_)*scale_, (y+offset_y_)*scale_);
}
void Fl_Xlib_Graphics_Driver::add_rectangle_to_region(Fl_Region r, int X, int Y, int W, int H) {