| 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 #include "GrDistanceFieldAdjustTable.h" |
| 14 | 15 |
| 15 class GrAtlasTextBatch : public GrVertexBatch { | 16 class GrAtlasTextBatch : public GrVertexBatch { |
| 16 public: | 17 public: |
| 17 DEFINE_BATCH_CLASS_ID | 18 DEFINE_BATCH_CLASS_ID |
| 18 | 19 |
| 19 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; | 20 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; |
| 20 static const int kIndicesPerGlyph = 6; | 21 static const int kIndicesPerGlyph = 6; |
| 21 | 22 |
| 22 typedef GrAtlasTextContext::DistanceAdjustTable DistanceAdjustTable; | |
| 23 typedef GrAtlasTextBlob Blob; | 23 typedef GrAtlasTextBlob Blob; |
| 24 typedef Blob::Run Run; | 24 typedef Blob::Run Run; |
| 25 typedef Run::SubRunInfo TextInfo; | 25 typedef Run::SubRunInfo TextInfo; |
| 26 struct Geometry { | 26 struct Geometry { |
| 27 Blob* fBlob; | 27 Blob* fBlob; |
| 28 int fRun; | 28 int fRun; |
| 29 int fSubRun; | 29 int fSubRun; |
| 30 GrColor fColor; | 30 GrColor fColor; |
| 31 SkScalar fTransX; | 31 SkScalar fTransX; |
| 32 SkScalar fTransY; | 32 SkScalar fTransY; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 49 break; | 49 break; |
| 50 } | 50 } |
| 51 batch->fBatch.fNumGlyphs = glyphCount; | 51 batch->fBatch.fNumGlyphs = glyphCount; |
| 52 batch->fGeoCount = 1; | 52 batch->fGeoCount = 1; |
| 53 batch->fFilteredColor = 0; | 53 batch->fFilteredColor = 0; |
| 54 batch->fFontCache = fontCache; | 54 batch->fFontCache = fontCache; |
| 55 batch->fUseBGR = false; | 55 batch->fUseBGR = false; |
| 56 return batch; | 56 return batch; |
| 57 } | 57 } |
| 58 | 58 |
| 59 static GrAtlasTextBatch* CreateDistanceField(int glyphCount, GrBatchFontCach
e* fontCache, | 59 static GrAtlasTextBatch* CreateDistanceField( |
| 60 const DistanceAdjustTable* dist
anceAdjustTable, | 60 int glyphCount, GrBatchFontCache*
fontCache, |
| 61 SkColor filteredColor, bool isL
CD, | 61 const GrDistanceFieldAdjustTable*
distanceAdjustTable, |
| 62 bool useBGR) { | 62 SkColor filteredColor, bool isLCD, |
| 63 bool useBGR) { |
| 63 GrAtlasTextBatch* batch = new GrAtlasTextBatch; | 64 GrAtlasTextBatch* batch = new GrAtlasTextBatch; |
| 64 | 65 |
| 65 batch->fFontCache = fontCache; | 66 batch->fFontCache = fontCache; |
| 66 batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistan
ceField_MaskType; | 67 batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistan
ceField_MaskType; |
| 67 batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable)); | 68 batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable)); |
| 68 batch->fFilteredColor = filteredColor; | 69 batch->fFilteredColor = filteredColor; |
| 69 batch->fUseBGR = useBGR; | 70 batch->fUseBGR = useBGR; |
| 70 batch->fBatch.fNumGlyphs = glyphCount; | 71 batch->fBatch.fNumGlyphs = glyphCount; |
| 71 batch->fGeoCount = 1; | 72 batch->fGeoCount = 1; |
| 72 return batch; | 73 return batch; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 kLCDCoverageMask_MaskType, | 190 kLCDCoverageMask_MaskType, |
| 190 kColorBitmapMask_MaskType, | 191 kColorBitmapMask_MaskType, |
| 191 kGrayscaleDistanceField_MaskType, | 192 kGrayscaleDistanceField_MaskType, |
| 192 kLCDDistanceField_MaskType, | 193 kLCDDistanceField_MaskType, |
| 193 } fMaskType; | 194 } fMaskType; |
| 194 bool fUseBGR; // fold this into the enum? | 195 bool fUseBGR; // fold this into the enum? |
| 195 | 196 |
| 196 GrBatchFontCache* fFontCache; | 197 GrBatchFontCache* fFontCache; |
| 197 | 198 |
| 198 // Distance field properties | 199 // Distance field properties |
| 199 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; | 200 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; |
| 200 SkColor fFilteredColor; | 201 SkColor fFilteredColor; |
| 201 | 202 |
| 202 typedef GrVertexBatch INHERITED; | 203 typedef GrVertexBatch INHERITED; |
| 203 }; | 204 }; |
| 204 | 205 |
| 205 #endif | 206 #endif |
| OLD | NEW |