diff options
Diffstat (limited to 'src/gpu/text/GrAtlasTextContext.cpp')
-rw-r--r-- | src/gpu/text/GrAtlasTextContext.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 1086bc4894..8c964ba35e 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -425,7 +425,7 @@ void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex, auto cache = blob->setupCache(runIndex, props, scalerContextFlags, paint, &viewMatrix); SkFindAndPlaceGlyph::ProcessPosText( paint.skPaint().getTextEncoding(), text, byteLength, offset, viewMatrix, pos, - scalarsPerPosition, paint.skPaint().getTextAlign(), cache.get(), + scalarsPerPosition, cache.get(), [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) { position += rounding; BmpAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph, @@ -504,16 +504,13 @@ void GrAtlasTextContext::DrawBmpPosTextAsPaths(GrAtlasTextBlob* blob, int runInd const char* stop = text + byteLength; const char* lastText = text; - SkTextAlignProc alignProc(pathPaint.getTextAlign()); SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition); while (text < stop) { const SkGlyph& glyph = glyphCacheProc(cache.get(), &text); if (glyph.fWidth) { - SkPoint tmsLoc; - tmsProc(pos, &tmsLoc); SkPoint loc; - alignProc(tmsLoc, glyph, &loc); + tmsProc(pos, &loc); if (SkMask::kARGB32_Format == glyph.fMaskFormat) { fallbackTextHelper.appendText(glyph, text - lastText, lastText, loc); } else { @@ -729,12 +726,7 @@ void GrAtlasTextContext::drawDFText(GrAtlasTextBlob* blob, int runIndex, y -= alignY; SkPoint offset = SkPoint::Make(x, y); - SkPaint leftAlignedSkPaint(skPaint); - leftAlignedSkPaint.setTextAlign(SkPaint::kLeft_Align); - - GrTextUtils::Paint leftAlignedPaint(&leftAlignedSkPaint, paint.dstColorSpaceInfo()); - - this->drawDFPosText(blob, runIndex, glyphCache, props, leftAlignedPaint, scalerContextFlags, + this->drawDFPosText(blob, runIndex, glyphCache, props, paint, scalerContextFlags, viewMatrix, text, byteLength, positions.begin(), 2, offset); } @@ -777,9 +769,6 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, const char* stop = text + byteLength; - SkPaint::Align align = dfPaint.getTextAlign(); - SkScalar alignMul = SkPaint::kCenter_Align == align ? SK_ScalarHalf : - (SkPaint::kRight_Align == align ? SK_Scalar1 : 0); while (text < stop) { const char* lastText = text; // the last 2 parameters are ignored @@ -787,9 +776,8 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, if (glyph.fWidth) { SkPoint glyphPos(offset); - glyphPos.fX += pos[0] - SkFloatToScalar(glyph.fAdvanceX) * alignMul * textRatio; - glyphPos.fY += (2 == scalarsPerPosition ? pos[1] : 0) - - SkFloatToScalar(glyph.fAdvanceY) * alignMul * textRatio; + glyphPos.fX += pos[0]; + glyphPos.fY += (2 == scalarsPerPosition ? pos[1] : 0); if (glyph.fMaskFormat == SkMask::kSDF_Format) { DfAppendGlyph(blob, runIndex, glyphCache, &currStrike, glyph, glyphPos.fX, |