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

Unified Diff: src/core/SkColorTable.cpp

Issue 1334523002: Revert of Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 f52ac909eb0d626fea2323000a6a561bcadb581f..ca9a8657c4132cc565e998522978128d89ce6f7c 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -47,14 +47,26 @@
#include "SkColorPriv.h"
-const uint16_t* SkColorTable::read16BitCache() const {
- return f16BitCache.get([&]{
+namespace {
+struct Build16BitCache {
+ const SkPMColor* fColors;
+ int fCount;
+
+ uint16_t* operator()() const {
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