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

Commit 5bacb6fd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "don't toggle between Paint and SkPaint"

parents 0b4d5db4 2dfd55d1
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -678,15 +678,15 @@ void SkiaCanvas::drawVectorDrawable(VectorDrawableRoot* vectorDrawable) {
// Canvas draw operations: Text
// ----------------------------------------------------------------------------

void SkiaCanvas::drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& paint, float x,
void SkiaCanvas::drawGlyphs(ReadGlyphFunc glyphFunc, int count, const Paint& paint, float x,
                            float y, float boundsLeft, float boundsTop, float boundsRight,
                            float boundsBottom, float totalAdvance) {
    if (count <= 0 || paint.nothingToDraw()) return;
    SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
    SkPaint paintCopy(paint);
    if (mPaintFilter) {
        mPaintFilter->filter(&paintCopy);
    }
    SkFont font = SkFont::LEGACY_ExtractFromPaint(paintCopy);
    SkASSERT(paintCopy.getTextEncoding() == kGlyphID_SkTextEncoding);
    // Stroke with a hairline is drawn on HW with a fill style for compatibility with Android O and
    // older.
@@ -708,13 +708,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,
                                  const Paint& paint, const SkPath& path, size_t start,
                                  size_t end) {
    SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
    SkPaint paintCopy(paint);
    if (mPaintFilter) {
        mPaintFilter->filter(&paintCopy);
    }
    SkFont font = SkFont::LEGACY_ExtractFromPaint(paintCopy);
    SkASSERT(paintCopy.getTextEncoding() == kGlyphID_SkTextEncoding);

    const int N = end - start;
+2 −2
Original line number Diff line number Diff line
@@ -158,11 +158,11 @@ protected:
    void reset(SkCanvas* skiaCanvas);
    void drawDrawable(SkDrawable* drawable) { mCanvas->drawDrawable(drawable); }

    virtual void drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& paint, float x,
    virtual void drawGlyphs(ReadGlyphFunc glyphFunc, int count, const Paint& paint, float x,
                            float y, float boundsLeft, float boundsTop, float boundsRight,
                            float boundsBottom, float totalAdvance) override;
    virtual void drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
                                  const SkPaint& paint, const SkPath& path, size_t start,
                                  const Paint& paint, const SkPath& path, size_t start,
                                  size_t end) override;

    /** This class acts as a copy on write SkPaint.
+1 −1
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ static inline void drawStroke(SkScalar left, SkScalar right, SkScalar top, SkSca
    canvas->drawRect(left, top, right, bottom, paint);
}

void Canvas::drawTextDecorations(float x, float y, float length, const SkPaint& paint) {
void Canvas::drawTextDecorations(float x, float y, float length, const Paint& paint) {
    uint32_t flags;
    PaintFilter* paintFilter = getPaintFilter();
    if (paintFilter) {
+3 −3
Original line number Diff line number Diff line
@@ -303,18 +303,18 @@ public:
    static int GetApiLevel() { return sApiLevel; }

protected:
    void drawTextDecorations(float x, float y, float length, const SkPaint& paint);
    void drawTextDecorations(float x, float y, float length, const Paint& paint);

    /**
     * glyphFunc: valid only for the duration of the call and should not be cached.
     * drawText: count is of glyphs
     * totalAdvance: used to define width of text decorations (underlines, strikethroughs).
     */
    virtual void drawGlyphs(ReadGlyphFunc glyphFunc, int count, const SkPaint& paint, float x,
    virtual void drawGlyphs(ReadGlyphFunc glyphFunc, int count, const Paint& paint, float x,
                            float y, float boundsLeft, float boundsTop, float boundsRight,
                            float boundsBottom, float totalAdvance) = 0;
    virtual void drawLayoutOnPath(const minikin::Layout& layout, float hOffset, float vOffset,
                                  const SkPaint& paint, const SkPath& path, size_t start,
                                  const Paint& paint, const SkPath& path, size_t start,
                                  size_t end) = 0;
    static int sApiLevel;

+2 −2
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint
                                 float y) {
    auto utf16 = asciiToUtf16(text);
    uint32_t length = strlen(text);
    SkPaint glyphPaint(paint);
    Paint glyphPaint(paint);
    glyphPaint.setTextEncoding(kGlyphID_SkTextEncoding);
    canvas->drawText(utf16.get(), length,  // text buffer
                     0, length,            // draw range
@@ -93,7 +93,7 @@ void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint
void TestUtils::drawUtf8ToCanvas(Canvas* canvas, const char* text, const SkPaint& paint,
                                 const SkPath& path) {
    auto utf16 = asciiToUtf16(text);
    SkPaint glyphPaint(paint);
    Paint glyphPaint(paint);
    glyphPaint.setTextEncoding(kGlyphID_SkTextEncoding);
    canvas->drawTextOnPath(utf16.get(), strlen(text), minikin::Bidi::LTR, path, 0, 0, glyphPaint,
                           nullptr);