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

Unified Diff: src/core/SkColorTable.cpp

Issue 1322933005: Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBigPicture.cpp ('k') | src/core/SkData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ });
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkBigPicture.cpp ('k') | src/core/SkData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698