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 /src/drivers/Android/Fl_Android_Graphics_Driver.cxx | |
| 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 'src/drivers/Android/Fl_Android_Graphics_Driver.cxx')
| -rw-r--r-- | src/drivers/Android/Fl_Android_Graphics_Driver.cxx | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx index c9780c8d8..1df52462a 100644 --- a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx +++ b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx @@ -1,7 +1,7 @@ // // "$Id$" // -// Rectangle drawing routines for the Fast Light Tool Kit (FLTK). +// Graphics routines for the Fast Light Tool Kit (FLTK). // // Copyright 1998-2018 by Bill Spitzak and others. // @@ -20,18 +20,11 @@ #include "../../config_lib.h" #include "Fl_Android_Application.H" #include "Fl_Android_Graphics_Driver.H" +#include "Fl_Android_Screen_Driver.H" #include <FL/Fl.H> #include <FL/platform.H> #include <errno.h> -#include "Fl_Android_Screen_Driver.H" -#include <android/log.h> - -#define LOG_TAG "FLTK" -#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) -#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__) -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) - /* * By linking this module, the following static method will instantiate the @@ -60,8 +53,16 @@ static uint16_t make565(Fl_Color crgba) ((crgba >>11) & 0x001f) ); } - void Fl_Android_Graphics_Driver::rectf_unscaled(float x, float y, float w, float h) { + Fl_Android_Application::log_w("rectf %g %g %g %g", x, y, w, h); + Fl_Clip_Rect r(x, y, w, h); + if (r.intersect_with(&pClipRect)) { + rectf_unclipped(r.x(), r.y(), r.w(), r.h()); + } +} + +void Fl_Android_Graphics_Driver::rectf_unclipped(float x, float y, float w, float h) { + Fl_Android_Application::log_w("rectf unclipped %g %g %g %g", x, y, w, h); if (w<=0 || h<=0) return; // TODO: clip the rectangle to the window outline @@ -147,7 +148,7 @@ if (once==0) { once = 1; FILE *f = fopen("/system/fonts/DroidSans.ttf", "rb"); if (f==NULL) { - LOGE("ERROR reading font %d!", errno); + Fl_Android_Application::log_e("ERROR reading font %d!", errno); return 0; } fread(ttf_buffer, 1, 1<<25, f); |
