From c0cbf0fbde0ac33d3743a6d50bf0fa9f6664a008 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 10 Mar 2018 00:46:12 +0000 Subject: Android: crude graphics clipping git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12726 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Android/Fl_Android_Graphics_Driver.cxx | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/drivers/Android/Fl_Android_Graphics_Driver.cxx') 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 #include #include -#include "Fl_Android_Screen_Driver.H" -#include - -#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); -- cgit v1.2.3