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); |
18 | 19 |
19 // position + local coord | 20 // position + local coord |
20 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); | 21 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); |
21 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + si
zeof(SkIPoint16); | 22 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 |
116 protected: | 125 protected: |
117 void computePipelineOptimizations(GrInitInvariantOutput* color, | 126 void computePipelineOptimizations(GrInitInvariantOutput* color, |
118 GrInitInvariantOutput* coverage, | 127 GrInitInvariantOutput* coverage, |
119 GrBatchToXPOverrides* overrides) const ove
rride; | 128 GrBatchToXPOverrides* overrides) const ove
rride; |
120 | 129 |
121 | 130 |
122 private: | 131 private: |
123 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; | 132 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; |
124 | 133 |
125 struct FlushInfo { | 134 struct FlushInfo { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 GrBatchFontCache* fFontCache; | 220 GrBatchFontCache* fFontCache; |
212 | 221 |
213 // Distance field properties | 222 // Distance field properties |
214 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; | 223 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; |
215 SkColor fFilteredColor; | 224 SkColor fFilteredColor; |
216 | 225 |
217 typedef GrVertexBatch INHERITED; | 226 typedef GrVertexBatch INHERITED; |
218 }; | 227 }; |
219 | 228 |
220 #endif | 229 #endif |
OLD | NEW |