diff options
author | mtklein <mtklein@chromium.org> | 2015-02-20 12:35:32 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-20 12:35:32 -0800 |
commit | 2aa1f7e6799501974532d35c1f6c3a0447121b95 (patch) | |
tree | bd4ad170d9a5205cf1e93fb5d19665eb3d6cb900 /src/gpu/gl/GrGLCaps.cpp | |
parent | e5524cd52d56f9b70d9b4a83bd73a3fa75d56509 (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.cpp')
-rw-r--r-- | src/gpu/gl/GrGLCaps.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp index 1f50f8d1e1..9911d53f43 100644 --- a/src/gpu/gl/GrGLCaps.cpp +++ b/src/gpu/gl/GrGLCaps.cpp @@ -749,20 +749,13 @@ bool GrGLCaps::readPixelsSupported(const GrGLInterface* intf, GrGLenum format, GrGLenum type, GrGLenum currFboFormat) const { - - ReadPixelsSupportedFormats::Key key = {format, type, currFboFormat}; - - ReadPixelsSupportedFormats* cachedValue = fReadPixelsSupportedCache.find(key); - - if (NULL == cachedValue) { - bool value = doReadPixelsSupported(intf, format, type); - ReadPixelsSupportedFormats newValue(key, value); - fReadPixelsSupportedCache.add(newValue); - - return newValue.value(); + ReadPixelsSupportedFormat key = {format, type, currFboFormat}; + if (const bool* supported = fReadPixelsSupportedCache.find(key)) { + return *supported; } - - return cachedValue->value(); + bool supported = this->doReadPixelsSupported(intf, format, type); + fReadPixelsSupportedCache.set(key, supported); + return supported; } void GrGLCaps::initFSAASupport(const GrGLContextInfo& ctxInfo, const GrGLInterface* gli) { |