Abandon onDrawText and its variants, turn everything into textblobs
Follow-ups assuming this sticks:
- remove client overrides, so we can remove the (empty) base class virtuals
- mark as obsolete the .skp enums for these entrypoints, and note date
- remove glyphrunlist helpers that now may not have any callers
- remove DrawCommands related to these entrypoints
Bug: skia:
Change-Id: I44b4e6ef3bee61911e77b9b2ab73f82c0817536a
Reviewed-on: https://skia-review.googlesource.com/c/175240
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index ef149f9..773d950 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2437,48 +2437,11 @@
}
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
- const SkPaint& paint) {
-
- LOOPER_BEGIN(paint, nullptr)
-
- while (iter.next()) {
- fScratchGlyphRunBuilder->drawText(
- looper.paint(), text, byteLength, SkPoint::Make(x, y));
- auto glyphRunList = fScratchGlyphRunBuilder->useGlyphRunList();
- iter.fDevice->drawGlyphRunList(glyphRunList);
- }
-
- LOOPER_END
-}
-
+ const SkPaint& paint) {}
void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
- const SkPaint& paint) {
-
- LOOPER_BEGIN(paint, nullptr)
-
- while (iter.next()) {
- fScratchGlyphRunBuilder->drawPosText(looper.paint(), text, byteLength, pos);
- auto glyphRunList = fScratchGlyphRunBuilder->useGlyphRunList();
- iter.fDevice->drawGlyphRunList(glyphRunList);
- }
-
- LOOPER_END
-}
-
+ const SkPaint& paint) {}
void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
- SkScalar constY, const SkPaint& paint) {
-
- LOOPER_BEGIN(paint, nullptr)
-
- while (iter.next()) {
- fScratchGlyphRunBuilder->drawPosTextH(
- looper.paint(), text, byteLength, xpos, constY);
- auto glyphRunList = fScratchGlyphRunBuilder->useGlyphRunList();
- iter.fDevice->drawGlyphRunList(glyphRunList);
- }
-
- LOOPER_END
-}
+ SkScalar constY, const SkPaint& paint) {}
void SkCanvas::onDrawTextRSXform(const void* text, size_t len, const SkRSXform xform[],
const SkRect* cullRect, const SkPaint& paint) {
@@ -2535,10 +2498,7 @@
TRACE_EVENT0("skia", TRACE_FUNC);
if (byteLength) {
sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- SkPaint tmp(paint);
- font.LEGACY_applyToPaint(&tmp);
- tmp.setTextEncoding(encoding);
- this->onDrawText(text, byteLength, x, y, tmp);
+ this->drawTextBlob(SkTextBlob::MakeFromText(text, byteLength, font, encoding), x, y, paint);
}
}
void SkCanvas::drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
@@ -2546,7 +2506,9 @@
TRACE_EVENT0("skia", TRACE_FUNC);
if (byteLength) {
sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- this->onDrawText(text, byteLength, x, y, paint);
+ const SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
+ const SkTextEncoding encoding = paint.getTextEncoding();
+ this->drawTextBlob(SkTextBlob::MakeFromText(text, byteLength, font, encoding), x, y, paint);
}
}
void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint pos[],
@@ -2554,7 +2516,9 @@
TRACE_EVENT0("skia", TRACE_FUNC);
if (byteLength) {
sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- this->onDrawPosText(text, byteLength, pos, paint);
+ const SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
+ const SkTextEncoding encoding = paint.getTextEncoding();
+ this->drawTextBlob(SkTextBlob::MakeFromPosText(text, byteLength, pos, font, encoding), 0, 0, paint);
}
}
void SkCanvas::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
@@ -2562,7 +2526,9 @@
TRACE_EVENT0("skia", TRACE_FUNC);
if (byteLength) {
sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- this->onDrawPosTextH(text, byteLength, xpos, constY, paint);
+ const SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
+ const SkTextEncoding encoding = paint.getTextEncoding();
+ this->drawTextBlob(SkTextBlob::MakeFromPosTextH(text, byteLength, xpos, constY, font, encoding), 0, 0, paint);
}
}