| 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 #ifndef GrAtlasTextBlob_DEFINED | 8 #ifndef GrAtlasTextBlob_DEFINED |
| 9 #define GrAtlasTextBlob_DEFINED | 9 #define GrAtlasTextBlob_DEFINED |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * consists of a number of runs. Runs inside a blob are flushed individually so
they can be | 28 * consists of a number of runs. Runs inside a blob are flushed individually so
they can be |
| 29 * reordered. | 29 * reordered. |
| 30 * | 30 * |
| 31 * The only thing(aside from a memcopy) required to flush a GrAtlasTextBlob is t
o ensure that | 31 * The only thing(aside from a memcopy) required to flush a GrAtlasTextBlob is t
o ensure that |
| 32 * the GrAtlas will not evict anything the Blob needs. | 32 * the GrAtlas will not evict anything the Blob needs. |
| 33 * | 33 * |
| 34 * Note: This struct should really be named GrCachedAtasTextBlob, but that is to
o verbose. | 34 * Note: This struct should really be named GrCachedAtasTextBlob, but that is to
o verbose. |
| 35 * | 35 * |
| 36 * *WARNING* If you add new fields to this struct, then you may need to to updat
e AssertEqual | 36 * *WARNING* If you add new fields to this struct, then you may need to to updat
e AssertEqual |
| 37 */ | 37 */ |
| 38 struct GrAtlasTextBlob : public SkRefCnt { | 38 struct GrAtlasTextBlob : public SkNVRefCnt<GrAtlasTextBlob> { |
| 39 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrAtlasTextBlob); | 39 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrAtlasTextBlob); |
| 40 | 40 |
| 41 /* | 41 /* |
| 42 * Each Run inside of the blob can have its texture coordinates regenerated
if required. | 42 * Each Run inside of the blob can have its texture coordinates regenerated
if required. |
| 43 * To determine if regeneration is necessary, fAtlasGeneration is used. If
there have been | 43 * To determine if regeneration is necessary, fAtlasGeneration is used. If
there have been |
| 44 * any evictions inside of the atlas, then we will simply regenerate Runs.
We could track | 44 * any evictions inside of the atlas, then we will simply regenerate Runs.
We could track |
| 45 * this at a more fine grained level, but its not clear if this is worth it,
as evictions | 45 * this at a more fine grained level, but its not clear if this is worth it,
as evictions |
| 46 * should be fairly rare. | 46 * should be fairly rare. |
| 47 * | 47 * |
| 48 * One additional point, each run can contain glyphs with any of the three m
ask formats. | 48 * One additional point, each run can contain glyphs with any of the three m
ask formats. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 SkScalar fMaxMinScale; | 231 SkScalar fMaxMinScale; |
| 232 SkScalar fMinMaxScale; | 232 SkScalar fMinMaxScale; |
| 233 int fRunCount; | 233 int fRunCount; |
| 234 uint8_t fTextType; | 234 uint8_t fTextType; |
| 235 | 235 |
| 236 GrAtlasTextBlob() | 236 GrAtlasTextBlob() |
| 237 : fMaxMinScale(-SK_ScalarMax) | 237 : fMaxMinScale(-SK_ScalarMax) |
| 238 , fMinMaxScale(SK_ScalarMax) | 238 , fMinMaxScale(SK_ScalarMax) |
| 239 , fTextType(0) {} | 239 , fTextType(0) {} |
| 240 | 240 |
| 241 ~GrAtlasTextBlob() override { | 241 ~GrAtlasTextBlob() { |
| 242 for (int i = 0; i < fRunCount; i++) { | 242 for (int i = 0; i < fRunCount; i++) { |
| 243 fRuns[i].~Run(); | 243 fRuns[i].~Run(); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 static const Key& GetKey(const GrAtlasTextBlob& blob) { | 247 static const Key& GetKey(const GrAtlasTextBlob& blob) { |
| 248 return blob.fKey; | 248 return blob.fKey; |
| 249 } | 249 } |
| 250 | 250 |
| 251 static uint32_t Hash(const Key& key) { | 251 static uint32_t Hash(const Key& key) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 static const int kVerticesPerGlyph = 4; | 289 static const int kVerticesPerGlyph = 4; |
| 290 | 290 |
| 291 #ifdef CACHE_SANITY_CHECK | 291 #ifdef CACHE_SANITY_CHECK |
| 292 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); | 292 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); |
| 293 size_t fSize; | 293 size_t fSize; |
| 294 #endif | 294 #endif |
| 295 }; | 295 }; |
| 296 | 296 |
| 297 #endif | 297 #endif |
| OLD | NEW |