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

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

Issue 355673002: Rename GrAtlasMgr to GrAtlas (and other cleanup) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT 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 | « src/gpu/GrLayerCache.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 10 matching lines...) Expand all
21 class GrFontCache; 21 class GrFontCache;
22 class GrGpu; 22 class GrGpu;
23 class GrFontPurgeListener; 23 class GrFontPurgeListener;
24 24
25 /** 25 /**
26 * The textcache maps a hostfontscaler instance to a dictionary of 26 * The textcache maps a hostfontscaler instance to a dictionary of
27 * glyphid->strike 27 * glyphid->strike
28 */ 28 */
29 class GrTextStrike { 29 class GrTextStrike {
30 public: 30 public:
31 GrTextStrike(GrFontCache*, const GrKey* fontScalerKey, GrMaskFormat, GrAtlas Mgr*); 31 GrTextStrike(GrFontCache*, const GrKey* fontScalerKey, GrMaskFormat, GrAtlas *);
32 ~GrTextStrike(); 32 ~GrTextStrike();
33 33
34 const GrKey* getFontScalerKey() const { return fFontScalerKey; } 34 const GrKey* getFontScalerKey() const { return fFontScalerKey; }
35 GrFontCache* getFontCache() const { return fFontCache; } 35 GrFontCache* getFontCache() const { return fFontCache; }
36 GrMaskFormat getMaskFormat() const { return fMaskFormat; } 36 GrMaskFormat getMaskFormat() const { return fMaskFormat; }
37 37
38 inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*); 38 inline GrGlyph* getGlyph(GrGlyph::PackedID, GrFontScaler*);
39 bool addGlyphToAtlas(GrGlyph*, GrFontScaler*); 39 bool addGlyphToAtlas(GrGlyph*, GrFontScaler*);
40 40
41 // testing 41 // testing
(...skipping 10 matching lines...) Expand all
52 GrTextStrike* fPrev; 52 GrTextStrike* fPrev;
53 GrTextStrike* fNext; 53 GrTextStrike* fNext;
54 54
55 private: 55 private:
56 class Key; 56 class Key;
57 GrTHashTable<GrGlyph, Key, 7> fCache; 57 GrTHashTable<GrGlyph, Key, 7> fCache;
58 const GrKey* fFontScalerKey; 58 const GrKey* fFontScalerKey;
59 GrTAllocPool<GrGlyph> fPool; 59 GrTAllocPool<GrGlyph> fPool;
60 60
61 GrFontCache* fFontCache; 61 GrFontCache* fFontCache;
62 GrAtlasMgr* fAtlasMgr; 62 GrAtlas* fAtlas;
63 GrMaskFormat fMaskFormat; 63 GrMaskFormat fMaskFormat;
64 bool fUseDistanceField; 64 bool fUseDistanceField;
65 65
66 GrAtlas fAtlas; 66 GrAtlas::ClientPlotUsage fPlotUsage;
67 67
68 GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler); 68 GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler);
69 69
70 friend class GrFontCache; 70 friend class GrFontCache;
71 }; 71 };
72 72
73 class GrFontCache { 73 class GrFontCache {
74 public: 74 public:
75 GrFontCache(GrGpu*); 75 GrFontCache(GrGpu*);
76 ~GrFontCache(); 76 ~GrFontCache();
77 77
78 inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField); 78 inline GrTextStrike* getStrike(GrFontScaler*, bool useDistanceField);
79 79
80 void freeAll(); 80 void freeAll();
81 81
82 // make an unused plot available 82 // make an unused plot available
83 bool freeUnusedPlot(GrTextStrike* preserveStrike); 83 bool freeUnusedPlot(GrTextStrike* preserveStrike);
84 84
85 // testing 85 // testing
86 int countStrikes() const { return fCache.getArray().count(); } 86 int countStrikes() const { return fCache.getArray().count(); }
87 const GrTextStrike* strikeAt(int index) const { 87 const GrTextStrike* strikeAt(int index) const {
88 return fCache.getArray()[index]; 88 return fCache.getArray()[index];
89 } 89 }
90 GrTextStrike* getHeadStrike() const { return fHead; } 90 GrTextStrike* getHeadStrike() const { return fHead; }
91 91
92 void updateTextures() { 92 void updateTextures() {
93 for (int i = 0; i < kAtlasCount; ++i) { 93 for (int i = 0; i < kAtlasCount; ++i) {
94 if (fAtlasMgr[i]) { 94 if (fAtlases[i]) {
95 fAtlasMgr[i]->uploadPlotsToTexture(); 95 fAtlases[i]->uploadPlotsToTexture();
96 } 96 }
97 } 97 }
98 } 98 }
99 99
100 #ifdef SK_DEBUG 100 #ifdef SK_DEBUG
101 void validate() const; 101 void validate() const;
102 #else 102 #else
103 void validate() const {} 103 void validate() const {}
104 #endif 104 #endif
105 105
(...skipping 11 matching lines...) Expand all
117 private: 117 private:
118 friend class GrFontPurgeListener; 118 friend class GrFontPurgeListener;
119 119
120 class Key; 120 class Key;
121 GrTHashTable<GrTextStrike, Key, 8> fCache; 121 GrTHashTable<GrTextStrike, Key, 8> fCache;
122 // for LRU 122 // for LRU
123 GrTextStrike* fHead; 123 GrTextStrike* fHead;
124 GrTextStrike* fTail; 124 GrTextStrike* fTail;
125 125
126 GrGpu* fGpu; 126 GrGpu* fGpu;
127 GrAtlasMgr* fAtlasMgr[kAtlasCount]; 127 GrAtlas* fAtlases[kAtlasCount];
128 128
129 GrTextStrike* generateStrike(GrFontScaler*, const Key&); 129 GrTextStrike* generateStrike(GrFontScaler*, const Key&);
130 inline void detachStrikeFromList(GrTextStrike*); 130 inline void detachStrikeFromList(GrTextStrike*);
131 void purgeStrike(GrTextStrike* strike); 131 void purgeStrike(GrTextStrike* strike);
132 }; 132 };
133 133
134 #endif 134 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698