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

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

Issue 23120004: Change Atlas recycling to track current flush count and recycle if Atlas not used in current flush. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Disable font cache stats Created 7 years, 4 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 | Annotate | Revision Log
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 public: 30 public:
31 GrTextStrike(GrFontCache*, const GrKey* fontScalerKey, GrMaskFormat, 31 GrTextStrike(GrFontCache*, const GrKey* fontScalerKey, GrMaskFormat,
32 GrAtlasMgr*); 32 GrAtlasMgr*);
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 getGlyphAtlas(GrGlyph*, GrFontScaler*, uint64_t currentFlushCount);
41 41
42 // testing 42 // testing
43 int countGlyphs() const { return fCache.getArray().count(); } 43 int countGlyphs() const { return fCache.getArray().count(); }
44 const GrGlyph* glyphAt(int index) const { 44 const GrGlyph* glyphAt(int index) const {
45 return fCache.getArray()[index]; 45 return fCache.getArray()[index];
46 } 46 }
47 GrAtlas* getAtlas() const { return fAtlas; } 47 GrAtlas* getAtlas() const { return fAtlas; }
48 48
49 // returns true if an atlas was removed 49 // returns true if an atlas was removed
50 bool removeUnusedAtlases(); 50 bool removeUnusedAtlases(uint64_t currentFlushCount);
51 51
52 public: 52 public:
53 // for LRU 53 // for LRU
54 GrTextStrike* fPrev; 54 GrTextStrike* fPrev;
55 GrTextStrike* fNext; 55 GrTextStrike* fNext;
56 56
57 private: 57 private:
58 class Key; 58 class Key;
59 GrTHashTable<GrGlyph, Key, 7> fCache; 59 GrTHashTable<GrGlyph, Key, 7> fCache;
60 const GrKey* fFontScalerKey; 60 const GrKey* fFontScalerKey;
(...skipping 17 matching lines...) Expand all
78 GrFontCache(GrGpu*); 78 GrFontCache(GrGpu*);
79 ~GrFontCache(); 79 ~GrFontCache();
80 80
81 inline GrTextStrike* getStrike(GrFontScaler*); 81 inline GrTextStrike* getStrike(GrFontScaler*);
82 82
83 void freeAll(); 83 void freeAll();
84 84
85 void purgeExceptFor(GrTextStrike*); 85 void purgeExceptFor(GrTextStrike*);
86 86
87 // remove an unused atlas and its strike (if necessary) 87 // remove an unused atlas and its strike (if necessary)
88 void freeAtlasExceptFor(GrTextStrike*); 88 void freeAtlasExceptFor(GrTextStrike*, uint64_t currentFlushCount);
89 89
90 // testing 90 // testing
91 int countStrikes() const { return fCache.getArray().count(); } 91 int countStrikes() const { return fCache.getArray().count(); }
92 const GrTextStrike* strikeAt(int index) const { 92 const GrTextStrike* strikeAt(int index) const {
93 return fCache.getArray()[index]; 93 return fCache.getArray()[index];
94 } 94 }
95 GrTextStrike* getHeadStrike() const { return fHead; } 95 GrTextStrike* getHeadStrike() const { return fHead; }
96 96
97 #if GR_DEBUG 97 #if GR_DEBUG
98 void validate() const; 98 void validate() const;
(...skipping 12 matching lines...) Expand all
111 111
112 GrGpu* fGpu; 112 GrGpu* fGpu;
113 GrAtlasMgr* fAtlasMgr; 113 GrAtlasMgr* fAtlasMgr;
114 114
115 115
116 GrTextStrike* generateStrike(GrFontScaler*, const Key&); 116 GrTextStrike* generateStrike(GrFontScaler*, const Key&);
117 inline void detachStrikeFromList(GrTextStrike*); 117 inline void detachStrikeFromList(GrTextStrike*);
118 }; 118 };
119 119
120 #endif 120 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698