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

Side by Side Diff: src/core/SkGlyphCache.h

Issue 258883002: Gamma correction for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Don't use SkPaint distance field flag for filtering the ScalarContext::Rec; add getGammaLUT* commen… Created 6 years, 6 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkGlyphCache_DEFINED 10 #ifndef SkGlyphCache_DEFINED
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void* fData; 237 void* fData;
238 }; 238 };
239 AuxProcRec* fAuxProcList; 239 AuxProcRec* fAuxProcList;
240 void invokeAndRemoveAuxProcs(); 240 void invokeAndRemoveAuxProcs();
241 241
242 inline static SkGlyphCache* FindTail(SkGlyphCache* head); 242 inline static SkGlyphCache* FindTail(SkGlyphCache* head);
243 243
244 friend class SkGlyphCache_Globals; 244 friend class SkGlyphCache_Globals;
245 }; 245 };
246 246
247 class SkAutoGlyphCache { 247 class SkAutoGlyphCacheBase {
248 public: 248 public:
249 SkAutoGlyphCache(SkGlyphCache* cache) : fCache(cache) {}
250 SkAutoGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) {
251 fCache = SkGlyphCache::DetachCache(typeface, desc);
252 }
253 SkAutoGlyphCache(const SkPaint& paint,
254 const SkDeviceProperties* deviceProperties,
255 const SkMatrix* matrix) {
256 fCache = paint.detachCache(deviceProperties, matrix);
257 }
258 ~SkAutoGlyphCache() {
259 if (fCache) {
260 SkGlyphCache::AttachCache(fCache);
261 }
262 }
263
264 SkGlyphCache* getCache() const { return fCache; } 249 SkGlyphCache* getCache() const { return fCache; }
265 250
266 void release() { 251 void release() {
267 if (fCache) { 252 if (fCache) {
268 SkGlyphCache::AttachCache(fCache); 253 SkGlyphCache::AttachCache(fCache);
269 fCache = NULL; 254 fCache = NULL;
270 } 255 }
271 } 256 }
272 257
273 private: 258 protected:
259 // Hide the constructors so we can't create one of these directly.
260 // Create SkAutoGlyphCache or SkAutoGlyphCacheNoCache instead.
261 SkAutoGlyphCacheBase(SkGlyphCache* cache) : fCache(cache) {}
262 SkAutoGlyphCacheBase(SkTypeface* typeface, const SkDescriptor* desc) {
263 fCache = SkGlyphCache::DetachCache(typeface, desc);
264 }
265 SkAutoGlyphCacheBase(const SkPaint& paint,
266 const SkDeviceProperties* deviceProperties,
267 const SkMatrix* matrix) {
268 fCache = NULL;
269 }
270 SkAutoGlyphCacheBase() {}
271
274 SkGlyphCache* fCache; 272 SkGlyphCache* fCache;
275 273
274 private:
276 static bool DetachProc(const SkGlyphCache*, void*); 275 static bool DetachProc(const SkGlyphCache*, void*);
277 }; 276 };
277
278 class SkAutoGlyphCache : public SkAutoGlyphCacheBase {
279 public:
280 SkAutoGlyphCache(SkGlyphCache* cache) : SkAutoGlyphCacheBase(cache) {}
281 SkAutoGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) :
282 SkAutoGlyphCacheBase(typeface, desc) {}
283 SkAutoGlyphCache(const SkPaint& paint,
284 const SkDeviceProperties* deviceProperties,
285 const SkMatrix* matrix) {
286 fCache = paint.detachCache(deviceProperties, matrix, false);
287 }
288 SkAutoGlyphCache() : SkAutoGlyphCacheBase() {
289 if (fCache) {
290 SkGlyphCache::AttachCache(fCache);
291 }
292 }
293 };
278 #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache) 294 #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache)
279 295
296 class SkAutoGlyphCacheNoGamma : public SkAutoGlyphCacheBase {
297 public:
298 SkAutoGlyphCacheNoGamma(SkGlyphCache* cache) : SkAutoGlyphCacheBase(cache) { }
299 SkAutoGlyphCacheNoGamma(SkTypeface* typeface, const SkDescriptor* desc) :
300 SkAutoGlyphCacheBase(typeface, desc) {}
301 SkAutoGlyphCacheNoGamma(const SkPaint& paint,
302 const SkDeviceProperties* deviceProperties,
303 const SkMatrix* matrix) {
304 fCache = paint.detachCache(deviceProperties, matrix, true);
305 }
306 SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {
307 if (fCache) {
308 SkGlyphCache::AttachCache(fCache);
309 }
310 }
311 };
312 #define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamm a)
313
314
280 #endif 315 #endif
OLDNEW
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkMaskGamma.h » ('j') | src/core/SkScalerContext.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698