Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/batches/GrAtlasTextBatch.h

Issue 1503193002: Start objectifying GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/batches/GrAtlasTextBatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 static const size_t kLCDTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16);
19 19
20 // position + local coord 20 // position + local coord
21 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); 21 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16);
22 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);
23 static const int kVerticesPerGlyph = 4; 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;
33 int fSubRun; 33 int fSubRun;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 Geometry& geometry() { return fGeoData[0]; } 82 Geometry& geometry() { return fGeoData[0]; }
83 83
84 void init() { 84 void init() {
85 const Geometry& geo = fGeoData[0]; 85 const Geometry& geo = fGeoData[0];
86 fBatch.fColor = geo.fColor; 86 fBatch.fColor = geo.fColor;
87 fBatch.fViewMatrix = geo.fBlob->fViewMatrix; 87 fBatch.fViewMatrix = geo.fBlob->fViewMatrix;
88 88
89 // We don't yet position distance field text on the cpu, so we have to m ap the vertex bounds 89 // We don't yet position distance field text on the cpu, so we have to m ap the vertex bounds
90 // into device space 90 // into device space
91 const Run& run = geo.fBlob->fRuns[geo.fRun]; 91 const Run& run = geo.fBlob->fRuns[geo.fRun];
92 if (run.fSubRunInfo[geo.fSubRun].fDrawAsDistanceFields) { 92 if (run.fSubRunInfo[geo.fSubRun].drawAsDistanceFields()) {
93 SkRect bounds = run.fVertexBounds; 93 SkRect bounds = run.fVertexBounds;
94 fBatch.fViewMatrix.mapRect(&bounds); 94 fBatch.fViewMatrix.mapRect(&bounds);
95 this->setBounds(bounds); 95 this->setBounds(bounds);
96 } else { 96 } else {
97 this->setBounds(run.fVertexBounds); 97 this->setBounds(run.fVertexBounds);
98 } 98 }
99 } 99 }
100 100
101 const char* name() const override { return "TextBatch"; } 101 const char* name() const override { return "TextBatch"; }
102 102
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 GrBatchFontCache* fFontCache; 220 GrBatchFontCache* fFontCache;
221 221
222 // Distance field properties 222 // Distance field properties
223 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable; 223 SkAutoTUnref<const DistanceAdjustTable> fDistanceAdjustTable;
224 SkColor fFilteredColor; 224 SkColor fFilteredColor;
225 225
226 typedef GrVertexBatch INHERITED; 226 typedef GrVertexBatch INHERITED;
227 }; 227 };
228 228
229 #endif 229 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAtlasTextContext.cpp ('k') | src/gpu/batches/GrAtlasTextBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698