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

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

Issue 1716443005: Calculate translations to apply to vertices in batch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/batches/GrAtlasTextBatch.h ('k') | src/gpu/text/GrAtlasTextBlob.h » ('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 #include "GrAtlasTextBatch.h" 8 #include "GrAtlasTextBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 16 matching lines...) Expand all
27 27
28 static const int kDistanceAdjustLumShift = 5; 28 static const int kDistanceAdjustLumShift = 5;
29 29
30 SkString GrAtlasTextBatch::dumpInfo() const { 30 SkString GrAtlasTextBatch::dumpInfo() const {
31 SkString str; 31 SkString str;
32 32
33 for (int i = 0; i < fGeoCount; ++i) { 33 for (int i = 0; i < fGeoCount; ++i) {
34 str.appendf("%d: Color: 0x%08x Trans: %.2f,%.2f Runs: %d\n", 34 str.appendf("%d: Color: 0x%08x Trans: %.2f,%.2f Runs: %d\n",
35 i, 35 i,
36 fGeoData[i].fColor, 36 fGeoData[i].fColor,
37 fGeoData[i].fTransX, 37 fGeoData[i].fX,
38 fGeoData[i].fTransY, 38 fGeoData[i].fY,
39 fGeoData[i].fBlob->runCount()); 39 fGeoData[i].fBlob->runCount());
40 } 40 }
41 41
42 str.append(INHERITED::dumpInfo()); 42 str.append(INHERITED::dumpInfo());
43 return str; 43 return str;
44 } 44 }
45 45
46 void GrAtlasTextBatch::computePipelineOptimizations(GrInitInvariantOutput* color , 46 void GrAtlasTextBatch::computePipelineOptimizations(GrInitInvariantOutput* color ,
47 GrInitInvariantOutput* cover age, 47 GrInitInvariantOutput* cover age,
48 GrBatchToXPOverrides* overri des) const { 48 GrBatchToXPOverrides* overri des) const {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 GrFontScaler* scaler = nullptr; 141 GrFontScaler* scaler = nullptr;
142 SkTypeface* typeface = nullptr; 142 SkTypeface* typeface = nullptr;
143 143
144 GrBlobRegenHelper helper(this, target, &flushInfo, gp); 144 GrBlobRegenHelper helper(this, target, &flushInfo, gp);
145 145
146 for (int i = 0; i < fGeoCount; i++) { 146 for (int i = 0; i < fGeoCount; i++) {
147 const Geometry& args = fGeoData[i]; 147 const Geometry& args = fGeoData[i];
148 Blob* blob = args.fBlob; 148 Blob* blob = args.fBlob;
149 size_t byteCount; 149 size_t byteCount;
150 void* blobVertices; 150 void* blobVertices;
151 int glyphCount; 151 int subRunGlyphCount;
152 blob->regenInBatch(target, fFontCache, &helper, args.fRun, args.fSubRun, &cache, 152 blob->regenInBatch(target, fFontCache, &helper, args.fRun, args.fSubRun, &cache,
153 &typeface, &scaler, &desc, vertexStride, args.fColor, args.fTransX, 153 &typeface, &scaler, &desc, vertexStride, args.fViewMa trix, args.fX,
154 args.fTransY, &blobVertices, &byteCount, &glyphCount) ; 154 args.fY, args.fColor, &blobVertices, &byteCount, &sub RunGlyphCount);
155 155
156 // now copy all vertices 156 // now copy all vertices
157 memcpy(currVertex, blobVertices, byteCount); 157 memcpy(currVertex, blobVertices, byteCount);
158 158
159 #ifdef SK_DEBUG 159 #ifdef SK_DEBUG
160 // bounds sanity check 160 // bounds sanity check
161 SkRect rect; 161 SkRect rect;
162 rect.setLargestInverted(); 162 rect.setLargestInverted();
163 SkPoint* vertex = (SkPoint*) ((char*)blobVertices); 163 SkPoint* vertex = (SkPoint*) ((char*)blobVertices);
164 rect.growToInclude(vertex, vertexStride, kVerticesPerGlyph * glyphCount) ; 164 rect.growToInclude(vertex, vertexStride, kVerticesPerGlyph * subRunGlyph Count);
165 165
166 if (this->usesDistanceFields()) { 166 if (this->usesDistanceFields()) {
167 fBatch.fViewMatrix.mapRect(&rect); 167 args.fViewMatrix.mapRect(&rect);
168 } 168 }
169 SkASSERT(fBounds.contains(rect)); 169 SkASSERT(fBounds.contains(rect));
170 #endif 170 #endif
171 171
172 currVertex += byteCount; 172 currVertex += byteCount;
173 } 173 }
174 174
175 // Make sure to attach the last cache if applicable 175 // Make sure to attach the last cache if applicable
176 if (cache) { 176 if (cache) {
177 SkGlyphCache::AttachCache(cache); 177 SkGlyphCache::AttachCache(cache);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 this->usesLocalCoords()); 308 this->usesLocalCoords());
309 #endif 309 #endif
310 } 310 }
311 311
312 } 312 }
313 313
314 void GrBlobRegenHelper::flush() { 314 void GrBlobRegenHelper::flush() {
315 fBatch->flush(fTarget, fFlushInfo); 315 fBatch->flush(fTarget, fFlushInfo);
316 fTarget->initDraw(fGP, fBatch->pipeline()); 316 fTarget->initDraw(fGP, fBatch->pipeline());
317 } 317 }
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.h ('k') | src/gpu/text/GrAtlasTextBlob.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698