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

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

Issue 323513005: Revert of Gamma correction for distance field text. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkMaskGamma.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 SkAutoGlyphCacheBase { 247 class SkAutoGlyphCache {
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
249 SkGlyphCache* getCache() const { return fCache; } 264 SkGlyphCache* getCache() const { return fCache; }
250 265
251 void release() { 266 void release() {
252 if (fCache) { 267 if (fCache) {
253 SkGlyphCache::AttachCache(fCache); 268 SkGlyphCache::AttachCache(fCache);
254 fCache = NULL; 269 fCache = NULL;
255 } 270 }
256 } 271 }
257 272
258 protected: 273 private:
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
272 SkGlyphCache* fCache; 274 SkGlyphCache* fCache;
273 275
274 private:
275 static bool DetachProc(const SkGlyphCache*, void*); 276 static bool DetachProc(const SkGlyphCache*, void*);
276 }; 277 };
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 };
294 #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache) 278 #define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache)
295 279
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
315 #endif 280 #endif
OLDNEW
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkMaskGamma.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698