Index: src/core/SkColorTable.cpp |
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp |
index ca9a8657c4132cc565e998522978128d89ce6f7c..f52ac909eb0d626fea2323000a6a561bcadb581f 100644 |
--- a/src/core/SkColorTable.cpp |
+++ b/src/core/SkColorTable.cpp |
@@ -47,26 +47,14 @@ SkColorTable::~SkColorTable() { |
#include "SkColorPriv.h" |
-namespace { |
-struct Build16BitCache { |
- const SkPMColor* fColors; |
- int fCount; |
- |
- uint16_t* operator()() const { |
+const uint16_t* SkColorTable::read16BitCache() const { |
+ return f16BitCache.get([&]{ |
uint16_t* cache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t)); |
for (int i = 0; i < fCount; i++) { |
cache[i] = SkPixel32ToPixel16_ToU16(fColors[i]); |
} |
return cache; |
- } |
-}; |
-}//namespace |
- |
-void SkColorTable::Free16BitCache(uint16_t* cache) { sk_free(cache); } |
- |
-const uint16_t* SkColorTable::read16BitCache() const { |
- const Build16BitCache create = { fColors, fCount }; |
- return f16BitCache.get(create); |
+ }); |
} |
/////////////////////////////////////////////////////////////////////////////// |