diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2018-03-18 13:44:37 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2018-03-18 13:44:37 +0000 |
| commit | 5900d824e93be44a852741ca093d88023e2a516a (patch) | |
| tree | 1441a0d02e432f046ba0cd83cbc1ef64badf8a61 /src/drivers/Android/Fl_Android_Graphics_Clipping.cxx | |
| parent | 7ff40388cbf2b4f1441efbc3b30f35017cab9304 (diff) | |
Android: Fixed bug when deleting complex clipping areas
Tested FLTK schemes - nice!
Fixed crashbug in timer
Fixed crashbug in mouse handler
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12771 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Android/Fl_Android_Graphics_Clipping.cxx')
| -rw-r--r-- | src/drivers/Android/Fl_Android_Graphics_Clipping.cxx | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/drivers/Android/Fl_Android_Graphics_Clipping.cxx b/src/drivers/Android/Fl_Android_Graphics_Clipping.cxx index 5050a5082..1ea7cdb08 100644 --- a/src/drivers/Android/Fl_Android_Graphics_Clipping.cxx +++ b/src/drivers/Android/Fl_Android_Graphics_Clipping.cxx @@ -172,6 +172,7 @@ int Fl_Rect_Region::intersect_with(const Fl_Rect_Region &r) */ void Fl_Rect_Region::add_to_bbox(const Fl_Rect_Region &r) { + if (is_empty()) return; if (r.pLeft<pLeft) pLeft = r.pLeft; if (r.pTop<pTop) pTop = r.pTop; if (r.pRight>pRight) pRight = r.pRight; @@ -212,8 +213,14 @@ Fl_Complex_Region::Fl_Complex_Region(const Fl_Rect_Region &r) : */ Fl_Complex_Region::~Fl_Complex_Region() { - delete pSubregion; // recursively delete all subregions - delete pNext; // recursively delete all following regions + // Do NOT delete the chain in pNext! The caller has to that job. + // A top-level coplex region has pNext always set to NULL, and it does + // delete all subregions chained via the subregion pNext. + while (pSubregion) { + Fl_Complex_Region *rgn = pSubregion; + pSubregion = rgn->pNext; + delete rgn; + } } /** @@ -354,7 +361,15 @@ void Fl_Complex_Region::compress() if (!pSubregion) return; // remove all empty regions, because the really don't add anything (literally) + print("Compress"); Fl_Complex_Region *rgn = pSubregion; + while (rgn && rgn->is_empty()) { + pSubregion = rgn->next(); + delete rgn; + rgn = pSubregion; + } + + #if 0 // FIXME: remove emty rectangles and lift single rectangles // TODO: merging rectangles may take much too much time with little benefit |
