diff options
| author | 2019-01-08 16:19:03 -0500 | |
|---|---|---|
| committer | 2019-01-08 16:19:22 -0500 | |
| commit | 2dfd55d19924ddd6d2b251c5d0df4e571e2b06b0 (patch) | |
| tree | f0097777af81fd424ebac1fd8e1475c1b8b9cd8a | |
| parent | 70a5fa70ad67bf7efcb36c725dfbc0eb23b755dd (diff) | |
don't toggle between Paint and SkPaint
Test: make
Change-Id: Id5864591db0577a24833bbb90036b9554ce130d4
| -rw-r--r-- | libs/hwui/SkiaCanvas.cpp | 8 | ||||
| -rw-r--r-- | libs/hwui/SkiaCanvas.h | 4 | ||||
| -rw-r--r-- | libs/hwui/hwui/Canvas.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/hwui/Canvas.h | 6 | ||||
| -rw-r--r-- | libs/hwui/tests/common/TestUtils.cpp | 4 |
5 files changed, 12 insertions, 12 deletions
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp index ab95e69c4e26..cc62fdc76ef8 100644 --- a/libs/hwui/SkiaCanvas.cpp +++ b/libs/hwui/SkiaCanvas.cpp @@ -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; diff --git a/libs/hwui/SkiaCanvas.h b/libs/hwui/SkiaCanvas.h index 4ab0a59447ee..3fe2bce06b41 100644 --- a/libs/hwui/SkiaCanvas.h +++ b/libs/hwui/SkiaCanvas.h @@ -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. diff --git a/libs/hwui/hwui/Canvas.cpp b/libs/hwui/hwui/Canvas.cpp index a09da6bf359e..277148e3d556 100644 --- a/libs/hwui/hwui/Canvas.cpp +++ b/libs/hwui/hwui/Canvas.cpp @@ -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) { diff --git a/libs/hwui/hwui/Canvas.h b/libs/hwui/hwui/Canvas.h index 4c5365d3c170..11e8579a481f 100644 --- a/libs/hwui/hwui/Canvas.h +++ b/libs/hwui/hwui/Canvas.h @@ -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; diff --git a/libs/hwui/tests/common/TestUtils.cpp b/libs/hwui/tests/common/TestUtils.cpp index 7aa9b82e3583..16a27598c56a 100644 --- a/libs/hwui/tests/common/TestUtils.cpp +++ b/libs/hwui/tests/common/TestUtils.cpp @@ -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); |