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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 fSubRunInfo.push_back(); | 71 fSubRunInfo.push_back(); |
72 } | 72 } |
73 struct SubRunInfo { | 73 struct SubRunInfo { |
74 SubRunInfo() | 74 SubRunInfo() |
75 : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration) | 75 : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration) |
76 , fVertexStartIndex(0) | 76 , fVertexStartIndex(0) |
77 , fVertexEndIndex(0) | 77 , fVertexEndIndex(0) |
78 , fGlyphStartIndex(0) | 78 , fGlyphStartIndex(0) |
79 , fGlyphEndIndex(0) | 79 , fGlyphEndIndex(0) |
80 , fDrawAsDistanceFields(false) {} | 80 , fDrawAsDistanceFields(false) {} |
81 SubRunInfo(const SubRunInfo& that) | |
82 : fBulkUseToken(that.fBulkUseToken) | |
83 , fStrike(SkRef(that.fStrike.get())) | |
84 , fAtlasGeneration(that.fAtlasGeneration) | |
85 , fVertexStartIndex(that.fVertexStartIndex) | |
86 , fVertexEndIndex(that.fVertexEndIndex) | |
87 , fGlyphStartIndex(that.fGlyphStartIndex) | |
88 , fGlyphEndIndex(that.fGlyphEndIndex) | |
89 , fTextRatio(that.fTextRatio) | |
90 , fMaskFormat(that.fMaskFormat) | |
91 , fDrawAsDistanceFields(that.fDrawAsDistanceFields) | |
92 , fUseLCDText(that.fUseLCDText) { | |
93 } | |
94 // Distance field text cannot draw coloremoji, and so has to fall ba
ck. However, | 81 // Distance field text cannot draw coloremoji, and so has to fall ba
ck. However, |
95 // though the distance field text and the coloremoji may share the s
ame run, they | 82 // though the distance field text and the coloremoji may share the s
ame run, they |
96 // will have different descriptors. If fOverrideDescriptor is non-N
ULL, then it | 83 // will have different descriptors. If fOverrideDescriptor is non-N
ULL, then it |
97 // will be used in place of the run's descriptor to regen texture co
ords | 84 // will be used in place of the run's descriptor to regen texture co
ords |
98 // TODO we could have a descriptor cache, it would reduce the size o
f these blobs | 85 // TODO we could have a descriptor cache, it would reduce the size o
f these blobs |
99 // significantly, and then the subrun could just have a refed pointe
r to the | 86 // significantly, and then the subrun could just have a refed pointe
r to the |
100 // correct descriptor. | 87 // correct descriptor. |
101 GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; | 88 GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; |
102 SkAutoTUnref<GrBatchTextStrike> fStrike; | |
103 uint64_t fAtlasGeneration; | 89 uint64_t fAtlasGeneration; |
104 size_t fVertexStartIndex; | 90 size_t fVertexStartIndex; |
105 size_t fVertexEndIndex; | 91 size_t fVertexEndIndex; |
106 uint32_t fGlyphStartIndex; | 92 uint32_t fGlyphStartIndex; |
107 uint32_t fGlyphEndIndex; | 93 uint32_t fGlyphEndIndex; |
108 SkScalar fTextRatio; // df property | 94 SkScalar fTextRatio; // df property |
109 GrMaskFormat fMaskFormat; | 95 GrMaskFormat fMaskFormat; |
110 bool fDrawAsDistanceFields; // df property | 96 bool fDrawAsDistanceFields; // df property |
111 bool fUseLCDText; // df property | 97 bool fUseLCDText; // df property |
112 }; | 98 }; |
113 | 99 |
114 SubRunInfo& push_back() { | 100 SubRunInfo& push_back() { |
115 // Forward glyph / vertex information to seed the new sub run | 101 // Forward glyph / vertex information to seed the new sub run |
116 SubRunInfo& newSubRun = fSubRunInfo.push_back(); | 102 SubRunInfo& newSubRun = fSubRunInfo.push_back(); |
117 SubRunInfo& prevSubRun = fSubRunInfo.fromBack(1); | 103 SubRunInfo& prevSubRun = fSubRunInfo.fromBack(1); |
118 | 104 |
119 newSubRun.fGlyphStartIndex = prevSubRun.fGlyphEndIndex; | 105 newSubRun.fGlyphStartIndex = prevSubRun.fGlyphEndIndex; |
120 newSubRun.fGlyphEndIndex = prevSubRun.fGlyphEndIndex; | 106 newSubRun.fGlyphEndIndex = prevSubRun.fGlyphEndIndex; |
121 | 107 |
122 newSubRun.fVertexStartIndex = prevSubRun.fVertexEndIndex; | 108 newSubRun.fVertexStartIndex = prevSubRun.fVertexEndIndex; |
123 newSubRun.fVertexEndIndex = prevSubRun.fVertexEndIndex; | 109 newSubRun.fVertexEndIndex = prevSubRun.fVertexEndIndex; |
124 return newSubRun; | 110 return newSubRun; |
125 } | 111 } |
126 static const int kMinSubRuns = 1; | 112 static const int kMinSubRuns = 1; |
| 113 SkAutoTUnref<GrBatchTextStrike> fStrike; |
127 SkAutoTUnref<SkTypeface> fTypeface; | 114 SkAutoTUnref<SkTypeface> fTypeface; |
128 SkRect fVertexBounds; | 115 SkRect fVertexBounds; |
129 SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo; | 116 SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo; |
130 SkAutoDescriptor fDescriptor; | 117 SkAutoDescriptor fDescriptor; |
131 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties | 118 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties |
132 GrColor fColor; | 119 GrColor fColor; |
133 bool fInitialized; | 120 bool fInitialized; |
134 bool fDrawAsPaths; | 121 bool fDrawAsPaths; |
135 }; | 122 }; |
136 | 123 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } | 221 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } |
235 void setHasBitmap() { fTextType |= kHasBitmap_TextType; } | 222 void setHasBitmap() { fTextType |= kHasBitmap_TextType; } |
236 | 223 |
237 #ifdef CACHE_SANITY_CHECK | 224 #ifdef CACHE_SANITY_CHECK |
238 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); | 225 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); |
239 size_t fSize; | 226 size_t fSize; |
240 #endif | 227 #endif |
241 }; | 228 }; |
242 | 229 |
243 #endif | 230 #endif |
OLD | NEW |