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

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

Issue 177463003: New approach for GPU font atlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary reference to GrAtlasMgr 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/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrTextStrike.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 19 matching lines...) Expand all
30 class GrTextStrike { 30 class GrTextStrike {
31 public: 31 public:
32 GrTextStrike(GrFontCache*, const GrKey* fontScalerKey, GrMaskFormat, GrAtlas Mgr*); 32 GrTextStrike(GrFontCache*, const GrKey* fontScalerKey, GrMaskFormat, GrAtlas Mgr*);
33 ~GrTextStrike(); 33 ~GrTextStrike();
34 34
35 const GrKey* getFontScalerKey() const { return fFontScalerKey; } 35 const GrKey* getFontScalerKey() const { return fFontScalerKey; }
36 GrFontCache* getFontCache() const { return fFontCache; } 36 GrFontCache* getFontCache() const { return fFontCache; }
37 GrMaskFormat getMaskFormat() const { return fMaskFormat; } 37 GrMaskFormat getMaskFormat() const { return fMaskFormat; }
38 38
39 inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*); 39 inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*);
40 bool getGlyphAtlas(GrGlyph*, GrFontScaler*); 40 bool addGlyphToAtlas(GrGlyph*, GrFontScaler*);
41 41
42 SkISize getAtlasSize() const { return fAtlas.getSize(); } 42 SkISize getAtlasSize() const { return fAtlas.getSize(); }
43 43
44 // testing 44 // testing
45 int countGlyphs() const { return fCache.getArray().count(); } 45 int countGlyphs() const { return fCache.getArray().count(); }
46 const GrGlyph* glyphAt(int index) const { 46 const GrGlyph* glyphAt(int index) const {
47 return fCache.getArray()[index]; 47 return fCache.getArray()[index];
48 } 48 }
49 49
50 // returns true if a plot was removed 50 // remove any references to this plot
51 bool removeUnusedPlots(); 51 void removePlot(const GrPlot* plot);
52 52
53 public: 53 public:
54 // for LRU 54 // for easy removal from list
55 GrTextStrike* fPrev; 55 GrTextStrike* fPrev;
56 GrTextStrike* fNext; 56 GrTextStrike* fNext;
57 57
58 private: 58 private:
59 class Key; 59 class Key;
60 GrTHashTable<GrGlyph, Key, 7> fCache; 60 GrTHashTable<GrGlyph, Key, 7> fCache;
61 const GrKey* fFontScalerKey; 61 const GrKey* fFontScalerKey;
62 GrTAllocPool<GrGlyph> fPool; 62 GrTAllocPool<GrGlyph> fPool;
63 63
64 GrFontCache* fFontCache; 64 GrFontCache* fFontCache;
(...skipping 16 matching lines...) Expand all
81 ~GrFontCache(); 81 ~GrFontCache();
82 82
83 #if SK_DISTANCEFIELD_FONTS 83 #if SK_DISTANCEFIELD_FONTS
84 inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField); 84 inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField);
85 #else 85 #else
86 inline GrTextStrike* getStrike(GrFontScaler*); 86 inline GrTextStrike* getStrike(GrFontScaler*);
87 #endif 87 #endif
88 88
89 void freeAll(); 89 void freeAll();
90 90
91 void purgeExceptFor(GrTextStrike*); 91 // make an unused plot available
92 92 bool freeUnusedPlot(GrTextStrike* preserveStrike);
93 // remove an unused plot and its strike (if necessary)
94 void freePlotExceptFor(GrTextStrike*);
95 93
96 // testing 94 // testing
97 int countStrikes() const { return fCache.getArray().count(); } 95 int countStrikes() const { return fCache.getArray().count(); }
98 const GrTextStrike* strikeAt(int index) const { 96 const GrTextStrike* strikeAt(int index) const {
99 return fCache.getArray()[index]; 97 return fCache.getArray()[index];
100 } 98 }
101 GrTextStrike* getHeadStrike() const { return fHead; } 99 GrTextStrike* getHeadStrike() const { return fHead; }
102 100
103 #ifdef SK_DEBUG 101 #ifdef SK_DEBUG
104 void validate() const; 102 void validate() const;
(...skipping 25 matching lines...) Expand all
130 128
131 GrGpu* fGpu; 129 GrGpu* fGpu;
132 GrAtlasMgr* fAtlasMgr[kAtlasCount]; 130 GrAtlasMgr* fAtlasMgr[kAtlasCount];
133 131
134 GrTextStrike* generateStrike(GrFontScaler*, const Key&); 132 GrTextStrike* generateStrike(GrFontScaler*, const Key&);
135 inline void detachStrikeFromList(GrTextStrike*); 133 inline void detachStrikeFromList(GrTextStrike*);
136 void purgeStrike(GrTextStrike* strike); 134 void purgeStrike(GrTextStrike* strike);
137 }; 135 };
138 136
139 #endif 137 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698