aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-05-21 16:10:17 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-21 21:53:54 +0000
commit1e7c65806f3fbde13b5d8064dc5734d98c32a284 (patch)
treee758fae7c14f09ba185b8aaa8f8306dad5cd4905 /src/gpu/text
parent4bfb50b904e0e92d10145398eb3a6f8dd7868867 (diff)
drawPosText no longer obeys paint alignment
Change-Id: Iac498b54dea4aa1b203d2b9c58e15bb5f2147f82 Reviewed-on: https://skia-review.googlesource.com/129462 Commit-Queue: Herb Derby <herb@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/gpu/text')
-rw-r--r--src/gpu/text/GrAtlasTextContext.cpp22
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,