Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Unified Diff: include/core/SkTArray.h

Issue 923583002: [SkSVGDevice] Full font family support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTArray.h
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h
index dea0e38fecae7e2ac10e0f0b7b517c2847e06364..63455a28f5037146c3f127f316e7b2ffd76d95c9 100644
--- a/include/core/SkTArray.h
+++ b/include/core/SkTArray.h
@@ -364,6 +364,30 @@ public:
return !(*this == right);
}
+ int find(const T& elem) const {
f(malita) 2015/02/12 17:37:47 Similar to SkTDArray's helpers.
+ const T* iter = fItemArray;
+ const T* stop = fItemArray + fCount;
+
+ for (; iter < stop; iter++) {
+ if (*iter == elem) {
+ return (int) (iter - fItemArray);
reed1 2015/02/12 17:55:13 SkToInt()
f(malita) 2015/02/12 18:10:19 Done.
+ }
+ }
+ return -1;
+ }
+
+ int rfind(const T& elem) const {
+ const T* iter = fItemArray + fCount;
+ const T* stop = fItemArray;
+
+ while (iter > stop) {
+ if (*--iter == elem) {
+ return SkToInt(iter - stop);
+ }
+ }
+ return -1;
+ }
+
protected:
/**
* Creates an empty array that will use the passed storage block until it
« no previous file with comments | « no previous file | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698