OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 | |
11 #include "GrAtlas.h" | 8 #include "GrAtlas.h" |
12 #include "GrGpu.h" | 9 #include "GrGpu.h" |
13 #include "GrRectanizer.h" | 10 #include "GrRectanizer.h" |
14 #include "GrTextStrike.h" | 11 #include "GrTextStrike.h" |
15 #include "GrTextStrike_impl.h" | 12 #include "GrTextStrike_impl.h" |
16 #include "GrRect.h" | |
17 | 13 |
18 SK_DEFINE_INST_COUNT(GrFontScaler) | 14 SK_DEFINE_INST_COUNT(GrFontScaler) |
19 SK_DEFINE_INST_COUNT(GrKey) | 15 SK_DEFINE_INST_COUNT(GrKey) |
20 | 16 |
21 /////////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////////// |
22 | 18 |
23 GrFontCache::GrFontCache(GrGpu* gpu) : fGpu(gpu) { | 19 GrFontCache::GrFontCache(GrGpu* gpu) : fGpu(gpu) { |
24 gpu->ref(); | 20 gpu->ref(); |
25 fAtlasMgr = NULL; | 21 fAtlasMgr = NULL; |
26 | 22 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 fCache.getArray().visitAll(FreeGlyph); | 148 fCache.getArray().visitAll(FreeGlyph); |
153 | 149 |
154 #if GR_DEBUG | 150 #if GR_DEBUG |
155 gCounter -= 1; | 151 gCounter -= 1; |
156 // GrPrintf("~GrTextStrike %p %d\n", this, gCounter); | 152 // GrPrintf("~GrTextStrike %p %d\n", this, gCounter); |
157 #endif | 153 #endif |
158 } | 154 } |
159 | 155 |
160 GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, | 156 GrGlyph* GrTextStrike::generateGlyph(GrGlyph::PackedID packed, |
161 GrFontScaler* scaler) { | 157 GrFontScaler* scaler) { |
162 GrIRect bounds; | 158 SkIRect bounds; |
163 if (!scaler->getPackedGlyphBounds(packed, &bounds)) { | 159 if (!scaler->getPackedGlyphBounds(packed, &bounds)) { |
164 return NULL; | 160 return NULL; |
165 } | 161 } |
166 | 162 |
167 GrGlyph* glyph = fPool.alloc(); | 163 GrGlyph* glyph = fPool.alloc(); |
168 glyph->init(packed, bounds); | 164 glyph->init(packed, bounds); |
169 fCache.insert(packed, glyph); | 165 fCache.insert(packed, glyph); |
170 return glyph; | 166 return glyph; |
171 } | 167 } |
172 | 168 |
(...skipping 27 matching lines...) Expand all Loading... |
200 fMaskFormat, | 196 fMaskFormat, |
201 &glyph->fAtlasLocation); | 197 &glyph->fAtlasLocation); |
202 if (NULL == atlas) { | 198 if (NULL == atlas) { |
203 return false; | 199 return false; |
204 } | 200 } |
205 | 201 |
206 // update fAtlas as well, since they may be chained in a linklist | 202 // update fAtlas as well, since they may be chained in a linklist |
207 glyph->fAtlas = fAtlas = atlas; | 203 glyph->fAtlas = fAtlas = atlas; |
208 return true; | 204 return true; |
209 } | 205 } |
OLD | NEW |