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

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

Issue 1502253003: Allow LCD text to batch across colorchanges. This will always use (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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 | « no previous file | src/gpu/batches/GrAtlasTextBatch.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 #include "GrAtlasTextContext.h" 7 #include "GrAtlasTextContext.h"
8 8
9 #include "GrBlurUtils.h" 9 #include "GrBlurUtils.h"
10 #include "GrDrawContext.h" 10 #include "GrDrawContext.h"
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 run.fInitialized = true; 1007 run.fInitialized = true;
1008 1008
1009 size_t vertexStride = GrAtlasTextBatch::GetVertexStride(format); 1009 size_t vertexStride = GrAtlasTextBatch::GetVertexStride(format);
1010 1010
1011 SkRect r; 1011 SkRect r;
1012 r.fLeft = SkIntToScalar(x); 1012 r.fLeft = SkIntToScalar(x);
1013 r.fTop = SkIntToScalar(y); 1013 r.fTop = SkIntToScalar(y);
1014 r.fRight = r.fLeft + SkIntToScalar(width); 1014 r.fRight = r.fLeft + SkIntToScalar(width);
1015 r.fBottom = r.fTop + SkIntToScalar(height); 1015 r.fBottom = r.fTop + SkIntToScalar(height);
1016 subRun->setMaskFormat(format); 1016 subRun->setMaskFormat(format);
1017 blob->appendGlyph(&run, subRun, r, color, vertexStride, kA8_GrMaskFormat == format, glyph); 1017 blob->appendGlyph(&run, subRun, r, color, vertexStride,
1018 kARGB_GrMaskFormat != format, glyph);
1018 } 1019 }
1019 1020
1020 bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, 1021 bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
1021 const SkGlyph& skGlyph, 1022 const SkGlyph& skGlyph,
1022 SkScalar sx, SkScalar sy, GrColor color, 1023 SkScalar sx, SkScalar sy, GrColor color,
1023 GrFontScaler* scaler, 1024 GrFontScaler* scaler,
1024 SkScalar textRatio, const SkMatrix& viewM atrix) { 1025 SkScalar textRatio, const SkMatrix& viewM atrix) {
1025 Run& run = blob->fRuns[runIndex]; 1026 Run& run = blob->fRuns[runIndex];
1026 if (!fCurrStrike) { 1027 if (!fCurrStrike) {
1027 fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler); 1028 fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 } 1064 }
1064 1065
1065 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); 1066 PerSubRunInfo* subRun = &run.fSubRunInfo.back();
1066 if (!run.fInitialized) { 1067 if (!run.fInitialized) {
1067 subRun->setStrike(fCurrStrike); 1068 subRun->setStrike(fCurrStrike);
1068 } 1069 }
1069 run.fInitialized = true; 1070 run.fInitialized = true;
1070 SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat); 1071 SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat);
1071 subRun->setMaskFormat(kA8_GrMaskFormat); 1072 subRun->setMaskFormat(kA8_GrMaskFormat);
1072 1073
1073 size_t vertexStride = GrAtlasTextBatch::GetVertexStrideDf(kA8_GrMaskFormat, 1074 size_t vertexStride = GrAtlasTextBatch::GetVertexStride(kA8_GrMaskFormat);
1074 subRun->hasUseLCDT ext());
1075 1075
1076 bool useColorVerts = !subRun->hasUseLCDText(); 1076 blob->appendGlyph(&run, subRun, glyphRect, color, vertexStride, true, glyph) ;
1077 blob->appendGlyph(&run, subRun, glyphRect, color, vertexStride, useColorVert s, glyph);
1078 return true; 1077 return true;
1079 } 1078 }
1080 1079
1081 inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph, 1080 inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph,
1082 GrFontScaler* scaler, const SkGl yph& skGlyph, 1081 GrFontScaler* scaler, const SkGl yph& skGlyph,
1083 SkScalar x, SkScalar y, SkScalar scale, 1082 SkScalar x, SkScalar y, SkScalar scale,
1084 bool applyVM) { 1083 bool applyVM) {
1085 if (nullptr == glyph->fPath) { 1084 if (nullptr == glyph->fPath) {
1086 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph); 1085 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph);
1087 if (!glyphPath) { 1086 if (!glyphPath) {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 gTextContext->createDrawTextBlob(clip, grPaint, skPaint, viewMatrix, text, 1311 gTextContext->createDrawTextBlob(clip, grPaint, skPaint, viewMatrix, text,
1313 static_cast<size_t>(textLen), 0, 0, noClip)); 1312 static_cast<size_t>(textLen), 0, 0, noClip));
1314 1313
1315 SkScalar transX = static_cast<SkScalar>(random->nextU()); 1314 SkScalar transX = static_cast<SkScalar>(random->nextU());
1316 SkScalar transY = static_cast<SkScalar>(random->nextU()); 1315 SkScalar transY = static_cast<SkScalar>(random->nextU());
1317 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ; 1316 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ;
1318 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 1317 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
1319 } 1318 }
1320 1319
1321 #endif 1320 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/batches/GrAtlasTextBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698