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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkMaskGamma.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyphCache.h
diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h
index d18b61a0a9d544bd910ca01c469a87b5f69d3467..8b404dcc097f627c687a532986f0ff5ed3046325 100644
--- a/src/core/SkGlyphCache.h
+++ b/src/core/SkGlyphCache.h
@@ -244,8 +244,23 @@
friend class SkGlyphCache_Globals;
};
-class SkAutoGlyphCacheBase {
+class SkAutoGlyphCache {
public:
+ SkAutoGlyphCache(SkGlyphCache* cache) : fCache(cache) {}
+ SkAutoGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) {
+ fCache = SkGlyphCache::DetachCache(typeface, desc);
+ }
+ SkAutoGlyphCache(const SkPaint& paint,
+ const SkDeviceProperties* deviceProperties,
+ const SkMatrix* matrix) {
+ fCache = paint.detachCache(deviceProperties, matrix);
+ }
+ ~SkAutoGlyphCache() {
+ if (fCache) {
+ SkGlyphCache::AttachCache(fCache);
+ }
+ }
+
SkGlyphCache* getCache() const { return fCache; }
void release() {
@@ -255,61 +270,11 @@
}
}
-protected:
- // Hide the constructors so we can't create one of these directly.
- // Create SkAutoGlyphCache or SkAutoGlyphCacheNoCache instead.
- SkAutoGlyphCacheBase(SkGlyphCache* cache) : fCache(cache) {}
- SkAutoGlyphCacheBase(SkTypeface* typeface, const SkDescriptor* desc) {
- fCache = SkGlyphCache::DetachCache(typeface, desc);
- }
- SkAutoGlyphCacheBase(const SkPaint& paint,
- const SkDeviceProperties* deviceProperties,
- const SkMatrix* matrix) {
- fCache = NULL;
- }
- SkAutoGlyphCacheBase() {}
-
+private:
SkGlyphCache* fCache;
-private:
static bool DetachProc(const SkGlyphCache*, void*);
};
-
-class SkAutoGlyphCache : public SkAutoGlyphCacheBase {
-public:
- SkAutoGlyphCache(SkGlyphCache* cache) : SkAutoGlyphCacheBase(cache) {}
- SkAutoGlyphCache(SkTypeface* typeface, const SkDescriptor* desc) :
- SkAutoGlyphCacheBase(typeface, desc) {}
- SkAutoGlyphCache(const SkPaint& paint,
- const SkDeviceProperties* deviceProperties,
- const SkMatrix* matrix) {
- fCache = paint.detachCache(deviceProperties, matrix, false);
- }
- SkAutoGlyphCache() : SkAutoGlyphCacheBase() {
- if (fCache) {
- SkGlyphCache::AttachCache(fCache);
- }
- }
-};
#define SkAutoGlyphCache(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCache)
-class SkAutoGlyphCacheNoGamma : public SkAutoGlyphCacheBase {
-public:
- SkAutoGlyphCacheNoGamma(SkGlyphCache* cache) : SkAutoGlyphCacheBase(cache) {}
- SkAutoGlyphCacheNoGamma(SkTypeface* typeface, const SkDescriptor* desc) :
- SkAutoGlyphCacheBase(typeface, desc) {}
- SkAutoGlyphCacheNoGamma(const SkPaint& paint,
- const SkDeviceProperties* deviceProperties,
- const SkMatrix* matrix) {
- fCache = paint.detachCache(deviceProperties, matrix, true);
- }
- SkAutoGlyphCacheNoGamma() : SkAutoGlyphCacheBase() {
- if (fCache) {
- SkGlyphCache::AttachCache(fCache);
- }
- }
-};
-#define SkAutoGlyphCacheNoGamma(...) SK_REQUIRE_LOCAL_VAR(SkAutoGlyphCacheNoGamma)
-
-
#endif
« 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