diff options
| author | Manolo Gouy <Manolo> | 2017-03-17 16:33:14 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-03-17 16:33:14 +0000 |
| commit | 367e567b7b14d88bc723dba6bde156bd705bf86c (patch) | |
| tree | 78e4472938a1f16ba8a6b7d7aefee3974ce02316 /src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | |
| parent | 300e0b32a9b18e9ab37185532d3a7c885e710f02 (diff) | |
Remove class Fl_Translated_Xlib_Graphics_Driver and move its processing to Fl_Xlib_Graphics_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12205 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx')
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx index 3986f4e95..ef2e72c85 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx @@ -61,6 +61,8 @@ Fl_Xlib_Graphics_Driver::Fl_Xlib_Graphics_Driver(void) { pfd_ = pango_font_description_new(); Fl_Graphics_Driver::font(0, 0); #endif + offset_x_ = 0; offset_y_ = 0; + depth_ = 0; } Fl_Xlib_Graphics_Driver::~Fl_Xlib_Graphics_Driver() { @@ -77,7 +79,7 @@ void Fl_Xlib_Graphics_Driver::gc(void *value) { } 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, srcy, w, h, x, y); + XCopyArea(fl_display, pixmap, fl_window, gc_, srcx, srcy, w, h, x+offset_x_, y+offset_y_); } #ifndef FL_DOXYGEN @@ -102,7 +104,7 @@ void Fl_Xlib_Graphics_Driver::copy_offscreen_with_alpha(int x, int y, int w, int XRenderSetPictureClipRegion(fl_display, dst, clipr); XRenderComposite(fl_display, PictOpOver, src, None, dst, srcx, srcy, 0, 0, - x, y, w, h); + x+offset_x_, y+offset_y_, w, h); XRenderFreePicture(fl_display, src); XRenderFreePicture(fl_display, dst); @@ -231,6 +233,24 @@ void Fl_Xlib_Graphics_Driver::font_name(int num, const char *name) { s->first = 0; } +void Fl_Xlib_Graphics_Driver::translate_all(int dx, int dy) { // reversibly adds dx,dy to the offset between user and graphical coordinates + stack_x_[depth_] = offset_x_; + stack_y_[depth_] = offset_y_; + offset_x_ = stack_x_[depth_] + dx; + offset_y_ = stack_y_[depth_] + dy; + push_matrix(); + translate(dx, dy); + if (depth_ < sizeof(stack_x_)/sizeof(int)) depth_++; + else Fl::warning("%s: translate stack overflow!", "Fl_Xlib_Graphics_Driver"); +} + +void Fl_Xlib_Graphics_Driver::untranslate_all() { // undoes previous translate_all() + if (depth_ > 0) depth_--; + offset_x_ = stack_x_[depth_]; + offset_y_ = stack_y_[depth_]; + pop_matrix(); +} + // // End of "$Id$". // |
