diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/util/findopenrect.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/bfc/util/findopenrect.h')
-rw-r--r-- | Src/Wasabi/bfc/util/findopenrect.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/util/findopenrect.h b/Src/Wasabi/bfc/util/findopenrect.h new file mode 100644 index 00000000..97fdc5cb --- /dev/null +++ b/Src/Wasabi/bfc/util/findopenrect.h @@ -0,0 +1,63 @@ +#ifndef _FINDOPENRECT_H +#define _FINDOPENRECT_H + +#include <bfc/wasabi_std.h> +#include <bfc/ptrlist.h> + +class FindOpenRect +{ +public: + FindOpenRect(); + + typedef double (*compareRectsFn)(const RECT &rect, const RECT &dest, unsigned long userdata, unsigned long userdata2, int index, double bsf); + static double compare_overlapArea(const RECT &rect, const RECT &dest, unsigned long userdata = 0, unsigned long userdata2 = 0, int index = 0, double bsf = 0); + + void setCompareRectsFn(compareRectsFn fn); + + // this one does it all in one call + RECT find(const RECT &viewport, const PtrList<RECT> &list, + const RECT &prev, unsigned long userdata = 0, unsigned long userdata2 = 0); + + // these let you do it over time + void beginFind(const RECT &viewport, const PtrList<RECT> &list, + const RECT &prev, unsigned long userdata = 0, unsigned long userdata2 = 0); + RECT findMore(); + + double trySingleRect(const RECT &r, int early_out = FALSE); + + void setTimeLimit(int ms); + int getNumIters(); + void resetNumIters(); + + double getBestValSoFar(); + RECT getBestRectSoFar(); + + // this only sets it if it's a better value + void setBestSoFar(double bsf, const RECT &bestrect); + + RECT getOriginalRect(); + + void setCoordDivisor(int xdiv, int ydiv); + +private: + RECT vr, prev; + PtrList<RECT> list; + compareRectsFn fn; + unsigned long userdata, userdata2; + + int timelimit; + int iters; + + int xdiv, ydiv; + + RECT bsfrect; + double bsfval; + double bsfdist; + //CUT RECT bsf_nooverlap; + //CUT int found_nooverlap; + //CUT RECT bsf_overlap; + //CUT double bsfval_nooverlap; + //CUT double bsfval_overlap; +}; + +#endif |