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

Side by Side Diff: src/gpu/GrTextStrike_impl.h

Issue 193163003: Enable use of distance fields via SkPaint flag. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change HACK to TEMP Created 6 years, 9 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 | « src/gpu/GrTextStrike.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('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 2010 Google Inc. 3 * Copyright 2010 Google Inc.
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 10
(...skipping 30 matching lines...) Expand all
41 41
42 if (strike->fNext) { 42 if (strike->fNext) {
43 SkASSERT(fTail != strike); 43 SkASSERT(fTail != strike);
44 strike->fNext->fPrev = strike->fPrev; 44 strike->fNext->fPrev = strike->fPrev;
45 } else { 45 } else {
46 SkASSERT(fTail == strike); 46 SkASSERT(fTail == strike);
47 fTail = strike->fPrev; 47 fTail = strike->fPrev;
48 } 48 }
49 } 49 }
50 50
51 #if SK_DISTANCEFIELD_FONTS
52 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler, bool useDistanceField ) { 51 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler, bool useDistanceField ) {
53 #else
54 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler) {
55 #endif
56 this->validate(); 52 this->validate();
57 53
58 const Key key(scaler->getKey()); 54 const Key key(scaler->getKey());
59 GrTextStrike* strike = fCache.find(key); 55 GrTextStrike* strike = fCache.find(key);
60 if (NULL == strike) { 56 if (NULL == strike) {
61 strike = this->generateStrike(scaler, key); 57 strike = this->generateStrike(scaler, key);
62 } else if (strike->fPrev) { 58 } else if (strike->fPrev) {
63 // Need to put the strike at the head of its dllist, since that is how 59 // Need to put the strike at the head of its dllist, since that is how
64 // we age the strikes for purging (we purge from the back of the list 60 // we age the strikes for purging (we purge from the back of the list
65 this->detachStrikeFromList(strike); 61 this->detachStrikeFromList(strike);
66 // attach at the head 62 // attach at the head
67 fHead->fPrev = strike; 63 fHead->fPrev = strike;
68 strike->fNext = fHead; 64 strike->fNext = fHead;
69 strike->fPrev = NULL; 65 strike->fPrev = NULL;
70 fHead = strike; 66 fHead = strike;
71 } 67 }
72 #if SK_DISTANCEFIELD_FONTS
73 strike->fUseDistanceField = useDistanceField; 68 strike->fUseDistanceField = useDistanceField;
74 #endif
75 this->validate(); 69 this->validate();
76 return strike; 70 return strike;
77 } 71 }
78 72
79 /////////////////////////////////////////////////////////////////////////////// 73 ///////////////////////////////////////////////////////////////////////////////
80 74
81 /** 75 /**
82 * This Key just wraps a glyphID, and matches the protocol need for 76 * This Key just wraps a glyphID, and matches the protocol need for
83 * GrTHashTable 77 * GrTHashTable
84 */ 78 */
(...skipping 17 matching lines...) Expand all
102 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed, 96 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed,
103 GrFontScaler* scaler) { 97 GrFontScaler* scaler) {
104 GrGlyph* glyph = fCache.find(packed); 98 GrGlyph* glyph = fCache.find(packed);
105 if (NULL == glyph) { 99 if (NULL == glyph) {
106 glyph = this->generateGlyph(packed, scaler); 100 glyph = this->generateGlyph(packed, scaler);
107 } 101 }
108 return glyph; 102 return glyph;
109 } 103 }
110 104
111 #endif 105 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTextStrike.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698