diff options
author | reed <reed@google.com> | 2016-08-29 07:52:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-29 07:52:13 -0700 |
commit | 22b2af1dc42c0b95fe93b9a951313efe438e54cd (patch) | |
tree | 03be47113372671bb64c88bfff51b7dd02ac70a2 /include/private/SkTDArray.h | |
parent | 57879455e56d978464b38c7deebdf41585d2c293 (diff) |
dedup images/blobs/pictures by ID in old serialization format
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2289783002
Review-Url: https://codereview.chromium.org/2289783002
Diffstat (limited to 'include/private/SkTDArray.h')
-rw-r--r-- | include/private/SkTDArray.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h index d6ef3a3834..f71d357005 100644 --- a/include/private/SkTDArray.h +++ b/include/private/SkTDArray.h @@ -217,6 +217,18 @@ public: } } + template <typename S> int select(S&& selector) const { + const T* iter = fArray; + const T* stop = fArray + fCount; + + for (; iter < stop; iter++) { + if (selector(*iter)) { + return SkToInt(iter - fArray); + } + } + return -1; + } + int find(const T& elem) const { const T* iter = fArray; const T* stop = fArray + fCount; |