summaryrefslogtreecommitdiff
path: root/tests/glean/dsfilt.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-09-29 12:36:53 -0700
committerEric Anholt <eric@anholt.net>2009-09-29 12:36:53 -0700
commit9a6cb4b2ac1e50a957dadbda3233216d4ab0cd87 (patch)
tree857701c78b4733700dbcf2f2ae7591c5109c61e9 /tests/glean/dsfilt.cpp
parentc3da635874bbc8251605aa841c6567ce1427194f (diff)
Diffstat (limited to 'tests/glean/dsfilt.cpp')
-rw-r--r--tests/glean/dsfilt.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/glean/dsfilt.cpp b/tests/glean/dsfilt.cpp
index fe5ed2660..015aa64b8 100644
--- a/tests/glean/dsfilt.cpp
+++ b/tests/glean/dsfilt.cpp
@@ -163,11 +163,23 @@ DrawingSurfaceFilter::matches(DrawingSurfaceConfig& c) {
///////////////////////////////////////////////////////////////////////////////
vector<DrawingSurfaceConfig*>
DrawingSurfaceFilter::filter(vector<DrawingSurfaceConfig*>& v) {
+ return filter(v, ~0u);
+} // DrawingSurfaceFilter::filter
+
+///////////////////////////////////////////////////////////////////////////////
+// filter - filter as above, but limit number of results
+///////////////////////////////////////////////////////////////////////////////
+vector<DrawingSurfaceConfig*>
+DrawingSurfaceFilter::filter(vector<DrawingSurfaceConfig*>& v,
+ unsigned int maxConfigs) {
vector<DrawingSurfaceConfig*> result;
+ unsigned count = 0;
for (vector<DrawingSurfaceConfig*>::const_iterator p = v.begin();
- p < v.end(); ++p) {
- if (matches(**p))
+ p < v.end() && count < maxConfigs; ++p) {
+ if (matches(**p)) {
result.push_back(*p);
+ count++;
+ }
}
sort(result.begin(), result.end(), ConfigSort(sortKeys));