38 |
PG_RectList::~PG_RectList() {} |
PG_RectList::~PG_RectList() {} |
39 |
|
|
40 |
PG_RectList PG_RectList::Intersect(PG_Rect* rect, int first, int last) { |
PG_RectList PG_RectList::Intersect(PG_Rect* rect, int first, int last) { |
41 |
|
// <DEBUG> |
42 |
|
static long total_calls = 0; |
43 |
|
static long total_iterations = 0; |
44 |
|
|
45 |
|
total_calls++; |
46 |
|
// </DEBUG> |
47 |
|
|
48 |
PG_RectList result; |
PG_RectList result; |
49 |
int s = (last == -1) ? size() : last; |
int s = (last == -1) ? size() : last; |
50 |
|
|
57 |
// loop through all rects |
// loop through all rects |
58 |
for(int i=first; i<s; i++) { |
for(int i=first; i<s; i++) { |
59 |
|
|
60 |
|
// <DEBUG> |
61 |
|
total_iterations++; |
62 |
|
// </DEBUG> |
63 |
|
|
64 |
// get the next rectangle to test |
// get the next rectangle to test |
65 |
testwidget = (*this)[i]; |
testwidget = (*this)[i]; |
66 |
|
|
75 |
} |
} |
76 |
} |
} |
77 |
|
|
78 |
|
// <DEBUG> |
79 |
|
//PG_LogDBG("Total calls: %d", total_calls); |
80 |
|
//PG_LogDBG("Total iterations: %d", total_iterations); |
81 |
|
//PG_LogDBG("Avg. iterations per call: %lf", (double)total_iterations/(double)total_calls); |
82 |
|
// </DEBUG> |
83 |
|
|
84 |
return result; |
return result; |
85 |
} |
} |
86 |
|
|