diff options
author | Herb Derby <herb@google.com> | 2018-06-21 16:03:47 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-28 03:36:16 +0000 |
commit | e2e52e46ca63540d429656baeee48fd3a402be26 (patch) | |
tree | 574c2f990282798988f47a5519a5ed5f3a990569 /src/pdf | |
parent | 0ce5ab9d3122bcd9dce65ecb51a0da973da09816 (diff) |
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 <herb@google.com>
Reviewed-by: Khusal Sagar <khushalsagar@chromium.org>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 14 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.h | 4 |
2 files changed, 7 insertions, 11 deletions
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; |