diff options
author | Eric Anholt <eric@anholt.net> | 2009-09-29 12:36:53 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-09-29 12:36:53 -0700 |
commit | 9a6cb4b2ac1e50a957dadbda3233216d4ab0cd87 (patch) | |
tree | 857701c78b4733700dbcf2f2ae7591c5109c61e9 /tests/glean/dsfilt.cpp | |
parent | c3da635874bbc8251605aa841c6567ce1427194f (diff) |
Update glean tests to 9417e9534006dd5d94dcf619e599f6315c23da66
Diffstat (limited to 'tests/glean/dsfilt.cpp')
-rw-r--r-- | tests/glean/dsfilt.cpp | 16 |
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)); |