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

Unified Diff: src/core/SkColorTable.cpp

Issue 1939503002: remove non-static uses of SkOncePtr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: leave it Created 4 years, 8 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/SkTypeface.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 d7253e1d8c123afb0490080de737af63066b1d94..296b31c369e4dd6909cad25fc7fd41d3b7af7cda 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -41,19 +41,19 @@ SkColorTable::SkColorTable(SkPMColor* colors, int count, AllocatedWithMalloc)
SkColorTable::~SkColorTable() {
sk_free(fColors);
- // f16BitCache frees itself
+ sk_free(f16BitCache);
}
#include "SkColorPriv.h"
const uint16_t* SkColorTable::read16BitCache() const {
- return f16BitCache.get([&]{
- auto cache = new uint16_t[fCount];
+ f16BitCacheOnce([this] {
+ f16BitCache = (uint16_t*)sk_malloc_throw(fCount * sizeof(uint16_t));
for (int i = 0; i < fCount; i++) {
- cache[i] = SkPixel32ToPixel16_ToU16(fColors[i]);
+ f16BitCache[i] = SkPixel32ToPixel16_ToU16(fColors[i]);
}
- return cache;
});
+ return f16BitCache;
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkBigPicture.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698