Android: fixed some variables to avoid crashing.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12730 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher
2018-03-10 16:22:44 +00:00
parent 5591ba811a
commit 1cf4371b69
3 changed files with 13 additions and 10 deletions
@@ -110,7 +110,10 @@ protected:
void mask_bitmap(uchar **value) { mask_bitmap_ = value; } void mask_bitmap(uchar **value) { mask_bitmap_ = value; }
int p_size; int p_size;
POINT *p; POINT *p;
#endif
public: public:
Fl_Android_Graphics_Driver() : pWindowRegion(0L) {}
#if 0
Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL; gc_ = NULL; p_size = 0; p = NULL; depth = -1; origins = NULL;} Fl_GDI_Graphics_Driver() {mask_bitmap_ = NULL; gc_ = NULL; p_size = 0; p = NULL; depth = -1; origins = NULL;}
virtual ~Fl_GDI_Graphics_Driver() { if (p) free(p); delete[] origins;} virtual ~Fl_GDI_Graphics_Driver() { if (p) free(p); delete[] origins;}
virtual int has_feature(driver_feature mask) { return mask & NATIVE; } virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
@@ -187,7 +190,7 @@ protected:
void restore_clip(); void restore_clip();
void clip_region(Fl_Region r); void clip_region(Fl_Region r);
Fl_Region clip_region(); Fl_Region clip_region();
static Fl_Complex_Region pWindowRegion; Fl_Rect_Region *pWindowRegion;
#if 0 #if 0
virtual Fl_Region scale_clip(float f); virtual Fl_Region scale_clip(float f);
// --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx // --- implementation is in src/fl_vertex.cxx which includes src/cfg_gfx/xxx_rect.cxx
@@ -54,10 +54,14 @@ static uint16_t make565(Fl_Color crgba)
} }
void Fl_Android_Graphics_Driver::rectf_unscaled(float x, float y, float w, float h) { 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); if (pWindowRegion) {
Fl_Rect_Region r(x, y, w, h); Fl_Android_Application::log_w("rectf %g %g %g %g", x, y, w, h);
if (r.intersect_with(&pWindowRegion)) { Fl_Rect_Region r(x, y, w, h);
rectf_unclipped(r.x(), r.y(), r.w(), r.h()); if (r.intersect_with(pWindowRegion)) {
rectf_unclipped(r.x(), r.y(), r.w(), r.h());
}
} else {
rectf_unclipped(x, y, w, h);
} }
/* /*
@@ -23,10 +23,6 @@
#include <FL/platform.H> #include <FL/platform.H>
Fl_Complex_Region Fl_Android_Graphics_Driver::pWindowRegion;
// return 0 for empty, 1 for same, 2 if intersecting // return 0 for empty, 1 for same, 2 if intersecting
int Fl_Rect_Region::intersect_with(Fl_Rect_Region *a) int Fl_Rect_Region::intersect_with(Fl_Rect_Region *a)
{ {
@@ -98,7 +94,7 @@ void Fl_Android_Graphics_Driver::restore_clip()
// FIXME: scaling! // FIXME: scaling!
a.intersect_with(b); a.intersect_with(b);
} }
pWindowRegion.set(b); pWindowRegion = b;
// FIXME: intersect with complex window region // FIXME: intersect with complex window region
} }