diff options
author | Herb Derby <herb@google.com> | 2018-07-19 12:52:16 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-19 20:08:45 +0000 |
commit | 736db1081b378ac8c167dfbc0322470d28c1cb3e (patch) | |
tree | fb91a225309073ecc16924c99135d7d178cdfd01 /src | |
parent | f1ba3ae6f7530897d0649066dc858943810a817a (diff) |
Convert PDF device to use glyph runs lists
Change-Id: I3d98aadead463a42dd8338c63593be22acb6dd68
Reviewed-on: https://skia-review.googlesource.com/142502
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 21 | ||||
-rw-r--r-- | src/pdf/SkPDFDevice.h | 2 |
2 files changed, 5 insertions, 18 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index 46dff0722a..d7a0f501c1 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -18,6 +18,7 @@ #include "SkColorFilter.h" #include "SkDraw.h" #include "SkGlyphCache.h" +#include "SkGlyphRun.h" #include "SkImageFilterCache.h" #include "SkJpegEncoder.h" #include "SkMakeUnique.h" @@ -1458,25 +1459,11 @@ void SkPDFDevice::drawPosText(const void* text, size_t len, } void SkPDFDevice::drawGlyphRunList(SkGlyphRunList* glyphRunList) { - auto blob = glyphRunList->blob(); - - if (blob == nullptr) { - glyphRunList->temporaryShuntToDrawPosText(this, SkPoint::Make(0, 0)); - } else { - auto origin = glyphRunList->origin(); - auto paint = glyphRunList->paint(); - this->drawTextBlob(blob, origin.x(), origin.y(), paint); - } -} - -void SkPDFDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint &paint) { - for (SkTextBlobRunIterator it(blob); !it.done(); it.next()) { - SkPaint runPaint(paint); + for (SkGlyphRunListIterator it(glyphRunList); !it.done(); it.next()) { + SkPaint runPaint; it.applyFontToPaint(&runPaint); - 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 1691baa51e..eb293fc8a4 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; @@ -97,7 +98,6 @@ 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 &) override; void drawGlyphRunList(SkGlyphRunList* glyphRunList) override; void drawVertices(const SkVertices*, const SkMatrix* bones, int boneCount, SkBlendMode, const SkPaint&) override; |