OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 #include "GrAtlas.h" | 8 #include "GrAtlas.h" |
9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
10 #include "GrRectanizer.h" | 10 #include "GrRectanizer.h" |
11 #include "GrTextStrike.h" | 11 #include "GrTextStrike.h" |
12 #include "GrTextStrike_impl.h" | 12 #include "GrTextStrike_impl.h" |
| 13 #include "SkString.h" |
13 | 14 |
14 SK_DEFINE_INST_COUNT(GrFontScaler) | 15 SK_DEFINE_INST_COUNT(GrFontScaler) |
15 SK_DEFINE_INST_COUNT(GrKey) | 16 SK_DEFINE_INST_COUNT(GrKey) |
16 | 17 |
17 /////////////////////////////////////////////////////////////////////////////// | 18 /////////////////////////////////////////////////////////////////////////////// |
18 | 19 |
19 #define FONT_CACHE_STATS 0 | 20 #define FONT_CACHE_STATS 0 |
20 #if FONT_CACHE_STATS | 21 #if FONT_CACHE_STATS |
21 static int g_PurgeCount = 0; | 22 static int g_PurgeCount = 0; |
22 #endif | 23 #endif |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 count2 = 0; | 164 count2 = 0; |
164 strike = fTail; | 165 strike = fTail; |
165 while (strike) { | 166 while (strike) { |
166 count2 += 1; | 167 count2 += 1; |
167 strike = strike->fPrev; | 168 strike = strike->fPrev; |
168 } | 169 } |
169 SkASSERT(count == count2); | 170 SkASSERT(count == count2); |
170 } | 171 } |
171 #endif | 172 #endif |
172 | 173 |
| 174 #ifdef SK_DEVELOPER |
| 175 void GrFontCache::dump() const { |
| 176 static int gDumpCount = 0; |
| 177 for (int i = 0; i < kMaskFormatCount; ++i) { |
| 178 if (NULL != fAtlasMgr[i]) { |
| 179 GrTexture* texture = fAtlasMgr[i]->getTexture(); |
| 180 if (NULL != texture) { |
| 181 SkString filename; |
| 182 filename.printf("fontcache_%d%d.png", gDumpCount, i); |
| 183 texture->savePixels(filename.c_str()); |
| 184 } |
| 185 } |
| 186 } |
| 187 ++gDumpCount; |
| 188 } |
| 189 #endif |
| 190 |
173 /////////////////////////////////////////////////////////////////////////////// | 191 /////////////////////////////////////////////////////////////////////////////// |
174 | 192 |
175 #ifdef SK_DEBUG | 193 #ifdef SK_DEBUG |
176 static int gCounter; | 194 static int gCounter; |
177 #endif | 195 #endif |
178 | 196 |
179 /* | 197 /* |
180 The text strike is specific to a given font/style/matrix setup, which is | 198 The text strike is specific to a given font/style/matrix setup, which is |
181 represented by the GrHostFontScaler object we are given in getGlyph(). | 199 represented by the GrHostFontScaler object we are given in getGlyph(). |
182 | 200 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 glyph->height(), storage.get(), | 288 glyph->height(), storage.get(), |
271 &glyph->fAtlasLocation); | 289 &glyph->fAtlasLocation); |
272 if (NULL == plot) { | 290 if (NULL == plot) { |
273 return false; | 291 return false; |
274 } | 292 } |
275 | 293 |
276 glyph->fPlot = plot; | 294 glyph->fPlot = plot; |
277 plot->setDrawToken(currentDrawToken); | 295 plot->setDrawToken(currentDrawToken); |
278 return true; | 296 return true; |
279 } | 297 } |
OLD | NEW |