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

Side by Side Diff: src/pdf/SkPDFCanon.h

Issue 1405053002: SkTHash: hash from fnptr to functor type (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 | « include/private/SkTHash.h ('k') | tests/ChecksumTest.cpp » ('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 #ifndef SkPDFCanon_DEFINED 7 #ifndef SkPDFCanon_DEFINED
8 #define SkPDFCanon_DEFINED 8 #define SkPDFCanon_DEFINED
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 SkTDArray<SkPDFImageShader*> fImageShaderRecords; 95 SkTDArray<SkPDFImageShader*> fImageShaderRecords;
96 96
97 struct WrapGS { 97 struct WrapGS {
98 explicit WrapGS(const SkPDFGraphicState* ptr = nullptr) : fPtr(ptr) {} 98 explicit WrapGS(const SkPDFGraphicState* ptr = nullptr) : fPtr(ptr) {}
99 const SkPDFGraphicState* fPtr; 99 const SkPDFGraphicState* fPtr;
100 bool operator==(const WrapGS& rhs) const { 100 bool operator==(const WrapGS& rhs) const {
101 SkASSERT(fPtr); 101 SkASSERT(fPtr);
102 SkASSERT(rhs.fPtr); 102 SkASSERT(rhs.fPtr);
103 return *fPtr == *rhs.fPtr; 103 return *fPtr == *rhs.fPtr;
104 } 104 }
105 static uint32_t Hash(const WrapGS& w) { 105 struct Hash {
106 SkASSERT(w.fPtr); 106 uint32_t operator()(const WrapGS& w) const {
107 return w.fPtr->hash(); 107 SkASSERT(w.fPtr);
108 } 108 return w.fPtr->hash();
109 }
110 };
109 }; 111 };
110 SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords; 112 SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords;
111 113
112 SkTHashMap<SkBitmapKey, const SkImage*> fBitmapToImageMap; 114 SkTHashMap<SkBitmapKey, const SkImage*> fBitmapToImageMap;
113 SkTHashMap<uint32_t /*ImageUniqueID*/, SkPDFObject*> fPDFBitmapMap; 115 SkTHashMap<uint32_t /*ImageUniqueID*/, SkPDFObject*> fPDFBitmapMap;
114 }; 116 };
115 #endif // SkPDFCanon_DEFINED 117 #endif // SkPDFCanon_DEFINED
OLDNEW
« no previous file with comments | « include/private/SkTHash.h ('k') | tests/ChecksumTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698