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 GrAtlasTextBatch_DEFINED | 8 #ifndef GrAtlasTextBatch_DEFINED |
9 #define GrAtlasTextBatch_DEFINED | 9 #define GrAtlasTextBatch_DEFINED |
10 | 10 |
11 #include "batches/GrVertexBatch.h" | 11 #include "batches/GrVertexBatch.h" |
12 | 12 |
13 #include "GrAtlasTextContext.h" | 13 #include "GrAtlasTextContext.h" |
14 | 14 |
15 class GrAtlasTextBatch : public GrVertexBatch { | 15 class GrAtlasTextBatch : public GrVertexBatch { |
16 public: | 16 public: |
17 DEFINE_BATCH_CLASS_ID | 17 DEFINE_BATCH_CLASS_ID |
18 static const size_t kLCDTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); | |
19 | 18 |
20 // position + local coord | 19 // position + local coord |
21 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); | 20 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); |
22 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + si
zeof(SkIPoint16); | 21 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + si
zeof(SkIPoint16); |
| 22 static const size_t kLCDTextVASize = kGrayTextVASize; |
23 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; | 23 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; |
24 static const int kIndicesPerGlyph = 6; | 24 static const int kIndicesPerGlyph = 6; |
25 | 25 |
26 typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable; | 26 typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable; |
27 typedef GrAtlasTextBlob Blob; | 27 typedef GrAtlasTextBlob Blob; |
28 typedef Blob::Run Run; | 28 typedef Blob::Run Run; |
29 typedef Run::SubRunInfo TextInfo; | 29 typedef Run::SubRunInfo TextInfo; |
30 struct Geometry { | 30 struct Geometry { |
31 Blob* fBlob; | 31 Blob* fBlob; |
32 int fRun; | 32 int fRun; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 switch (maskFormat) { | 106 switch (maskFormat) { |
107 case kA8_GrMaskFormat: | 107 case kA8_GrMaskFormat: |
108 return kGrayTextVASize; | 108 return kGrayTextVASize; |
109 case kARGB_GrMaskFormat: | 109 case kARGB_GrMaskFormat: |
110 return kColorTextVASize; | 110 return kColorTextVASize; |
111 default: | 111 default: |
112 return kLCDTextVASize; | 112 return kLCDTextVASize; |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 static size_t GetVertexStrideDf(GrMaskFormat maskFormat, bool useLCDText) { | |
117 SkASSERT(maskFormat == kA8_GrMaskFormat); | |
118 if (useLCDText) { | |
119 return kLCDTextVASize; | |
120 } else { | |
121 return kGrayTextVASize; | |
122 } | |
123 } | |
124 | |
125 protected: | 116 protected: |
126 void computePipelineOptimizations(GrInitInvariantOutput* color, | 117 void computePipelineOptimizations(GrInitInvariantOutput* color, |
127 GrInitInvariantOutput* coverage, | 118 GrInitInvariantOutput* coverage, |
128 GrBatchToXPOverrides* overrides) const ove
rride; | 119 GrBatchToXPOverrides* overrides) const ove
rride; |
129 | 120 |
130 | 121 |
131 private: | 122 private: |
132 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; | 123 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; |
133 | 124 |
134 struct FlushInfo { | 125 struct FlushInfo { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 GrBatchFontCache* fFontCache; | 211 GrBatchFontCache* fFontCache; |
221 | 212 |
222 // Distance field properties | 213 // Distance field properties |
223 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; | 214 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; |
224 SkColor fFilteredColor; | 215 SkColor fFilteredColor; |
225 | 216 |
226 typedef GrVertexBatch INHERITED; | 217 typedef GrVertexBatch INHERITED; |
227 }; | 218 }; |
228 | 219 |
229 #endif | 220 #endif |
OLD | NEW |