summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-08-24 12:40:29 +0000
committerManolo Gouy <Manolo>2017-08-24 12:40:29 +0000
commitc7405a22a8bb618e51cbaa9f4076822af1b2c908 (patch)
tree91a04b439cee694e64b12f53eadeca04fc9b5863
parentc2d5cf40672c0d488a7bb67ab81fa567de1169fe (diff)
X11 platform: cleaner implementation of changing the active drawing surface and maintaining clip regions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12396 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--FL/Fl_Graphics_Driver.H3
-rw-r--r--src/Fl_Device.cxx1
-rw-r--r--src/Fl_Graphics_Driver.cxx4
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H1
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx4
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx3
6 files changed, 13 insertions, 3 deletions
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H
index f6806abb8..ffb6c8408 100644
--- a/FL/Fl_Graphics_Driver.H
+++ b/FL/Fl_Graphics_Driver.H
@@ -90,6 +90,9 @@ class FL_EXPORT Fl_Graphics_Driver {
friend FL_EXPORT void gl_start();
friend FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array);
friend FL_EXPORT void fl_delete_bitmask(Fl_Bitmask);
+private:
+ // some platforms may need to reimplement this
+ virtual void set_current_();
public:
// The following functions create the various graphics drivers that are required
// for core operations. They must be implemented as members of Fl_Graphics_Driver,
diff --git a/src/Fl_Device.cxx b/src/Fl_Device.cxx
index b791ee2c0..37aa804ac 100644
--- a/src/Fl_Device.cxx
+++ b/src/Fl_Device.cxx
@@ -54,6 +54,7 @@ void Fl_Surface_Device::set_current(void)
fl_graphics_driver = pGraphicsDriver;
surface_ = this;
pGraphicsDriver->global_gc();
+ driver()->set_current_();
}
Fl_Surface_Device* Fl_Surface_Device::surface_; // the current target surface of graphics operations
diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx
index 992a58f15..288545553 100644
--- a/src/Fl_Graphics_Driver.cxx
+++ b/src/Fl_Graphics_Driver.cxx
@@ -184,6 +184,10 @@ void Fl_Graphics_Driver::uncache_pixmap(fl_uintptr_t p) {
}
+void Fl_Graphics_Driver::set_current_() {
+}
+
+
#ifndef FL_DOXYGEN
Fl_Scalable_Graphics_Driver::Fl_Scalable_Graphics_Driver() : Fl_Graphics_Driver() {
scale_ = 1;
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
index edff7f6f9..ccfa7dc48 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H
@@ -58,6 +58,7 @@ private:
unsigned depth_; // depth of translation stack
int stack_x_[20], stack_y_[20]; // translation stack allowing cumulative translations
int line_delta_;
+ virtual void set_current_();
protected:
virtual void draw_unscaled(Fl_Pixmap *pxm, float s, int XP, int YP, int WP, int HP, int cx, int cy);
virtual void draw_unscaled(Fl_Bitmap *pxm, float s, int XP, int YP, int WP, int HP, int cx, int cy);
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
index 44d6b127e..9b4138055 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.cxx
@@ -273,6 +273,10 @@ void Fl_Xlib_Graphics_Driver::untranslate_all() { // undoes previous translate_a
pop_matrix();
}
+void Fl_Xlib_Graphics_Driver::set_current_() {
+ restore_clip();
+}
+
//
// End of "$Id$".
//
diff --git a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
index d4e49b513..0d3383cc5 100644
--- a/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Image_Surface_Driver.cxx
@@ -68,7 +68,6 @@ void Fl_Xlib_Image_Surface_Driver::set_current() {
Fl_Surface_Device::set_current();
pre_window = fl_window;
fl_window = offscreen;
- fl_push_no_clip();
}
void Fl_Xlib_Image_Surface_Driver::translate(int x, int y) {
@@ -87,8 +86,6 @@ Fl_RGB_Image* Fl_Xlib_Image_Surface_Driver::image()
void Fl_Xlib_Image_Surface_Driver::end_current_(Fl_Surface_Device *next_current)
{
- fl_pop_clip();
- next_current->driver()->restore_clip();
fl_window = pre_window;
}