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 |
11 #include "GrBatchAtlas.h" | 11 #include "GrBatchAtlas.h" |
12 #include "GrBatchFontCache.h" | 12 #include "GrBatchFontCache.h" |
| 13 #include "GrColor.h" |
13 #include "SkDescriptor.h" | 14 #include "SkDescriptor.h" |
14 #include "SkMaskFilter.h" | 15 #include "SkMaskFilter.h" |
15 #include "GrMemoryPool.h" | 16 #include "GrMemoryPool.h" |
| 17 #include "SkSurfaceProps.h" |
16 #include "SkTInternalLList.h" | 18 #include "SkTInternalLList.h" |
17 | 19 |
| 20 // With this flag enabled, the GrAtlasTextContext will, as a sanity check, regen
erate every blob |
| 21 // that comes in to verify the integrity of its cache |
| 22 //#define CACHE_SANITY_CHECK // VERY SLOW |
| 23 |
18 /* | 24 /* |
19 * A GrAtlasTextBlob contains a fully processed SkTextBlob, suitable for nearly
immediate drawing | 25 * A GrAtlasTextBlob contains a fully processed SkTextBlob, suitable for nearly
immediate drawing |
20 * on the GPU. These are initially created with valid positions and colors, but
invalid | 26 * on the GPU. These are initially created with valid positions and colors, but
invalid |
21 * texture coordinates. The GrAtlasTextBlob itself has a few Blob-wide properti
es, and also | 27 * texture coordinates. The GrAtlasTextBlob itself has a few Blob-wide properti
es, and also |
22 * 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 |
23 * reordered. | 29 * reordered. |
24 * | 30 * |
25 * 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 |
26 * the GrAtlas will not evict anything the Blob needs. | 32 * the GrAtlas will not evict anything the Blob needs. |
27 * | 33 * |
28 * 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 * |
| 36 * *WARNING* If you add new fields to this struct, then you may need to to updat
e AssertEqual |
29 */ | 37 */ |
30 struct GrAtlasTextBlob : public SkRefCnt { | 38 struct GrAtlasTextBlob : public SkRefCnt { |
31 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrAtlasTextBlob); | 39 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrAtlasTextBlob); |
32 | 40 |
33 /* | 41 /* |
34 * 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. |
35 * 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 |
36 * 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 |
37 * 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 |
38 * should be fairly rare. | 46 * should be fairly rare. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 212 |
205 void* operator new(size_t, void* p) { return p; } | 213 void* operator new(size_t, void* p) { return p; } |
206 void operator delete(void* target, void* placement) { | 214 void operator delete(void* target, void* placement) { |
207 ::operator delete(target, placement); | 215 ::operator delete(target, placement); |
208 } | 216 } |
209 | 217 |
210 bool hasDistanceField() const { return SkToBool(fTextType & kHasDistanceFiel
d_TextType); } | 218 bool hasDistanceField() const { return SkToBool(fTextType & kHasDistanceFiel
d_TextType); } |
211 bool hasBitmap() const { return SkToBool(fTextType & kHasBitmap_TextType); } | 219 bool hasBitmap() const { return SkToBool(fTextType & kHasBitmap_TextType); } |
212 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } | 220 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } |
213 void setHasBitmap() { fTextType |= kHasBitmap_TextType; } | 221 void setHasBitmap() { fTextType |= kHasBitmap_TextType; } |
| 222 |
| 223 #ifdef CACHE_SANITY_CHECK |
| 224 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); |
| 225 size_t fSize; |
| 226 #endif |
214 }; | 227 }; |
215 | 228 |
216 #endif | 229 #endif |
OLD | NEW |