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/gpu/GrTextStrike_impl.h

Issue 780923002: Ganesh text rendering cleanup. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2010 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10
11 #ifndef GrTextStrike_impl_DEFINED
12 #define GrTextStrike_impl_DEFINED
13
14 void GrFontCache::detachStrikeFromList(GrTextStrike* strike) {
15 if (strike->fPrev) {
16 SkASSERT(fHead != strike);
17 strike->fPrev->fNext = strike->fNext;
18 } else {
19 SkASSERT(fHead == strike);
20 fHead = strike->fNext;
21 }
22
23 if (strike->fNext) {
24 SkASSERT(fTail != strike);
25 strike->fNext->fPrev = strike->fPrev;
26 } else {
27 SkASSERT(fTail == strike);
28 fTail = strike->fPrev;
29 }
30 }
31
32 GrTextStrike* GrFontCache::getStrike(GrFontScaler* scaler, bool useDistanceField ) {
33 this->validate();
34
35 GrTextStrike* strike = fCache.find(*(scaler->getKey()));
36 if (NULL == strike) {
37 strike = this->generateStrike(scaler);
38 } else if (strike->fPrev) {
39 // Need to put the strike at the head of its dllist, since that is how
40 // we age the strikes for purging (we purge from the back of the list)
41 this->detachStrikeFromList(strike);
42 // attach at the head
43 fHead->fPrev = strike;
44 strike->fNext = fHead;
45 strike->fPrev = NULL;
46 fHead = strike;
47 }
48 strike->fUseDistanceField = useDistanceField;
49 this->validate();
50 return strike;
51 }
52
53 ///////////////////////////////////////////////////////////////////////////////
54
55 GrGlyph* GrTextStrike::getGlyph(GrGlyph::PackedID packed,
56 GrFontScaler* scaler) {
57 GrGlyph* glyph = fCache.find(packed);
58 if (NULL == glyph) {
59 glyph = this->generateGlyph(packed, scaler);
60 }
61 return glyph;
62 }
63
64 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTextStrike.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698