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

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

Issue 1698503002: Remove last bit of privacy violation for GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase + nits Created 4 years, 10 months 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/GrBatchAtlas.h ('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 "text/GrAtlasTextContext.h" 13 #include "text/GrAtlasTextContext.h"
14 #include "text/GrDistanceFieldAdjustTable.h" 14 #include "text/GrDistanceFieldAdjustTable.h"
15 15
16 class GrAtlasTextBatch : public GrVertexBatch { 16 class GrAtlasTextBatch : public GrVertexBatch {
17 public: 17 public:
18 DEFINE_BATCH_CLASS_ID 18 DEFINE_BATCH_CLASS_ID
19 19
20 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph; 20 static const int kVerticesPerGlyph = GrAtlasTextBlob::kVerticesPerGlyph;
21 static const int kIndicesPerGlyph = 6; 21 static const int kIndicesPerGlyph = 6;
22 22
23 typedef GrAtlasTextBlob Blob; 23 typedef GrAtlasTextBlob Blob;
24 typedef Blob::Run Run;
25 typedef Run::SubRunInfo TextInfo;
26 struct Geometry { 24 struct Geometry {
27 Blob* fBlob; 25 Blob* fBlob;
28 int fRun; 26 int fRun;
29 int fSubRun; 27 int fSubRun;
30 GrColor fColor; 28 GrColor fColor;
31 SkScalar fTransX; 29 SkScalar fTransX;
32 SkScalar fTransY; 30 SkScalar fTransY;
33 }; 31 };
34 32
35 static GrAtlasTextBatch* CreateBitmap(GrMaskFormat maskFormat, int glyphCoun t, 33 static GrAtlasTextBatch* CreateBitmap(GrMaskFormat maskFormat, int glyphCoun t,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 bool usesDistanceFields() const { 131 bool usesDistanceFields() const {
134 return kGrayscaleDistanceField_MaskType == fMaskType || 132 return kGrayscaleDistanceField_MaskType == fMaskType ||
135 kLCDDistanceField_MaskType == fMaskType; 133 kLCDDistanceField_MaskType == fMaskType;
136 } 134 }
137 135
138 bool isLCD() const { 136 bool isLCD() const {
139 return kLCDCoverageMask_MaskType == fMaskType || 137 return kLCDCoverageMask_MaskType == fMaskType ||
140 kLCDDistanceField_MaskType == fMaskType; 138 kLCDDistanceField_MaskType == fMaskType;
141 } 139 }
142 140
143 template <bool regenTexCoords, bool regenPos, bool regenCol, bool regenGlyph s>
144 inline void regenBlob(Target* target, FlushInfo* flushInfo, Blob* blob, Run* run,
145 TextInfo* info, SkGlyphCache** cache,
146 SkTypeface** typeface, GrFontScaler** scaler, const Sk Descriptor** desc,
147 const GrGeometryProcessor* gp, int glyphCount, size_t vertexStride,
148 GrColor color, SkScalar transX, SkScalar transY) const ;
149
150 inline void flush(GrVertexBatch::Target* target, FlushInfo* flushInfo) const ; 141 inline void flush(GrVertexBatch::Target* target, FlushInfo* flushInfo) const ;
151 142
152 GrColor color() const { return fBatch.fColor; } 143 GrColor color() const { return fBatch.fColor; }
153 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } 144 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; }
154 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 145 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
155 int numGlyphs() const { return fBatch.fNumGlyphs; } 146 int numGlyphs() const { return fBatch.fNumGlyphs; }
156 147
157 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override; 148 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override;
158 149
159 // TODO just use class params 150 // TODO just use class params
(...skipping 24 matching lines...) Expand all
184 kLCDDistanceField_MaskType, 175 kLCDDistanceField_MaskType,
185 } fMaskType; 176 } fMaskType;
186 bool fUseBGR; // fold this into the enum? 177 bool fUseBGR; // fold this into the enum?
187 178
188 GrBatchFontCache* fFontCache; 179 GrBatchFontCache* fFontCache;
189 180
190 // Distance field properties 181 // Distance field properties
191 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; 182 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
192 SkColor fFilteredColor; 183 SkColor fFilteredColor;
193 184
185 friend class GrBlobRegenHelper; // Needs to trigger flushes
186
194 typedef GrVertexBatch INHERITED; 187 typedef GrVertexBatch INHERITED;
195 }; 188 };
196 189
190 /*
191 * A simple helper class to abstract the interface GrAtlasTextBlob needs to rege nerate itself.
192 * It'd be nicer if this was nested, but we need to forward declare it in GrAtla sTextBlob.h
193 */
194 class GrBlobRegenHelper {
195 public:
196 GrBlobRegenHelper(const GrAtlasTextBatch* batch,
197 GrVertexBatch::Target* target,
198 GrAtlasTextBatch::FlushInfo* flushInfo,
199 const GrGeometryProcessor* gp)
200 : fBatch(batch)
201 , fTarget(target)
202 , fFlushInfo(flushInfo)
203 , fGP(gp) {}
204
205 void flush();
206
207 void incGlyphCount(int glyphCount = 1) {
208 fFlushInfo->fGlyphsToFlush += glyphCount;
209 }
210
211 private:
212 const GrAtlasTextBatch* fBatch;
213 GrVertexBatch::Target* fTarget;
214 GrAtlasTextBatch::FlushInfo* fFlushInfo;
215 const GrGeometryProcessor* fGP;
216 };
217
197 #endif 218 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrBatchAtlas.h ('k') | src/gpu/batches/GrAtlasTextBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698