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

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

Issue 1093083003: Some simple optimizations for improving GrAtlasTextContext perf (Closed) Base URL: https://skia.googlesource.com/skia.git@atdfregen
Patch Set: simple optimizations Created 5 years, 8 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/GrBatchAtlas.h ('k') | src/gpu/GrBatchFontCache.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrBatchFontCache_DEFINED 8 #ifndef GrBatchFontCache_DEFINED
9 #define GrBatchFontCache_DEFINED 9 #define GrBatchFontCache_DEFINED
10 10
(...skipping 22 matching lines...) Expand all
33 GrBatchFontCache* getBatchFontCache() const { return fBatchFontCache; } 33 GrBatchFontCache* getBatchFontCache() const { return fBatchFontCache; }
34 34
35 inline GrGlyph* getGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) { 35 inline GrGlyph* getGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) {
36 GrGlyph* glyph = fCache.find(packed); 36 GrGlyph* glyph = fCache.find(packed);
37 if (NULL == glyph) { 37 if (NULL == glyph) {
38 glyph = this->generateGlyph(packed, scaler); 38 glyph = this->generateGlyph(packed, scaler);
39 } 39 }
40 return glyph; 40 return glyph;
41 } 41 }
42 42
43 // returns true if glyph (or glyph+padding for distance field)
44 // is too large to ever fit in texture atlas subregions (GrPlots)
45 bool glyphTooLargeForAtlas(GrGlyph*);
46 // returns true if glyph successfully added to texture atlas, false otherwis e 43 // returns true if glyph successfully added to texture atlas, false otherwis e
47 bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*); 44 bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*);
48 45
49 // testing 46 // testing
50 int countGlyphs() const { return fCache.count(); } 47 int countGlyphs() const { return fCache.count(); }
51 48
52 // remove any references to this plot 49 // remove any references to this plot
53 void removeID(GrBatchAtlas::AtlasID); 50 void removeID(GrBatchAtlas::AtlasID);
54 51
55 // If a TextStrike is abandoned by the cache, then the caller must get a new strike 52 // If a TextStrike is abandoned by the cache, then the caller must get a new strike
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 182
186 static void HandleEviction(GrBatchAtlas::AtlasID, void*); 183 static void HandleEviction(GrBatchAtlas::AtlasID, void*);
187 184
188 GrContext* fContext; 185 GrContext* fContext;
189 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; 186 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache;
190 GrBatchAtlas* fAtlases[kMaskFormatCount]; 187 GrBatchAtlas* fAtlases[kMaskFormatCount];
191 GrBatchTextStrike* fPreserveStrike; 188 GrBatchTextStrike* fPreserveStrike;
192 }; 189 };
193 190
194 #endif 191 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrBatchAtlas.h ('k') | src/gpu/GrBatchFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698