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

Side by Side Diff: src/gpu/GrAtlasTextBlob.cpp

Issue 1517563002: Move appending of large glyphs into GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext6
Patch Set: rebase 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/GrAtlasTextBlob.h ('k') | src/gpu/GrAtlasTextContext.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 "GrAtlasTextBlob.h" 8 #include "GrAtlasTextBlob.h"
9 9
10 void GrAtlasTextBlob::appendGlyph(int runIndex, 10 void GrAtlasTextBlob::appendGlyph(int runIndex,
11 const SkRect& positions, 11 const SkRect& positions,
12 GrColor color, 12 GrColor color,
13 GrBatchTextStrike* strike, 13 GrBatchTextStrike* strike,
14 GrGlyph* glyph) { 14 GrGlyph* glyph,
15 GrFontScaler* scaler, const SkGlyph& skGlyph,
16 SkScalar x, SkScalar y, SkScalar scale, bool a pplyVM) {
17
18 // If the glyph is too large we fall back to paths
19 if (glyph->fTooLargeForAtlas) {
20 this->appendLargeGlyph(glyph, scaler, skGlyph, x, y, scale, applyVM);
21 return;
22 }
23
15 Run& run = fRuns[runIndex]; 24 Run& run = fRuns[runIndex];
16 GrMaskFormat format = glyph->fMaskFormat; 25 GrMaskFormat format = glyph->fMaskFormat;
17 26
18 Run::SubRunInfo* subRun = &run.fSubRunInfo.back(); 27 Run::SubRunInfo* subRun = &run.fSubRunInfo.back();
19 if (run.fInitialized && subRun->maskFormat() != format) { 28 if (run.fInitialized && subRun->maskFormat() != format) {
20 subRun = &run.push_back(); 29 subRun = &run.push_back();
21 subRun->setStrike(strike); 30 subRun->setStrike(strike);
22 } else if (!run.fInitialized) { 31 } else if (!run.fInitialized) {
23 subRun->setStrike(strike); 32 subRun->setStrike(strike);
24 } 33 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 88
80 // V3 89 // V3
81 position = reinterpret_cast<SkPoint*>(vertex); 90 position = reinterpret_cast<SkPoint*>(vertex);
82 position->set(positions.fRight, positions.fTop); 91 position->set(positions.fRight, positions.fTop);
83 } 92 }
84 subRun->appendVertices(vertexStride); 93 subRun->appendVertices(vertexStride);
85 fGlyphs[subRun->glyphEndIndex()] = glyph; 94 fGlyphs[subRun->glyphEndIndex()] = glyph;
86 subRun->glyphAppended(); 95 subRun->glyphAppended();
87 } 96 }
88 97
98 void GrAtlasTextBlob::appendLargeGlyph(GrGlyph* glyph, GrFontScaler* scaler, con st SkGlyph& skGlyph,
99 SkScalar x, SkScalar y, SkScalar scale, b ool applyVM) {
100 if (nullptr == glyph->fPath) {
101 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph);
102 if (!glyphPath) {
103 return;
104 }
105
106 glyph->fPath = new SkPath(*glyphPath);
107 }
108 fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, a pplyVM));
109 }
110
89 bool GrAtlasTextBlob::mustRegenerate(SkScalar* outTransX, SkScalar* outTransY, 111 bool GrAtlasTextBlob::mustRegenerate(SkScalar* outTransX, SkScalar* outTransY,
90 const SkPaint& paint, 112 const SkPaint& paint,
91 GrColor color, const SkMaskFilter::BlurRec& blurRec, 113 GrColor color, const SkMaskFilter::BlurRec& blurRec,
92 const SkMatrix& viewMatrix, SkScalar x, SkS calar y) { 114 const SkMatrix& viewMatrix, SkScalar x, SkS calar y) {
93 // If we have LCD text then our canonical color will be set to transparent, in this case we have 115 // If we have LCD text then our canonical color will be set to transparent, in this case we have
94 // to regenerate the blob on any color change 116 // to regenerate the blob on any color change
95 // We use the grPaint to get any color filter effects 117 // We use the grPaint to get any color filter effects
96 if (fKey.fCanonicalColor == SK_ColorTRANSPARENT && 118 if (fKey.fCanonicalColor == SK_ColorTRANSPARENT &&
97 fPaintColor != color) { 119 fPaintColor != color) {
98 return true; 120 return true;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); 301 rSubRun.fBulkUseToken.fPlotAlreadyUpdated);
280 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) { 302 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+ +) {
281 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == 303 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] ==
282 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); 304 rSubRun.fBulkUseToken.fPlotsToUpdate[k]);
283 }*/ 305 }*/
284 } 306 }
285 } 307 }
286 } 308 }
287 309
288 #endif 310 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAtlasTextBlob.h ('k') | src/gpu/GrAtlasTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698