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

Side by Side Diff: src/core/SkMaskCache.cpp

Issue 851273003: YUV planes cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: static cast at the right spot Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMaskCache.h" 8 #include "SkMaskCache.h"
9 9
10 #define CHECK_LOCAL(localCache, localName, globalName, ...) \ 10 #define CHECK_LOCAL(localCache, localName, globalName, ...) \
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 RectsBlurKey fKey; 142 RectsBlurKey fKey;
143 MaskValue fValue; 143 MaskValue fValue;
144 144
145 const Key& getKey() const SK_OVERRIDE { return fKey; } 145 const Key& getKey() const SK_OVERRIDE { return fKey; }
146 size_t bytesUsed() const SK_OVERRIDE { return sizeof(*this) + fValue.fData-> size(); } 146 size_t bytesUsed() const SK_OVERRIDE { return sizeof(*this) + fValue.fData-> size(); }
147 147
148 static bool Visitor(const SkResourceCache::Rec& baseRec, void* contextData) { 148 static bool Visitor(const SkResourceCache::Rec& baseRec, void* contextData) {
149 const RectsBlurRec& rec = static_cast<const RectsBlurRec&>(baseRec); 149 const RectsBlurRec& rec = static_cast<const RectsBlurRec&>(baseRec);
150 MaskValue* result = (MaskValue*)contextData; 150 MaskValue* result = static_cast<MaskValue*>(contextData);
151 151
152 SkCachedData* tmpData = rec.fValue.fData; 152 SkCachedData* tmpData = rec.fValue.fData;
153 tmpData->ref(); 153 tmpData->ref();
154 if (NULL == tmpData->data()) { 154 if (NULL == tmpData->data()) {
155 tmpData->unref(); 155 tmpData->unref();
156 return false; 156 return false;
157 } 157 }
158 *result = rec.fValue; 158 *result = rec.fValue;
159 return true; 159 return true;
160 } 160 }
(...skipping 13 matching lines...) Expand all
174 mask->fImage = (uint8_t*)(result.fData->data()); 174 mask->fImage = (uint8_t*)(result.fData->data());
175 return result.fData; 175 return result.fData;
176 } 176 }
177 177
178 void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality, 178 void SkMaskCache::Add(SkScalar sigma, SkBlurStyle style, SkBlurQuality quality,
179 const SkRect rects[], int count, const SkMask& mask, SkCac hedData* data, 179 const SkRect rects[], int count, const SkMask& mask, SkCac hedData* data,
180 SkResourceCache* localCache) { 180 SkResourceCache* localCache) {
181 RectsBlurKey key(sigma, style, quality, rects, count); 181 RectsBlurKey key(sigma, style, quality, rects, count);
182 return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(RectsBlurRec, (key, mask , data))); 182 return CHECK_LOCAL(localCache, add, Add, SkNEW_ARGS(RectsBlurRec, (key, mask , data)));
183 } 183 }
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | src/core/SkYUVPlanesCache.h » ('j') | src/core/SkYUVPlanesCache.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698