From e2e52e46ca63540d429656baeee48fd3a402be26 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Thu, 21 Jun 2018 16:03:47 -0400 Subject: Remove drawTextBlob from device use drawGlyphRunList Convert all backends to use GlyphRunList instead of text blobs. If the device did not originally implement drawTextBlob it will be simulated by drawPosText on the device. Other changes: Change to using an origin from absolulte positioning. The GPU code uses origin change to update blobs under translation. Change cluster to use const uint32_t instead of just uint32_t. Add SkPaint to runs. The draw filter is hosted up to the canavas level and applied there. Change-Id: Ib105b6bd26b67db55f1c954e37c79fbdcaa9d4a2 Reviewed-on: https://skia-review.googlesource.com/137224 Reviewed-by: Herb Derby Reviewed-by: Khusal Sagar Reviewed-by: Hal Canary Reviewed-by: Jim Van Verth Commit-Queue: Herb Derby --- src/pdf/SkPDFDevice.cpp | 14 +++++--------- src/pdf/SkPDFDevice.h | 4 ++-- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src/pdf') diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 45a9b95915..72d543c67e 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -19,6 +19,7 @@ #include "SkDraw.h" #include "SkDrawFilter.h" #include "SkGlyphCache.h" +#include "SkGlyphRun.h" #include "SkImageFilterCache.h" #include "SkJpegEncoder.h" #include "SkMakeUnique.h" @@ -1458,17 +1459,12 @@ void SkPDFDevice::drawPosText(const void* text, size_t len, offset, paint, nullptr, 0, nullptr); } -void SkPDFDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint &paint, SkDrawFilter* drawFilter) { - for (SkTextBlobRunIterator it(blob); !it.done(); it.next()) { - SkPaint runPaint(paint); +void SkPDFDevice::drawGlyphRunList(SkGlyphRunList* glyphRunList) { + for (SkGlyphRunListIterator it(glyphRunList); !it.done(); it.next()) { + SkPaint runPaint; it.applyFontToPaint(&runPaint); - if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) { - continue; - } - SkPoint offset = it.offset() + SkPoint{x, y}; this->internalDrawText(it.glyphs(), sizeof(SkGlyphID) * it.glyphCount(), - it.pos(), it.positioning(), offset, runPaint, + it.pos(), it.positioning(), glyphRunList->origin(), runPaint, it.clusters(), it.textSize(), it.text()); } } diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h index 33d0e70e67..90f4b8e480 100644 --- a/src/pdf/SkPDFDevice.h +++ b/src/pdf/SkPDFDevice.h @@ -22,6 +22,7 @@ #include "SkTextBlob.h" #include "SkKeyedImage.h" +class SkGlyphRunList; class SkKeyedImage; class SkPath; class SkPDFArray; @@ -98,8 +99,7 @@ public: void drawPosText(const void* text, size_t len, const SkScalar pos[], int scalarsPerPos, const SkPoint& offset, const SkPaint&) override; - void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, - const SkPaint &, SkDrawFilter*) override; + void drawGlyphRunList(SkGlyphRunList* glyphRunList) override; void drawVertices(const SkVertices*, SkBlendMode, const SkPaint&) override; void drawDevice(SkBaseDevice*, int x, int y, const SkPaint&) override; -- cgit v1.2.3