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

Unified Diff: src/gpu/effects/GrTextureStripAtlas.h

Issue 88113002: Speed up GrResourceCache lookup by inlining GrBinHashKey comparisons (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review comments Created 7 years, 1 month 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
Index: src/gpu/effects/GrTextureStripAtlas.h
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index e56e736d7716c4e87d1f5ce495031954bb71059e..6e7025a5cb57d28978f2af76b3fbd319704f85e3 100644
--- a/src/gpu/effects/GrTextureStripAtlas.h
+++ b/src/gpu/effects/GrTextureStripAtlas.h
@@ -136,12 +136,15 @@ private:
// Hash table entry for atlases
class AtlasEntry;
- typedef GrTBinHashKey<AtlasEntry, sizeof(GrTextureStripAtlas::Desc)> AtlasHashKey;
+ class AtlasHashKey : public GrBinHashKey<sizeof(GrTextureStripAtlas::Desc)> {
+ public:
+ static bool equals(const AtlasEntry& entry, const AtlasHashKey& key);
bsalomon 2013/11/27 14:46:01 I prefer the new names as well. But static functio
Kimmo Kinnunen 2013/11/28 07:38:34 Done.
+ static bool lessThan(const AtlasEntry& entry, const AtlasHashKey& key);
+ };
class AtlasEntry : public ::SkNoncopyable {
public:
AtlasEntry() : fAtlas(NULL) {}
~AtlasEntry() { SkDELETE(fAtlas); }
- int compare(const AtlasHashKey& key) const { return fKey.compare(key); }
AtlasHashKey fKey;
GrTextureStripAtlas* fAtlas;
};
@@ -178,4 +181,12 @@ private:
SkTDArray<AtlasRow*> fKeyTable;
};
+inline bool GrTextureStripAtlas::AtlasHashKey::equals(const AtlasEntry& entry, const AtlasHashKey& key) {
mtklein 2013/11/27 14:36:54 Wrap these guys to 100 columns?
Kimmo Kinnunen 2013/11/28 07:38:34 Done.
+ return entry.fKey == key;
+}
+
+inline bool GrTextureStripAtlas::AtlasHashKey::lessThan(const AtlasEntry& entry, const AtlasHashKey& key) {
+ return entry.fKey < key;
+}
+
#endif

Powered by Google App Engine
This is Rietveld 408576698