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
This commit is contained in:
Manolo Gouy 2017-08-24 12:40:29 +00:00
parent c2d5cf4067
commit c7405a22a8
6 changed files with 13 additions and 3 deletions

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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$".
//

View File

@ -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;
}