aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkDevice.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-06-21 16:03:47 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-28 03:36:16 +0000
commite2e52e46ca63540d429656baeee48fd3a402be26 (patch)
tree574c2f990282798988f47a5519a5ed5f3a990569 /src/core/SkDevice.cpp
parent0ce5ab9d3122bcd9dce65ecb51a0da973da09816 (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/core/SkDevice.cpp')
-rw-r--r--src/core/SkDevice.cpp56
1 files changed, 4 insertions, 52 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 46404b2887..9fd61c9d28 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -141,53 +141,6 @@ void SkBaseDevice::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
}
}
-void SkBaseDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
- const SkPaint &paint, SkDrawFilter* drawFilter) {
-
- SkPaint runPaint = paint;
-
- SkTextBlobRunIterator it(blob);
- for (;!it.done(); it.next()) {
- size_t textLen = it.glyphCount() * sizeof(uint16_t);
- const SkPoint& offset = it.offset();
- // applyFontToPaint() always overwrites the exact same attributes,
- // so it is safe to not re-seed the paint for this reason.
- it.applyFontToPaint(&runPaint);
-
- if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) {
- // A false return from filter() means we should abort the current draw.
- runPaint = paint;
- continue;
- }
-
- switch (it.positioning()) {
- case SkTextBlob::kDefault_Positioning: {
- auto origin = SkPoint::Make(x + offset.x(), y + offset.y());
- SkGlyphRunBuilder builder;
- builder.prepareDrawText(runPaint, (const char*) it.glyphs(), textLen, origin);
- auto glyphRun = builder.useGlyphRun();
- glyphRun->temporaryShuntToDrawPosText(runPaint, this);
- }
- break;
- case SkTextBlob::kHorizontal_Positioning:
- this->drawPosText(it.glyphs(), textLen, it.pos(), 1,
- SkPoint::Make(x, y + offset.y()), runPaint);
- break;
- case SkTextBlob::kFull_Positioning:
- this->drawPosText(it.glyphs(), textLen, it.pos(), 2,
- SkPoint::Make(x, y), runPaint);
- break;
- default:
- SK_ABORT("unhandled positioning mode");
- }
-
- if (drawFilter) {
- // A draw filter may change the paint arbitrarily, so we must re-seed in this case.
- runPaint = paint;
- }
- }
-}
-
void SkBaseDevice::drawImage(const SkImage* image, SkScalar x, SkScalar y,
const SkPaint& paint) {
SkBitmap bm;
@@ -252,11 +205,10 @@ void SkBaseDevice::drawImageLattice(const SkImage* image,
}
}
-void SkBaseDevice::drawGlyphRun(const SkPaint& paint, SkGlyphRun* glyphRun) {
- SkPaint glyphPaint(paint);
- glyphPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
-
- glyphRun->temporaryShuntToDrawPosText(glyphPaint, this);
+void SkBaseDevice::drawGlyphRunList(SkGlyphRunList* glyphRunList) {
+ for (auto& glyphRun : *glyphRunList) {
+ glyphRun.temporaryShuntToDrawPosText(this, glyphRunList->origin());
+ }
}
void SkBaseDevice::drawBitmapLattice(const SkBitmap& bitmap,