remove legacy drawPosText (and variants)
Bug: skia:
Change-Id: I112e567d437d729249ceafb500b979ef96e625f9
Reviewed-on: https://skia-review.googlesource.com/c/180924
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index dbce6a8..5fb97e9 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -3955,7 +3955,7 @@
}
##
-#SeeAlso drawString drawPosText drawPosTextH drawTextBlob drawTextRSXform
+#SeeAlso drawString drawTextBlob
##
@@ -3971,7 +3971,7 @@
canvas->drawString("a small hello", 20, 20, paint);
##
-#SeeAlso drawText drawPosText drawPosTextH drawTextBlob drawTextRSXform
+#SeeAlso drawText drawTextBlob
##
@@ -3984,88 +3984,7 @@
canvas->drawString(string, 20, 20, paint);
##
-#SeeAlso drawText drawPosText drawPosTextH drawTextBlob drawTextRSXform
-
-##
-
-# ------------------------------------------------------------------------------
-
-#Method void drawPosText(const void* text, size_t byteLength, const SkPoint pos[],
- const SkPaint& paint)
-#In Draw_Text
-#In Draw
-#Line # draws text at array of (x, y) positions ##
-#Populate
-
-#Example
-#Height 120
-void draw(SkCanvas* canvas) {
- const char hello[] = "HeLLo!";
- const SkPoint pos[] = { {40, 100}, {82, 95}, {115, 110}, {130, 95}, {145, 85},
- {172, 100} };
- SkPaint paint;
- paint.setTextSize(60);
- canvas->drawPosText(hello, strlen(hello), pos, paint);
-}
-##
-
-#SeeAlso drawText drawPosTextH drawTextBlob drawTextRSXform
-
-##
-
-# ------------------------------------------------------------------------------
-
-#Method void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
- const SkPaint& paint)
-#In Draw_Text
-#In Draw
-#Line # draws text at x positions with common baseline ##
-#Populate
-
-#Example
-#Height 40
- void draw(SkCanvas* canvas) {
- SkScalar xpos[] = { 20, 40, 80, 160 };
- SkPaint paint;
- canvas->drawPosTextH("XXXX", 4, xpos, 20, paint);
- }
-##
-
-#SeeAlso drawText drawPosText drawTextBlob drawTextRSXform
-
-##
-
-# ------------------------------------------------------------------------------
-
-#Method void drawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
- const SkRect* cullRect, const SkPaint& paint)
-#In Draw_Text
-#In Draw
-#Line # draws text with array of RSXform ##
-#Populate
-
-#Example
-void draw(SkCanvas* canvas) {
- const int iterations = 26;
- SkRSXform transforms[iterations];
- char alphabet[iterations];
- SkScalar angle = 0;
- SkScalar scale = 1;
- for (size_t i = 0; i < SK_ARRAY_COUNT(transforms); ++i) {
- const SkScalar s = SkScalarSin(angle) * scale;
- const SkScalar c = SkScalarCos(angle) * scale;
- transforms[i] = SkRSXform::Make(-c, -s, -s * 16, c * 16);
- angle += .45;
- scale += .2;
- alphabet[i] = 'A' + i;
- }
- SkPaint paint;
- canvas->translate(110, 138);
- canvas->drawTextRSXform(alphabet, sizeof(alphabet), transforms, nullptr, paint);
-}
-##
-
-#SeeAlso drawText drawPosText drawTextBlob
+#SeeAlso drawText drawTextBlob
##
@@ -4122,7 +4041,7 @@
}
##
-#SeeAlso drawText drawPosText drawPosTextH
+#SeeAlso drawText
##
@@ -4165,7 +4084,7 @@
}
##
-#SeeAlso drawText drawPosText drawPosTextH
+#SeeAlso drawText
##
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 297e4b0..7b54a2b 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1921,81 +1921,6 @@
*/
void drawString(const SkString& string, SkScalar x, SkScalar y, const SkPaint& paint);
-#ifdef SK_SUPPORT_LEGACY_DRAWPOSTTEXT
- /** Draws each glyph in text with the origin in pos array, using clip, SkMatrix, and
- SkPaint paint. The number of entries in pos array must match the number of glyphs
- described by byteLength of text.
-
- text meaning depends on SkTextEncoding; by default, text is encoded as
- UTF-8. pos elements meaning depends on SkPaint vertical text; by default
- glyph left side bearing and baseline are relative to SkPoint in pos array.
- Text size is affected by SkMatrix and SkPaint text size.
-
- All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
- SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
- filled 12 point black glyphs.
-
- Layout engines such as Harfbuzz typically position each glyph
- rather than using the font advance widths.
-
- @param text character code points or glyphs drawn
- @param byteLength byte length of text array
- @param pos array of glyph origins
- @param paint text size, blend, color, and so on, used to draw
- */
- void drawPosText(const void* text, size_t byteLength, const SkPoint pos[],
- const SkPaint& paint);
-
- /** Draws each glyph in text with its origin composed from xpos array and
- constY, using clip, SkMatrix, and SkPaint paint. The number of entries in xpos array
- must match the number of glyphs described by byteLength of text.
-
- text meaning depends on SkTextEncoding; by default, text is encoded as
- UTF-8. xpos elements meaning depends on SkPaint vertical text;
- by default each glyph left side bearing is positioned at an xpos element and
- its baseline is positioned at constY. Text size is affected by SkMatrix and
- SkPaint text size.
-
- All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
- SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
- filled 12 point black glyphs.
-
- Layout engines such as Harfbuzz typically position each glyph
- rather than using the font advance widths if all glyphs share the same
- baseline.
-
- @param text character code points or glyphs drawn
- @param byteLength byte length of text array
- @param xpos array of x-axis positions, used to position each glyph
- @param constY shared y-axis value for all of x-axis positions
- @param paint text size, blend, color, and so on, used to draw
- */
- void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
- const SkPaint& paint);
-
- /** Draws text, transforming each glyph by the corresponding SkRSXform,
- using clip, SkMatrix, and SkPaint paint.
-
- SkRSXform xform array specifies a separate square scale, rotation, and translation
- for each glyph. xform does not affect paint SkShader.
-
- Optional SkRect cullRect is a conservative bounds of text, taking into account
- SkRSXform and paint. If cullRect is outside of clip, canvas can skip drawing.
-
- All elements of paint: SkPathEffect, SkMaskFilter, SkShader,
- SkColorFilter, SkImageFilter, and SkDrawLooper; apply to text. By default, draws
- filled 12 point black glyphs.
-
- @param text character code points or glyphs drawn
- @param byteLength byte length of text array
- @param xform SkRSXform rotates, scales, and translates each glyph individually
- @param cullRect SkRect bounds of text for efficient clipping; or nullptr
- @param paint text size, blend, color, and so on, used to draw
- */
- void drawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
- const SkRect* cullRect, const SkPaint& paint);
-#endif
-
/** Draws SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint.
blob contains glyphs, their positions, and paint attributes specific to text:
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index b24a9a2..4b482cf 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2562,40 +2562,6 @@
this->drawTextBlob(SkTextBlob::MakeFromText(text, byteLength, font, encoding), x, y, paint);
}
}
-#ifdef SK_SUPPORT_LEGACY_DRAWPOSTTEXT
-void SkCanvas::drawPosText(const void* text, size_t byteLength, const SkPoint pos[],
- const SkPaint& paint) {
- TRACE_EVENT0("skia", TRACE_FUNC);
- if (byteLength) {
- sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- 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[],
- SkScalar constY, const SkPaint& paint) {
- TRACE_EVENT0("skia", TRACE_FUNC);
- if (byteLength) {
- sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- 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);
- }
-}
-
-void SkCanvas::drawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
- const SkRect* cullRect, const SkPaint& paint) {
- TRACE_EVENT0("skia", TRACE_FUNC);
- if (byteLength) {
- sk_msan_assert_initialized(text, SkTAddOffset<const void>(text, byteLength));
- const SkFont font = SkFont::LEGACY_ExtractFromPaint(paint);
- const SkTextEncoding encoding = paint.getTextEncoding();
- this->drawTextBlob(SkTextBlob::MakeFromRSXform(text, byteLength, xform, font, encoding),
- 0, 0, paint);
- }
-}
-#endif
void SkCanvas::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
TRACE_EVENT0("skia", TRACE_FUNC);