diff options
| author | ManoloFLTK <manolo> | 2018-12-04 15:11:03 +0100 |
|---|---|---|
| committer | ManoloFLTK <manolo> | 2018-12-04 15:11:03 +0100 |
| commit | d2870d6f7d378e374da515280e9434c605b1ac4e (patch) | |
| tree | bf7a5a45d5919088b695a99195c72ccdd3ef6f87 | |
| parent | b985b884f88d8b9c9b000dbfd564a220ceb7b7ed (diff) | |
Define useful implementations of Fl_Graphics_Driver::push_no_clip() and pop_clip().
| -rw-r--r-- | FL/Fl_Graphics_Driver.H | 4 | ||||
| -rw-r--r-- | src/Fl_Graphics_Driver.cxx | 14 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx | 16 | ||||
| -rw-r--r-- | src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx | 15 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx | 16 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx | 16 |
10 files changed, 16 insertions, 73 deletions
diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 10282a522..d00082385 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -298,9 +298,9 @@ public: /** see fl_not_clipped() */ virtual int not_clipped(int x, int y, int w, int h) {return 1;} /** see fl_push_no_clip() */ - virtual void push_no_clip() {} + virtual void push_no_clip(); // has default implementation /** see fl_pop_clip() */ - virtual void pop_clip() {} + virtual void pop_clip(); // has default implementation virtual Fl_Region clip_region(); // has default implementation virtual void clip_region(Fl_Region r); // has default implementation virtual void restore_clip(); diff --git a/src/Fl_Graphics_Driver.cxx b/src/Fl_Graphics_Driver.cxx index 9de99b4ee..784e5b5c2 100644 --- a/src/Fl_Graphics_Driver.cxx +++ b/src/Fl_Graphics_Driver.cxx @@ -385,6 +385,20 @@ void Fl_Graphics_Driver::polygon(int x0, int y0, int x1, int y1, int x2, int y2, polygon(x1, y1, x2, y2, x3, y3); } +void Fl_Graphics_Driver::push_no_clip() { + if (rstackptr < region_stack_max) rstack[++rstackptr] = 0; + else Fl::warning("Fl_Graphics_Driver::push_no_clip: clip stack overflow!\n"); + restore_clip(); +} + +void Fl_Graphics_Driver::pop_clip() { + if (rstackptr > 0) { + Fl_Region oldr = rstack[rstackptr--]; + if (oldr) XDestroyRegion(oldr); + } else Fl::warning("Fl_Graphics_Driver::pop_clip: clip stack underflow!\n"); + restore_clip(); +} + /** \} \endcond diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H index fdc646984..626049aeb 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver.H +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver.H @@ -115,8 +115,6 @@ protected: void push_clip(int x, int y, int w, int h); int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); int not_clipped(int x, int y, int w, int h); - void push_no_clip(); - void pop_clip(); void restore_clip(); virtual Fl_Region scale_clip(float f); // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx index 51cd6713c..3e5d6bfb9 100644 --- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx +++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx @@ -230,22 +230,6 @@ int Fl_GDI_Graphics_Driver::not_clipped(int x, int y, int w, int h) { return RectInRegion(r,&rect); } -// make there be no clip (used by fl_begin_offscreen() only!) -void Fl_GDI_Graphics_Driver::push_no_clip() { - if (rstackptr < region_stack_max) rstack[++rstackptr] = 0; - else Fl::warning("Fl_GDI_Graphics_Driver::push_no_clip: clip stack overflow!\n"); - fl_restore_clip(); -} - -// pop back to previous clip: -void Fl_GDI_Graphics_Driver::pop_clip() { - if (rstackptr > 0) { - Fl_Region oldr = rstack[rstackptr--]; - if (oldr) XDestroyRegion(oldr); - } else Fl::warning("Fl_GDI_Graphics_Driver::pop_clip: clip stack underflow!\n"); - fl_restore_clip(); -} - void Fl_GDI_Graphics_Driver::restore_clip() { fl_clip_state_number++; if (gc_) { diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H index 980d69bce..36ecab45d 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H +++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver.H @@ -51,8 +51,6 @@ public: void push_clip(int x, int y, int w, int h); int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); int not_clipped(int x, int y, int w, int h); - void push_no_clip(); - void pop_clip(); void restore_clip(); // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx //void transformed_vertex0(double x, double y); diff --git a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx index 308c059f4..2af56c55c 100644 --- a/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx +++ b/src/drivers/OpenGL/Fl_OpenGL_Graphics_Driver_rect.cxx @@ -181,21 +181,6 @@ int Fl_OpenGL_Graphics_Driver::not_clipped(int x, int y, int w, int h) { return 1; } -void Fl_OpenGL_Graphics_Driver::push_no_clip() { - // TODO: implement OpenGL clipping - if (rstackptr < region_stack_max) rstack[++rstackptr] = 0; - else Fl::warning("Fl_OpenGL_Graphics_Driver::push_no_clip: clip stack overflow!\n"); - restore_clip(); -} - -void Fl_OpenGL_Graphics_Driver::pop_clip() { - // TODO: implement OpenGL clipping - if (rstackptr > 0) { - rstackptr--; - } else Fl::warning("Fl_OpenGL_Graphics_Driver::pop_clip: clip stack underflow!\n"); - restore_clip(); -} - void Fl_OpenGL_Graphics_Driver::restore_clip() { // TODO: implement OpenGL clipping fl_clip_state_number++; diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H index 9b4a16fc6..80d0bd615 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.H @@ -113,8 +113,6 @@ protected: void push_clip(int x, int y, int w, int h); int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); int not_clipped(int x, int y, int w, int h); - void push_no_clip(); - void pop_clip(); void restore_clip(); // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx void begin_complex_polygon(); diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx index a30eeec09..e48cd0361 100644 --- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx +++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx @@ -284,22 +284,6 @@ int Fl_Quartz_Graphics_Driver::not_clipped(int x, int y, int w, int h) { return 0; } -// make there be no clip (used by fl_begin_offscreen() only!) -void Fl_Quartz_Graphics_Driver::push_no_clip() { - if (rstackptr < region_stack_max) rstack[++rstackptr] = 0; - else Fl::warning("Fl_Quartz_Graphics_Driver::push_no_clip: clip stack overflow!\n"); - restore_clip(); -} - -// pop back to previous clip: -void Fl_Quartz_Graphics_Driver::pop_clip() { - if (rstackptr > 0) { - Fl_Region oldr = rstack[rstackptr--]; - if (oldr) XDestroyRegion(oldr); - } else Fl::warning("Fl_Quartz_Graphics_Driver::pop_clip: clip stack underflow!\n"); - restore_clip(); -} - void Fl_Quartz_Graphics_Driver::restore_clip() { fl_clip_state_number++; Fl_Region r = rstack[rstackptr]; diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H index f8334b74a..66b47edb0 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver.H @@ -184,8 +184,6 @@ protected: void push_clip(int x, int y, int w, int h); int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H); int not_clipped(int x, int y, int w, int h); - void push_no_clip(); - void pop_clip(); void restore_clip(); void begin_complex_polygon(); void end_points(); diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx index 1af4320b6..af6b19c9a 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx @@ -396,22 +396,6 @@ int Fl_Xlib_Graphics_Driver::not_clipped(int x, int y, int w, int h) { return XRectInRegion(r, x, y, w, h); } -// make there be no clip (used by fl_begin_offscreen() only!) -void Fl_Xlib_Graphics_Driver::push_no_clip() { - if (rstackptr < region_stack_max) rstack[++rstackptr] = 0; - else Fl::warning("Fl_Xlib_Graphics_Driver::push_no_clip: clip stack overflow!\n"); - restore_clip(); -} - -// pop back to previous clip: -void Fl_Xlib_Graphics_Driver::pop_clip() { - if (rstackptr > 0) { - Fl_Region oldr = rstack[rstackptr--]; - if (oldr) XDestroyRegion(oldr); - } else Fl::warning("Fl_Xlib_Graphics_Driver::pop_clip: clip stack underflow!\n"); - restore_clip(); -} - void Fl_Xlib_Graphics_Driver::restore_clip() { fl_clip_state_number++; if (gc_) { |
