diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-14 23:13:48 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-14 23:13:48 +0000 |
| commit | 1bb5eea696bfabdb3000b8430e539133af81fe67 (patch) | |
| tree | 669c3659e666f740c320e84b5cc8d5686bea1f5c /src/drivers/Android/Fl_Android_Graphics_Driver.cxx | |
| parent | 737d8bef2425d0373a8890b49f9b0babb7f994db (diff) | |
Android: implemented complex clipping at the first level.
Clipping areas are calculated for overlapping windows, named "Desktop
Windows". The first level implementation works if the resulting complex
region is just a rectangle. Higher complexity (sub-rectangles) is next.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12746 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 | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx index 817b5c0d1..4e3be5d14 100644 --- a/src/drivers/Android/Fl_Android_Graphics_Driver.cxx +++ b/src/drivers/Android/Fl_Android_Graphics_Driver.cxx @@ -60,19 +60,19 @@ void Fl_Android_Graphics_Driver::make_current(Fl_Window *win) pWindowRegion.set(-win->x(), -win->y(), 600, 800); pWindowRegion.intersect_with(Fl_Rect_Region(0, 0, win->w(), win->h())); -#if 0 + pDesktopWindowRegion.set(pWindowRegion); + pDesktopWindowRegion.print(win->label()); + // remove all window rectangles that are positioned on top of this window // TODO: this region is expensive to calculate. Cache it for each window and recalculate when windows move, show, hide, or change order Fl_Window *wTop = Fl::first_window(); while (wTop) { if (wTop==win) break; - Fl_Rect r(wTop->x(), wTop->y(), wTop->w(), wTop->h()); - pDesktopRegion->subtract(&r); + Fl_Rect_Region r(wTop->x()-win->x(), wTop->y()-win->y(), wTop->w(), wTop->h()); + pDesktopWindowRegion.subtract(r); wTop = Fl::next_window(wTop); } -#endif - - pClippingRegion.set(pWindowRegion); + pClippingRegion.set(pDesktopWindowRegion); } @@ -95,10 +95,47 @@ static uint16_t make565(Fl_Color crgba) void Fl_Android_Graphics_Driver::rectf_unscaled(float x, float y, float w, float h) { + // FIXME: r must be a complex region, like pClippingRegion. + +#if 0 Fl_Rect_Region r(x, y, w, h); if (r.intersect_with(pClippingRegion)) { rectf_unclipped(r.x(), r.y(), r.w(), r.h()); } +#else // proof of concept + // FIXME: write iterator over tree + for (Fl_Complex_Region *cr = &pClippingRegion; cr; cr=cr->next()) { + if (cr->subregion()) { + for (Fl_Complex_Region *cr1 = cr->subregion(); cr1; cr1=cr1->next()) { + if (cr1->subregion()) { + for (Fl_Complex_Region *cr2 = cr1->subregion(); cr2; cr2 = cr2->next()) { + Fl_Rect_Region r(x, y, w, h); + if (r.intersect_with(*cr2)) { + rectf_unclipped(r.x(), r.y(), r.w(), r.h()); + } + } + } else { + Fl_Rect_Region r(x, y, w, h); + if (r.intersect_with(*cr1)) { + rectf_unclipped(r.x(), r.y(), r.w(), r.h()); + } + } + } + } else { + Fl_Rect_Region r(x, y, w, h); + if (r.intersect_with(*cr)) { + r.print("---- fl_rectf"); + pClippingRegion.print("clip to"); + rectf_unclipped(r.x(), r.y(), r.w(), r.h()); + } + } + } +#endif + + + + + // TODO: create a complex region by intersecting r with the pClippingRegion // TODO: walk the region and draw all rectangles |
