diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-10 00:46:12 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-10 00:46:12 +0000 |
| commit | c0cbf0fbde0ac33d3743a6d50bf0fa9f6664a008 (patch) | |
| tree | 8fb9b3e1db8bfef8052deb549af986023fc86915 /FL | |
| parent | dc2fb581b76ea84ebd70a7ced1291dd26b40fc71 (diff) | |
Android: crude graphics clipping
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12726 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl_Gl_Window.H | 5 | ||||
| -rw-r--r-- | FL/Fl_Rect.H | 12 | ||||
| -rw-r--r-- | FL/Fl_Window.H | 3 | ||||
| -rw-r--r-- | FL/fl_draw.H | 2 | ||||
| -rw-r--r-- | FL/platform_types.h | 14 |
5 files changed, 35 insertions, 1 deletions
diff --git a/FL/Fl_Gl_Window.H b/FL/Fl_Gl_Window.H index 0c483e59e..ee34fad70 100644 --- a/FL/Fl_Gl_Window.H +++ b/FL/Fl_Gl_Window.H @@ -45,6 +45,11 @@ class Fl_Gl_Window_Driver; Even though Fl_Gl_Window is derived from Fl_Group, it is not useful to add other FLTK Widgets as children, unless those widgets are modified to draw using OpenGL calls. + + Note: FLTK 1.4 introduces a Driver system for graphic calls. It is now possible + to add a selection of widgets to an OpenGL window. The widgets will draw on top + of any OpenGL rendering. The number of supported widgets will increase as the + driver development improves. */ class FL_EXPORT Fl_Gl_Window : public Fl_Window { friend class Fl_Gl_Window_Driver; diff --git a/FL/Fl_Rect.H b/FL/Fl_Rect.H index 7e7d376e0..307410ef7 100644 --- a/FL/Fl_Rect.H +++ b/FL/Fl_Rect.H @@ -60,6 +60,18 @@ public: Fl_Rect (const Fl_Widget* const widget) : x_(widget->x()), y_(widget->y()), w_(widget->w()), h_(widget->h()) {} + /** Return 1 if the rectangle is empty, width or height are 0 */ + int is_empty() { return (w_==0)||(h_==0); } + + /** Set the position and size */ + void set(int x, int y, int w, int h) { x_=x; y_=y; w_=w; h_=h; } + + /** return 0 if the rectangles are different, or 1 if they are the same */ + int equals(int x, int y, int w, int h) { return ( (x_==x) && (y_==y) && (w_==w) && (h_==h) ); } + + /** Set the position and size to zero, making this rect empty */ + void clear() { x_ = y_ = w_ = h_ = 0; } + int x() const { return x_; } ///< gets the x coordinate (left edge) int y() const { return y_; } ///< gets the y coordinate (top edge) int w() const { return w_; } ///< gets the width diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index 3ad0d4081..f05281671 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -69,6 +69,9 @@ private: int fullscreen_screen_left; int fullscreen_screen_right; + // TODO: it would make sense to merge the use of Fl_X and Fl_Window_Driver, maybe simply by + // TODO: deriving Fl_Window_Driver from Fl_X. However, there are a lot of historic kldges for + // TODO: some platforms around Fl_X. Fl_X *i; // points at the system-specific stuff, but exists only after the window is mapped Fl_Window_Driver *pWindowDriver; // points at the system-specific stuff at window creation time diff --git a/FL/fl_draw.H b/FL/fl_draw.H index 46a60fb14..c7f3dd8bb 100644 --- a/FL/fl_draw.H +++ b/FL/fl_draw.H @@ -122,7 +122,7 @@ inline int fl_not_clipped(int x, int y, int w, int h) {return fl_graphics_driver \param[out] X,Y,W,H position and size of resulting bounding box. \returns Non-zero if the resulting rectangle is different to the original. */ -inline int fl_clip_box(int x , int y, int w, int h, int& X, int& Y, int& W, int& H) +inline int fl_clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H) {return fl_graphics_driver->clip_box(x,y,w,h,X,Y,W,H); } /** Undoes any clobbering of clip done by your program */ inline void fl_restore_clip() { fl_graphics_driver->restore_clip(); } diff --git a/FL/platform_types.h b/FL/platform_types.h index 226ce5958..286fc68d1 100644 --- a/FL/platform_types.h +++ b/FL/platform_types.h @@ -112,6 +112,20 @@ typedef struct HGLRC__ *GLContext; #include <sys/stat.h> struct dirent {char d_name[1];}; +#elif defined(__ANDROID__) + +// see: src/driver/Android/Fl_Android_Graphics_Driver_region.cxx +typedef struct Fl_Clip_Rect *Fl_Region; + +// TODO: the types below have not yet been ported +typedef unsigned long Fl_Offscreen; +typedef unsigned long Fl_Bitmask; +typedef int FL_SOCKET; +typedef struct __GLXcontextRec *GLContext; +#include <sys/stat.h> +#include <sys/types.h> +#include <dirent.h> + #elif defined(FL_PORTING) # pragma message "FL_PORTING: define OS-dependent types" typedef void* Fl_Offscreen; |
