| 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 | 18 |
| 19 // position + local coord | |
| 20 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 kLCDTextVASize = kGrayTextVASize; | |
| 23 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; | 19 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; |
| 24 static const int kIndicesPerGlyph = 6; | 20 static const int kIndicesPerGlyph = 6; |
| 25 | 21 |
| 26 typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable; | 22 typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable; |
| 27 typedef GrAtlasTextBlob Blob; | 23 typedef GrAtlasTextBlob Blob; |
| 28 typedef Blob::Run Run; | 24 typedef Blob::Run Run; |
| 29 typedef Run::SubRunInfo TextInfo; | 25 typedef Run::SubRunInfo TextInfo; |
| 30 struct Geometry { | 26 struct Geometry { |
| 31 Blob* fBlob; | 27 Blob* fBlob; |
| 32 int fRun; | 28 int fRun; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 this->setBounds(bounds); | 91 this->setBounds(bounds); |
| 96 } else { | 92 } else { |
| 97 this->setBounds(run.fVertexBounds); | 93 this->setBounds(run.fVertexBounds); |
| 98 } | 94 } |
| 99 } | 95 } |
| 100 | 96 |
| 101 const char* name() const override { return "TextBatch"; } | 97 const char* name() const override { return "TextBatch"; } |
| 102 | 98 |
| 103 SkString dumpInfo() const override; | 99 SkString dumpInfo() const override; |
| 104 | 100 |
| 105 static size_t GetVertexStride(GrMaskFormat maskFormat) { | |
| 106 switch (maskFormat) { | |
| 107 case kA8_GrMaskFormat: | |
| 108 return kGrayTextVASize; | |
| 109 case kARGB_GrMaskFormat: | |
| 110 return kColorTextVASize; | |
| 111 default: | |
| 112 return kLCDTextVASize; | |
| 113 } | |
| 114 } | |
| 115 | |
| 116 protected: | 101 protected: |
| 117 void computePipelineOptimizations(GrInitInvariantOutput* color, | 102 void computePipelineOptimizations(GrInitInvariantOutput* color, |
| 118 GrInitInvariantOutput* coverage, | 103 GrInitInvariantOutput* coverage, |
| 119 GrBatchToXPOverrides* overrides) const ove
rride; | 104 GrBatchToXPOverrides* overrides) const ove
rride; |
| 120 | 105 |
| 121 | 106 |
| 122 private: | 107 private: |
| 123 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; | 108 void initBatchTracker(const GrXPOverridesForBatch& overrides) override; |
| 124 | 109 |
| 125 struct FlushInfo { | 110 struct FlushInfo { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 GrBatchFontCache* fFontCache; | 196 GrBatchFontCache* fFontCache; |
| 212 | 197 |
| 213 // Distance field properties | 198 // Distance field properties |
| 214 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; | 199 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; |
| 215 SkColor fFilteredColor; | 200 SkColor fFilteredColor; |
| 216 | 201 |
| 217 typedef GrVertexBatch INHERITED; | 202 typedef GrVertexBatch INHERITED; |
| 218 }; | 203 }; |
| 219 | 204 |
| 220 #endif | 205 #endif |
| OLD | NEW |