| OLD | NEW |
| 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 #include "GrBatchFontCache.h" | 8 #include "GrBatchFontCache.h" |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 , fPool(9/*start allocations at 512 bytes*/) | 158 , fPool(9/*start allocations at 512 bytes*/) |
| 159 , fAtlasedGlyphs(0) | 159 , fAtlasedGlyphs(0) |
| 160 , fIsAbandoned(false) { | 160 , fIsAbandoned(false) { |
| 161 | 161 |
| 162 fBatchFontCache = cache; // no need to ref, it won't go away before we d
o | 162 fBatchFontCache = cache; // no need to ref, it won't go away before we d
o |
| 163 } | 163 } |
| 164 | 164 |
| 165 GrBatchTextStrike::~GrBatchTextStrike() { | 165 GrBatchTextStrike::~GrBatchTextStrike() { |
| 166 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); | 166 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); |
| 167 while (!iter.done()) { | 167 while (!iter.done()) { |
| 168 (*iter).reset(); | 168 (*iter).free(); |
| 169 ++iter; | 169 ++iter; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe
dID packed, | 173 GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe
dID packed, |
| 174 GrFontScaler* scaler) { | 174 GrFontScaler* scaler) { |
| 175 SkIRect bounds; | 175 SkIRect bounds; |
| 176 if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { | 176 if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { |
| 177 if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) { | 177 if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) { |
| 178 return nullptr; | 178 return nullptr; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect
edMaskFormat, | 234 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect
edMaskFormat, |
| 235 glyph->width(), glyph->height(), | 235 glyph->width(), glyph->height(), |
| 236 storage.get(), &glyph->fAtlasLoca
tion); | 236 storage.get(), &glyph->fAtlasLoca
tion); |
| 237 if (success) { | 237 if (success) { |
| 238 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); | 238 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); |
| 239 fAtlasedGlyphs++; | 239 fAtlasedGlyphs++; |
| 240 } | 240 } |
| 241 return success; | 241 return success; |
| 242 } | 242 } |
| OLD | NEW |