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

Side by Side Diff: include/private/SkTHash.h

Issue 1372783003: SkPDF: Implement drawImage*() properly (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « gyp/pdf.gyp ('k') | src/pdf/SkJpegInfo.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTHash_DEFINED 8 #ifndef SkTHash_DEFINED
9 #define SkTHash_DEFINED 9 #define SkTHash_DEFINED
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void foreach(Fn&& fn) { 235 void foreach(Fn&& fn) {
236 fTable.foreach([&fn](Pair* p){ fn(p->key, &p->val); }); 236 fTable.foreach([&fn](Pair* p){ fn(p->key, &p->val); });
237 } 237 }
238 238
239 // Call fn on every key/value pair in the table. You may not mutate anythin g. 239 // Call fn on every key/value pair in the table. You may not mutate anythin g.
240 template <typename Fn> // f(K, V), f(const K&, V), f(K, const V&) or f(cons t K&, const V&). 240 template <typename Fn> // f(K, V), f(const K&, V), f(K, const V&) or f(cons t K&, const V&).
241 void foreach(Fn&& fn) const { 241 void foreach(Fn&& fn) const {
242 fTable.foreach([&fn](const Pair& p){ fn(p.key, p.val); }); 242 fTable.foreach([&fn](const Pair& p){ fn(p.key, p.val); });
243 } 243 }
244 244
245 // Call fn on every value in the table. You may not mutate anything.
246 template <typename Fn> // f(const V&) or f(V)
247 void foreachValue(Fn&& fn) const {
mtklein 2015/09/27 07:20:32 What value does this add? Can you not just ignore
248 fTable.foreach([&fn](const Pair& p) { fn(p.val); });
249 }
250
245 private: 251 private:
246 struct Pair { 252 struct Pair {
247 K key; 253 K key;
248 V val; 254 V val;
249 static const K& GetKey(const Pair& p) { return p.key; } 255 static const K& GetKey(const Pair& p) { return p.key; }
250 static uint32_t Hash(const K& key) { return HashK(key); } 256 static uint32_t Hash(const K& key) { return HashK(key); }
251 }; 257 };
252 258
253 SkTHashTable<Pair, K> fTable; 259 SkTHashTable<Pair, K> fTable;
254 }; 260 };
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 298
293 private: 299 private:
294 struct Traits { 300 struct Traits {
295 static const T& GetKey(const T& item) { return item; } 301 static const T& GetKey(const T& item) { return item; }
296 static uint32_t Hash(const T& item) { return HashT(item); } 302 static uint32_t Hash(const T& item) { return HashT(item); }
297 }; 303 };
298 SkTHashTable<T, T, Traits> fTable; 304 SkTHashTable<T, T, Traits> fTable;
299 }; 305 };
300 306
301 #endif//SkTHash_DEFINED 307 #endif//SkTHash_DEFINED
OLDNEW
« no previous file with comments | « gyp/pdf.gyp ('k') | src/pdf/SkJpegInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698