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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 bool useColorVerts = true; |
bsalomon
2015/12/08 16:27:13
?
joshualitt
2015/12/08 17:04:37
Acknowledged.
| |
1077 blob->appendGlyph(&run, subRun, glyphRect, color, vertexStride, useColorVert s, glyph); | 1077 blob->appendGlyph(&run, subRun, glyphRect, color, vertexStride, true, glyph) ; |
1078 return true; | 1078 return true; |
1079 } | 1079 } |
1080 | 1080 |
1081 inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph, | 1081 inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph, |
1082 GrFontScaler* scaler, const SkGl yph& skGlyph, | 1082 GrFontScaler* scaler, const SkGl yph& skGlyph, |
1083 SkScalar x, SkScalar y, SkScalar scale, | 1083 SkScalar x, SkScalar y, SkScalar scale, |
1084 bool applyVM) { | 1084 bool applyVM) { |
1085 if (nullptr == glyph->fPath) { | 1085 if (nullptr == glyph->fPath) { |
1086 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph); | 1086 const SkPath* glyphPath = scaler->getGlyphPath(skGlyph); |
1087 if (!glyphPath) { | 1087 if (!glyphPath) { |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1312 gTextContext->createDrawTextBlob(clip, grPaint, skPaint, viewMatrix, text, | 1312 gTextContext->createDrawTextBlob(clip, grPaint, skPaint, viewMatrix, text, |
1313 static_cast<size_t>(textLen), 0, 0, noClip)); | 1313 static_cast<size_t>(textLen), 0, 0, noClip)); |
1314 | 1314 |
1315 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 1315 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
1316 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 1316 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
1317 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ; | 1317 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0] ; |
1318 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); | 1318 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); |
1319 } | 1319 } |
1320 | 1320 |
1321 #endif | 1321 #endif |
OLD | NEW |