OLD | NEW |
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 continue; | 459 continue; |
460 } | 460 } |
461 | 461 |
462 runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); | 462 runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); |
463 | 463 |
464 // setup vertex / glyphIndex for the new run | 464 // setup vertex / glyphIndex for the new run |
465 if (run > 0) { | 465 if (run > 0) { |
466 PerSubRunInfo& newRun = cacheBlob->fRuns[run].fSubRunInfo.back(); | 466 PerSubRunInfo& newRun = cacheBlob->fRuns[run].fSubRunInfo.back(); |
467 PerSubRunInfo& lastRun = cacheBlob->fRuns[run - 1].fSubRunInfo.back(
); | 467 PerSubRunInfo& lastRun = cacheBlob->fRuns[run - 1].fSubRunInfo.back(
); |
468 | 468 |
469 newRun.fVertexStartIndex = lastRun.fVertexEndIndex; | 469 newRun.setVertexStartIndex(lastRun.vertexEndIndex()); |
470 newRun.fVertexEndIndex = lastRun.fVertexEndIndex; | 470 newRun.setVertexEndIndex(lastRun.vertexEndIndex()); |
471 | 471 |
472 newRun.fGlyphStartIndex = lastRun.fGlyphEndIndex; | 472 newRun.setGlyphStartIndex(lastRun.glyphEndIndex()); |
473 newRun.fGlyphEndIndex = lastRun.fGlyphEndIndex; | 473 newRun.setGlyphEndIndex(lastRun.glyphEndIndex()); |
474 } | 474 } |
475 | 475 |
476 if (this->canDrawAsDistanceFields(runPaint, viewMatrix)) { | 476 if (this->canDrawAsDistanceFields(runPaint, viewMatrix)) { |
477 cacheBlob->setHasDistanceField(); | 477 cacheBlob->setHasDistanceField(); |
478 SkPaint dfPaint = runPaint; | 478 SkPaint dfPaint = runPaint; |
479 SkScalar textRatio; | 479 SkScalar textRatio; |
480 this->initDistanceFieldPaint(cacheBlob, &dfPaint, &textRatio, viewMa
trix); | 480 this->initDistanceFieldPaint(cacheBlob, &dfPaint, &textRatio, viewMa
trix); |
481 Run& runIdx = cacheBlob->fRuns[run]; | 481 Run& runIdx = cacheBlob->fRuns[run]; |
482 PerSubRunInfo& subRun = runIdx.fSubRunInfo.back(); | 482 PerSubRunInfo& subRun = runIdx.fSubRunInfo.back(); |
483 subRun.fUseLCDText = runPaint.isLCDRenderText(); | 483 subRun.setUseLCDText(runPaint.isLCDRenderText()); |
484 subRun.fDrawAsDistanceFields = true; | 484 subRun.setDrawAsDistanceFields(); |
485 | 485 |
486 SkTDArray<char> fallbackTxt; | 486 SkTDArray<char> fallbackTxt; |
487 SkTDArray<SkScalar> fallbackPos; | 487 SkTDArray<SkScalar> fallbackPos; |
488 SkPoint dfOffset; | 488 SkPoint dfOffset; |
489 int scalarsPerPosition = 2; | 489 int scalarsPerPosition = 2; |
490 switch (it.positioning()) { | 490 switch (it.positioning()) { |
491 case SkTextBlob::kDefault_Positioning: { | 491 case SkTextBlob::kDefault_Positioning: { |
492 this->internalDrawDFText(cacheBlob, run, dfPaint, color, vie
wMatrix, | 492 this->internalDrawDFText(cacheBlob, run, dfPaint, color, vie
wMatrix, |
493 (const char *)it.glyphs(), textLen, | 493 (const char *)it.glyphs(), textLen, |
494 x + offset.x(), y + offset.y(), tex
tRatio, | 494 x + offset.x(), y + offset.y(), tex
tRatio, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 GrAtlasTextContext::setupDFBlob(int glyphCount, const SkPaint& origPaint, | 634 GrAtlasTextContext::setupDFBlob(int glyphCount, const SkPaint& origPaint, |
635 const SkMatrix& viewMatrix, SkPaint* dfPaint, | 635 const SkMatrix& viewMatrix, SkPaint* dfPaint, |
636 SkScalar* textRatio) { | 636 SkScalar* textRatio) { |
637 GrAtlasTextBlob* blob = fCache->createBlob(glyphCount, 1, GrAtlasTextBatch::
kGrayTextVASize); | 637 GrAtlasTextBlob* blob = fCache->createBlob(glyphCount, 1, GrAtlasTextBatch::
kGrayTextVASize); |
638 | 638 |
639 *dfPaint = origPaint; | 639 *dfPaint = origPaint; |
640 this->initDistanceFieldPaint(blob, dfPaint, textRatio, viewMatrix); | 640 this->initDistanceFieldPaint(blob, dfPaint, textRatio, viewMatrix); |
641 blob->fViewMatrix = viewMatrix; | 641 blob->fViewMatrix = viewMatrix; |
642 Run& run = blob->fRuns[0]; | 642 Run& run = blob->fRuns[0]; |
643 PerSubRunInfo& subRun = run.fSubRunInfo.back(); | 643 PerSubRunInfo& subRun = run.fSubRunInfo.back(); |
644 subRun.fUseLCDText = origPaint.isLCDRenderText(); | 644 subRun.setUseLCDText(origPaint.isLCDRenderText()); |
645 subRun.fDrawAsDistanceFields = true; | 645 subRun.setDrawAsDistanceFields(); |
646 | 646 |
647 return blob; | 647 return blob; |
648 } | 648 } |
649 | 649 |
650 inline GrAtlasTextBlob* | 650 inline GrAtlasTextBlob* |
651 GrAtlasTextContext::createDrawTextBlob(const GrClip& clip, | 651 GrAtlasTextContext::createDrawTextBlob(const GrClip& clip, |
652 const GrPaint& paint, const SkPaint& skPa
int, | 652 const GrPaint& paint, const SkPaint& skPa
int, |
653 const SkMatrix& viewMatrix, | 653 const SkMatrix& viewMatrix, |
654 const char text[], size_t byteLength, | 654 const char text[], size_t byteLength, |
655 SkScalar x, SkScalar y, const SkIRect& re
gionClipBounds) { | 655 SkScalar x, SkScalar y, const SkIRect& re
gionClipBounds) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 | 1000 |
1001 // If the glyph is too large we fall back to paths | 1001 // If the glyph is too large we fall back to paths |
1002 if (glyph->fTooLargeForAtlas) { | 1002 if (glyph->fTooLargeForAtlas) { |
1003 this->appendGlyphPath(blob, glyph, scaler, skGlyph, SkIntToScalar(vx), S
kIntToScalar(vy)); | 1003 this->appendGlyphPath(blob, glyph, scaler, skGlyph, SkIntToScalar(vx), S
kIntToScalar(vy)); |
1004 return; | 1004 return; |
1005 } | 1005 } |
1006 | 1006 |
1007 GrMaskFormat format = glyph->fMaskFormat; | 1007 GrMaskFormat format = glyph->fMaskFormat; |
1008 | 1008 |
1009 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); | 1009 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); |
1010 if (run.fInitialized && subRun->fMaskFormat != format) { | 1010 if (run.fInitialized && subRun->maskFormat() != format) { |
1011 subRun = &run.push_back(); | 1011 subRun = &run.push_back(); |
1012 subRun->fStrike.reset(SkRef(fCurrStrike)); | 1012 subRun->setStrike(fCurrStrike); |
1013 } else if (!run.fInitialized) { | 1013 } else if (!run.fInitialized) { |
1014 subRun->fStrike.reset(SkRef(fCurrStrike)); | 1014 subRun->setStrike(SkRef(fCurrStrike)); |
1015 } | 1015 } |
1016 | 1016 |
1017 run.fInitialized = true; | 1017 run.fInitialized = true; |
1018 | 1018 |
1019 size_t vertexStride = GrAtlasTextBatch::GetVertexStride(format); | 1019 size_t vertexStride = GrAtlasTextBatch::GetVertexStride(format); |
1020 | 1020 |
1021 SkRect r; | 1021 SkRect r; |
1022 r.fLeft = SkIntToScalar(x); | 1022 r.fLeft = SkIntToScalar(x); |
1023 r.fTop = SkIntToScalar(y); | 1023 r.fTop = SkIntToScalar(y); |
1024 r.fRight = r.fLeft + SkIntToScalar(width); | 1024 r.fRight = r.fLeft + SkIntToScalar(width); |
1025 r.fBottom = r.fTop + SkIntToScalar(height); | 1025 r.fBottom = r.fTop + SkIntToScalar(height); |
1026 subRun->fMaskFormat = format; | 1026 subRun->setMaskFormat(format); |
1027 this->appendGlyphCommon(blob, &run, subRun, r, color, vertexStride, kA8_GrMa
skFormat == format, | 1027 this->appendGlyphCommon(blob, &run, subRun, r, color, vertexStride, kA8_GrMa
skFormat == format, |
1028 glyph); | 1028 glyph); |
1029 } | 1029 } |
1030 | 1030 |
1031 bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, | 1031 bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, |
1032 const SkGlyph& skGlyph, | 1032 const SkGlyph& skGlyph, |
1033 SkScalar sx, SkScalar sy, GrColor color, | 1033 SkScalar sx, SkScalar sy, GrColor color, |
1034 GrFontScaler* scaler, | 1034 GrFontScaler* scaler, |
1035 SkScalar textRatio, const SkMatrix& viewM
atrix) { | 1035 SkScalar textRatio, const SkMatrix& viewM
atrix) { |
1036 Run& run = blob->fRuns[runIndex]; | 1036 Run& run = blob->fRuns[runIndex]; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 | 1068 |
1069 // TODO combine with the above | 1069 // TODO combine with the above |
1070 // If the glyph is too large we fall back to paths | 1070 // If the glyph is too large we fall back to paths |
1071 if (glyph->fTooLargeForAtlas) { | 1071 if (glyph->fTooLargeForAtlas) { |
1072 this->appendGlyphPath(blob, glyph, scaler, skGlyph, sx - dx, sy - dy, sc
ale, true); | 1072 this->appendGlyphPath(blob, glyph, scaler, skGlyph, sx - dx, sy - dy, sc
ale, true); |
1073 return true; | 1073 return true; |
1074 } | 1074 } |
1075 | 1075 |
1076 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); | 1076 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); |
1077 if (!run.fInitialized) { | 1077 if (!run.fInitialized) { |
1078 subRun->fStrike.reset(SkRef(fCurrStrike)); | 1078 subRun->setStrike(fCurrStrike); |
1079 } | 1079 } |
1080 run.fInitialized = true; | 1080 run.fInitialized = true; |
1081 SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat); | 1081 SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat); |
1082 subRun->fMaskFormat = kA8_GrMaskFormat; | 1082 subRun->setMaskFormat(kA8_GrMaskFormat); |
1083 | 1083 |
1084 size_t vertexStride = GrAtlasTextBatch::GetVertexStrideDf(kA8_GrMaskFormat, | 1084 size_t vertexStride = GrAtlasTextBatch::GetVertexStrideDf(kA8_GrMaskFormat, |
1085 subRun->fUseLCDTex
t); | 1085 subRun->hasUseLCDT
ext()); |
1086 | 1086 |
1087 bool useColorVerts = !subRun->fUseLCDText; | 1087 bool useColorVerts = !subRun->hasUseLCDText(); |
1088 this->appendGlyphCommon(blob, &run, subRun, glyphRect, color, vertexStride,
useColorVerts, | 1088 this->appendGlyphCommon(blob, &run, subRun, glyphRect, color, vertexStride,
useColorVerts, |
1089 glyph); | 1089 glyph); |
1090 return true; | 1090 return true; |
1091 } | 1091 } |
1092 | 1092 |
1093 inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph*
glyph, | 1093 inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph*
glyph, |
1094 GrFontScaler* scaler, const SkGl
yph& skGlyph, | 1094 GrFontScaler* scaler, const SkGl
yph& skGlyph, |
1095 SkScalar x, SkScalar y, SkScalar
scale, | 1095 SkScalar x, SkScalar y, SkScalar
scale, |
1096 bool applyVM) { | 1096 bool applyVM) { |
1097 if (nullptr == glyph->fPath) { | 1097 if (nullptr == glyph->fPath) { |
1098 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph); | 1098 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph); |
1099 if (!glyphPath) { | 1099 if (!glyphPath) { |
1100 return; | 1100 return; |
1101 } | 1101 } |
1102 | 1102 |
1103 glyph->fPath = new SkPath(*glyphPath); | 1103 glyph->fPath = new SkPath(*glyphPath); |
1104 } | 1104 } |
1105 blob->fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, sc
ale, applyVM)); | 1105 blob->fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, sc
ale, applyVM)); |
1106 } | 1106 } |
1107 | 1107 |
1108 inline void GrAtlasTextContext::appendGlyphCommon(GrAtlasTextBlob* blob, Run* ru
n, | 1108 inline void GrAtlasTextContext::appendGlyphCommon(GrAtlasTextBlob* blob, Run* ru
n, |
1109 Run::SubRunInfo* subRun, | 1109 Run::SubRunInfo* subRun, |
1110 const SkRect& positions, GrCol
or color, | 1110 const SkRect& positions, GrCol
or color, |
1111 size_t vertexStride, bool useV
ertexColor, | 1111 size_t vertexStride, bool useV
ertexColor, |
1112 GrGlyph* glyph) { | 1112 GrGlyph* glyph) { |
1113 blob->fGlyphs[subRun->fGlyphEndIndex] = glyph; | 1113 blob->appendGlyph(subRun, glyph); |
1114 run->fVertexBounds.joinNonEmptyArg(positions); | 1114 run->fVertexBounds.joinNonEmptyArg(positions); |
1115 run->fColor = color; | 1115 run->fColor = color; |
1116 | 1116 |
1117 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices + subRun->fVert
exEndIndex); | 1117 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices + subRun->verte
xEndIndex()); |
1118 | 1118 |
1119 if (useVertexColor) { | 1119 if (useVertexColor) { |
1120 // V0 | 1120 // V0 |
1121 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); | 1121 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); |
1122 position->set(positions.fLeft, positions.fTop); | 1122 position->set(positions.fLeft, positions.fTop); |
1123 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint))
; | 1123 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint))
; |
1124 *colorPtr = color; | 1124 *colorPtr = color; |
1125 vertex += vertexStride; | 1125 vertex += vertexStride; |
1126 | 1126 |
1127 // V1 | 1127 // V1 |
(...skipping 28 matching lines...) Expand all Loading... |
1156 | 1156 |
1157 // V2 | 1157 // V2 |
1158 position = reinterpret_cast<SkPoint*>(vertex); | 1158 position = reinterpret_cast<SkPoint*>(vertex); |
1159 position->set(positions.fRight, positions.fBottom); | 1159 position->set(positions.fRight, positions.fBottom); |
1160 vertex += vertexStride; | 1160 vertex += vertexStride; |
1161 | 1161 |
1162 // V3 | 1162 // V3 |
1163 position = reinterpret_cast<SkPoint*>(vertex); | 1163 position = reinterpret_cast<SkPoint*>(vertex); |
1164 position->set(positions.fRight, positions.fTop); | 1164 position->set(positions.fRight, positions.fTop); |
1165 } | 1165 } |
1166 | 1166 subRun->appendVertices(vertexStride); |
1167 subRun->fGlyphEndIndex++; | |
1168 subRun->fVertexEndIndex += vertexStride * GrAtlasTextBatch::kVerticesPerGlyp
h; | |
1169 } | 1167 } |
1170 | 1168 |
1171 void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc, | 1169 void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc, |
1172 const SkTextBlobRunIterator& it, | 1170 const SkTextBlobRunIterator& it, |
1173 const GrClip& clip, const SkPaint& skPa
int, | 1171 const GrClip& clip, const SkPaint& skPa
int, |
1174 SkDrawFilter* drawFilter, const SkMatri
x& viewMatrix, | 1172 SkDrawFilter* drawFilter, const SkMatri
x& viewMatrix, |
1175 const SkIRect& clipBounds, SkScalar x,
SkScalar y) { | 1173 const SkIRect& clipBounds, SkScalar x,
SkScalar y) { |
1176 SkPaint runPaint = skPaint; | 1174 SkPaint runPaint = skPaint; |
1177 | 1175 |
1178 size_t textLen = it.glyphCount() * sizeof(uint16_t); | 1176 size_t textLen = it.glyphCount() * sizeof(uint16_t); |
(...skipping 25 matching lines...) Expand all Loading... |
1204 textLen, it.pos(), 2, SkPoint::Make(x, y), c
lipBounds); | 1202 textLen, it.pos(), 2, SkPoint::Make(x, y), c
lipBounds); |
1205 break; | 1203 break; |
1206 } | 1204 } |
1207 } | 1205 } |
1208 | 1206 |
1209 inline GrDrawBatch* | 1207 inline GrDrawBatch* |
1210 GrAtlasTextContext::createBatch(GrAtlasTextBlob* cacheBlob, const PerSubRunInfo&
info, | 1208 GrAtlasTextContext::createBatch(GrAtlasTextBlob* cacheBlob, const PerSubRunInfo&
info, |
1211 int glyphCount, int run, int subRun, | 1209 int glyphCount, int run, int subRun, |
1212 GrColor color, SkScalar transX, SkScalar transY, | 1210 GrColor color, SkScalar transX, SkScalar transY, |
1213 const SkPaint& skPaint) { | 1211 const SkPaint& skPaint) { |
1214 GrMaskFormat format = info.fMaskFormat; | 1212 GrMaskFormat format = info.maskFormat(); |
1215 GrColor subRunColor; | 1213 GrColor subRunColor; |
1216 if (kARGB_GrMaskFormat == format) { | 1214 if (kARGB_GrMaskFormat == format) { |
1217 uint8_t paintAlpha = skPaint.getAlpha(); | 1215 uint8_t paintAlpha = skPaint.getAlpha(); |
1218 subRunColor = SkColorSetARGB(paintAlpha, paintAlpha, paintAlpha, paintAl
pha); | 1216 subRunColor = SkColorSetARGB(paintAlpha, paintAlpha, paintAlpha, paintAl
pha); |
1219 } else { | 1217 } else { |
1220 subRunColor = color; | 1218 subRunColor = color; |
1221 } | 1219 } |
1222 | 1220 |
1223 GrAtlasTextBatch* batch; | 1221 GrAtlasTextBatch* batch; |
1224 if (info.fDrawAsDistanceFields) { | 1222 if (info.drawAsDistanceFields()) { |
1225 SkColor filteredColor; | 1223 SkColor filteredColor; |
1226 SkColorFilter* colorFilter = skPaint.getColorFilter(); | 1224 SkColorFilter* colorFilter = skPaint.getColorFilter(); |
1227 if (colorFilter) { | 1225 if (colorFilter) { |
1228 filteredColor = colorFilter->filterColor(skPaint.getColor()); | 1226 filteredColor = colorFilter->filterColor(skPaint.getColor()); |
1229 } else { | 1227 } else { |
1230 filteredColor = skPaint.getColor(); | 1228 filteredColor = skPaint.getColor(); |
1231 } | 1229 } |
1232 bool useBGR = SkPixelGeometryIsBGR(fSurfaceProps.pixelGeometry()); | 1230 bool useBGR = SkPixelGeometryIsBGR(fSurfaceProps.pixelGeometry()); |
1233 batch = GrAtlasTextBatch::CreateDistanceField(glyphCount, fContext->getB
atchFontCache(), | 1231 batch = GrAtlasTextBatch::CreateDistanceField(glyphCount, fContext->getB
atchFontCache(), |
1234 fDistanceAdjustTable, filt
eredColor, | 1232 fDistanceAdjustTable, filt
eredColor, |
1235 info.fUseLCDText, useBGR); | 1233 info.hasUseLCDText(), useB
GR); |
1236 } else { | 1234 } else { |
1237 batch = GrAtlasTextBatch::CreateBitmap(format, glyphCount, fContext->get
BatchFontCache()); | 1235 batch = GrAtlasTextBatch::CreateBitmap(format, glyphCount, fContext->get
BatchFontCache()); |
1238 } | 1236 } |
1239 GrAtlasTextBatch::Geometry& geometry = batch->geometry(); | 1237 GrAtlasTextBatch::Geometry& geometry = batch->geometry(); |
1240 geometry.fBlob = SkRef(cacheBlob); | 1238 geometry.fBlob = SkRef(cacheBlob); |
1241 geometry.fRun = run; | 1239 geometry.fRun = run; |
1242 geometry.fSubRun = subRun; | 1240 geometry.fSubRun = subRun; |
1243 geometry.fColor = subRunColor; | 1241 geometry.fColor = subRunColor; |
1244 geometry.fTransX = transX; | 1242 geometry.fTransX = transX; |
1245 geometry.fTransY = transY; | 1243 geometry.fTransY = transY; |
1246 batch->init(); | 1244 batch->init(); |
1247 | 1245 |
1248 return batch; | 1246 return batch; |
1249 } | 1247 } |
1250 | 1248 |
1251 inline void GrAtlasTextContext::flushRun(GrDrawContext* dc, GrPipelineBuilder* p
ipelineBuilder, | 1249 inline void GrAtlasTextContext::flushRun(GrDrawContext* dc, GrPipelineBuilder* p
ipelineBuilder, |
1252 GrAtlasTextBlob* cacheBlob, int run, Gr
Color color, | 1250 GrAtlasTextBlob* cacheBlob, int run, Gr
Color color, |
1253 SkScalar transX, SkScalar transY, | 1251 SkScalar transX, SkScalar transY, |
1254 const SkPaint& skPaint) { | 1252 const SkPaint& skPaint) { |
1255 for (int subRun = 0; subRun < cacheBlob->fRuns[run].fSubRunInfo.count(); sub
Run++) { | 1253 for (int subRun = 0; subRun < cacheBlob->fRuns[run].fSubRunInfo.count(); sub
Run++) { |
1256 const PerSubRunInfo& info = cacheBlob->fRuns[run].fSubRunInfo[subRun]; | 1254 const PerSubRunInfo& info = cacheBlob->fRuns[run].fSubRunInfo[subRun]; |
1257 int glyphCount = info.fGlyphEndIndex - info.fGlyphStartIndex; | 1255 int glyphCount = info.glyphCount(); |
1258 if (0 == glyphCount) { | 1256 if (0 == glyphCount) { |
1259 continue; | 1257 continue; |
1260 } | 1258 } |
1261 | 1259 |
1262 SkAutoTUnref<GrDrawBatch> batch(this->createBatch(cacheBlob, info, glyph
Count, run, | 1260 SkAutoTUnref<GrDrawBatch> batch(this->createBatch(cacheBlob, info, glyph
Count, run, |
1263 subRun, color, transX,
transY, | 1261 subRun, color, transX,
transY, |
1264 skPaint)); | 1262 skPaint)); |
1265 dc->drawBatch(pipelineBuilder, batch); | 1263 dc->drawBatch(pipelineBuilder, batch); |
1266 } | 1264 } |
1267 } | 1265 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 gTextContext->createDrawTextBlob(clip, grPaint, skPaint, viewMatrix,
text, | 1385 gTextContext->createDrawTextBlob(clip, grPaint, skPaint, viewMatrix,
text, |
1388 static_cast<size_t>(textLen), 0, 0,
noClip)); | 1386 static_cast<size_t>(textLen), 0, 0,
noClip)); |
1389 | 1387 |
1390 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 1388 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
1391 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 1389 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
1392 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 1390 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
1393 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 1391 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
1394 } | 1392 } |
1395 | 1393 |
1396 #endif | 1394 #endif |
OLD | NEW |