Define useful implementations of Fl_Graphics_Driver::push_no_clip() and pop_clip().

This commit is contained in:
ManoloFLTK 2018-12-04 15:11:03 +01:00
parent b985b884f8
commit d2870d6f7d
10 changed files with 16 additions and 73 deletions

View File

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

View File

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

View File

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

View File

@ -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_) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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_) {