aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLCaps.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-02-20 12:35:32 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-02-20 12:35:32 -0800
commit2aa1f7e6799501974532d35c1f6c3a0447121b95 (patch)
treebd4ad170d9a5205cf1e93fb5d19665eb3d6cb900 /src/gpu/gl/GrGLCaps.h
parente5524cd52d56f9b70d9b4a83bd73a3fa75d56509 (diff)
Port GrGLCaps over to use SkTHash.
I've written some new hashtable interfaces that should be easier to use, and I've been trying to roll them out bit by bit, hopefully replacing SkTDynamicHash, SkTMultiMap, SkTHashCache, etc. This turns the cache in GrGLCaps::readPixelsSupported() into an SkTHashMap, mapping the format key to a bool. Functionally, it's the same. BUG=skia: Review URL: https://codereview.chromium.org/948473002
Diffstat (limited to 'src/gpu/gl/GrGLCaps.h')
-rw-r--r--src/gpu/gl/GrGLCaps.h48
1 files changed, 13 insertions, 35 deletions
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 527cd33ee3..1b77ed0e32 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -12,7 +12,7 @@
#include "GrDrawTargetCaps.h"
#include "GrGLStencilBuffer.h"
#include "SkChecksum.h"
-#include "SkTHashCache.h"
+#include "SkTHash.h"
#include "SkTArray.h"
class GrGLContextInfo;
@@ -393,45 +393,23 @@ private:
const char* fFBFetchColorName;
const char* fFBFetchExtensionString;
- class ReadPixelsSupportedFormats {
- public:
- struct Key {
- GrGLenum fFormat;
- GrGLenum fType;
- GrGLenum fFboFormat;
-
- bool operator==(const Key& rhs) const {
- return fFormat == rhs.fFormat
- && fType == rhs.fType
- && fFboFormat == rhs.fFboFormat;
- }
-
- uint32_t getHash() const {
- return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), sizeof(*this));
- }
- };
-
- ReadPixelsSupportedFormats(Key key, bool value) : fKey(key), fValue(value) {
- }
-
- static const Key& GetKey(const ReadPixelsSupportedFormats& element) {
- return element.fKey;
- }
+ struct ReadPixelsSupportedFormat {
+ GrGLenum fFormat;
+ GrGLenum fType;
+ GrGLenum fFboFormat;
- static uint32_t Hash(const Key& key) {
- return key.getHash();
+ bool operator==(const ReadPixelsSupportedFormat& rhs) const {
+ return fFormat == rhs.fFormat
+ && fType == rhs.fType
+ && fFboFormat == rhs.fFboFormat;
}
-
- bool value() const {
- return fValue;
+ static uint32_t Hash(const ReadPixelsSupportedFormat& r) {
+ return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&r), sizeof(r));
}
- private:
- Key fKey;
- bool fValue;
};
- mutable SkTHashCache<ReadPixelsSupportedFormats,
- ReadPixelsSupportedFormats::Key> fReadPixelsSupportedCache;
+ mutable SkTHashMap<ReadPixelsSupportedFormat, bool, ReadPixelsSupportedFormat::Hash>
+ fReadPixelsSupportedCache;
typedef GrDrawTargetCaps INHERITED;
};