Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dc7c677b authored by Derek Sollenberger's avatar Derek Sollenberger Committed by android-build-merger
Browse files

Merge "Update text alignment when using drawTextOnPath." into pi-dev

am: 77e74b64

Change-Id: I5c2cf668a9c0040aeb1964c3988aeba08cdbde63
parents 3442e74d 77e74b64
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -764,6 +764,13 @@ void SkiaCanvas::drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& p
void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
                                  const SkPaint& paint, const SkPath& path, size_t start,
                                  size_t end) {
    // Set align to left for drawing, as we don't want individual
    // glyphs centered or right-aligned; the offsets take care of
    // that portion of the alignment.
    SkPaint paintCopy(paint);
    paintCopy.setTextAlign(SkPaint::kLeft_Align);
    SkASSERT(paintCopy.getTextEncoding() == SkPaint::kGlyphID_TextEncoding);

    const int N = end - start;
    SkAutoSTMalloc<1024, uint8_t> storage(N * (sizeof(uint16_t) + sizeof(SkRSXform)));
    SkRSXform* xform = (SkRSXform*)storage.get();
@@ -788,7 +795,7 @@ void SkiaCanvas::drawLayoutOnPath(const minikin::Layout& layout, float hOffset,
        xform[i - start].fTy = pos.y() + tan.x() * y - halfWidth * tan.y();
    }

    this->asSkCanvas()->drawTextRSXform(glyphs, sizeof(uint16_t) * N, xform, nullptr, paint);
    this->asSkCanvas()->drawTextRSXform(glyphs, sizeof(uint16_t) * N, xform, nullptr, paintCopy);
}

// ----------------------------------------------------------------------------