| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) { | 171 if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) { |
| 172 return nullptr; | 172 return nullptr; |
| 173 } | 173 } |
| 174 } else { | 174 } else { |
| 175 if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) { | 175 if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) { |
| 176 return nullptr; | 176 return nullptr; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph); | 179 GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph); |
| 180 | 180 |
| 181 GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW); | 181 GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph)); |
| 182 glyph->init(packed, bounds, format); | 182 glyph->init(packed, bounds, format); |
| 183 fCache.add(glyph); | 183 fCache.add(glyph); |
| 184 return glyph; | 184 return glyph; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void GrBatchTextStrike::removeID(GrBatchAtlas::AtlasID id) { | 187 void GrBatchTextStrike::removeID(GrBatchAtlas::AtlasID id) { |
| 188 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); | 188 SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); |
| 189 while (!iter.done()) { | 189 while (!iter.done()) { |
| 190 if (id == (*iter).fID) { | 190 if (id == (*iter).fID) { |
| 191 (*iter).fID = GrBatchAtlas::kInvalidAtlasID; | 191 (*iter).fID = GrBatchAtlas::kInvalidAtlasID; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect
edMaskFormat, | 226 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect
edMaskFormat, |
| 227 glyph->width(), glyph->height(), | 227 glyph->width(), glyph->height(), |
| 228 storage.get(), &glyph->fAtlasLoca
tion); | 228 storage.get(), &glyph->fAtlasLoca
tion); |
| 229 if (success) { | 229 if (success) { |
| 230 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); | 230 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); |
| 231 fAtlasedGlyphs++; | 231 fAtlasedGlyphs++; |
| 232 } | 232 } |
| 233 return success; | 233 return success; |
| 234 } | 234 } |
| OLD | NEW |