Merge "All non-blob variants of drawText are deprecated"
diff --git a/libs/hwui/DisplayListOps.in b/libs/hwui/DisplayListOps.in
index bd1e6c5..14e3a32 100644
--- a/libs/hwui/DisplayListOps.in
+++ b/libs/hwui/DisplayListOps.in
@@ -41,14 +41,10 @@
X(DrawImageNine)
X(DrawImageRect)
X(DrawImageLattice)
-X(DrawText)
-X(DrawPosText)
-X(DrawPosTextH)
-X(DrawTextRSXform)
X(DrawTextBlob)
X(DrawPatch)
X(DrawPoints)
X(DrawVertices)
X(DrawAtlas)
X(DrawShadowRec)
-X(DrawVectorDrawable)
\ No newline at end of file
+X(DrawVectorDrawable)
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 4de25f9..6dc9d34 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -373,61 +373,6 @@
}
};
-struct DrawText final : Op {
- static const auto kType = Type::DrawText;
- DrawText(size_t bytes, SkScalar x, SkScalar y, const SkPaint& paint)
- : bytes(bytes), x(x), y(y), paint(paint) {}
- size_t bytes;
- SkScalar x, y;
- SkPaint paint;
- void draw(SkCanvas* c, const SkMatrix&) const {
- c->drawText(pod<void>(this), bytes, x, y, paint);
- }
-};
-struct DrawPosText final : Op {
- static const auto kType = Type::DrawPosText;
- DrawPosText(size_t bytes, const SkPaint& paint, int n) : bytes(bytes), paint(paint), n(n) {}
- size_t bytes;
- SkPaint paint;
- int n;
- void draw(SkCanvas* c, const SkMatrix&) const {
- auto points = pod<SkPoint>(this);
- auto text = pod<void>(this, n * sizeof(SkPoint));
- c->drawPosText(text, bytes, points, paint);
- }
-};
-struct DrawPosTextH final : Op {
- static const auto kType = Type::DrawPosTextH;
- DrawPosTextH(size_t bytes, SkScalar y, const SkPaint& paint, int n)
- : bytes(bytes), y(y), paint(paint), n(n) {}
- size_t bytes;
- SkScalar y;
- SkPaint paint;
- int n;
- void draw(SkCanvas* c, const SkMatrix&) const {
- auto xs = pod<SkScalar>(this);
- auto text = pod<void>(this, n * sizeof(SkScalar));
- c->drawPosTextH(text, bytes, xs, y, paint);
- }
-};
-struct DrawTextRSXform final : Op {
- static const auto kType = Type::DrawTextRSXform;
- DrawTextRSXform(size_t bytes, int xforms, const SkRect* cull, const SkPaint& paint)
- : bytes(bytes), xforms(xforms), paint(paint) {
- if (cull) {
- this->cull = *cull;
- }
- }
- size_t bytes;
- int xforms;
- SkRect cull = kUnset;
- SkPaint paint;
- void draw(SkCanvas* c, const SkMatrix&) const {
- // For alignment, the SkRSXforms are first in the pod section, followed by the text.
- c->drawTextRSXform(pod<void>(this, xforms * sizeof(SkRSXform)), bytes, pod<SkRSXform>(this),
- maybe_unset(cull), paint);
- }
-};
struct DrawTextBlob final : Op {
static const auto kType = Type::DrawTextBlob;
DrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint)
@@ -682,33 +627,6 @@
fs);
}
-void DisplayListData::drawText(const void* text, size_t bytes, SkScalar x, SkScalar y,
- const SkPaint& paint) {
- void* pod = this->push<DrawText>(bytes, bytes, x, y, paint);
- copy_v(pod, (const char*)text, bytes);
- mHasText = true;
-}
-void DisplayListData::drawPosText(const void* text, size_t bytes, const SkPoint pos[],
- const SkPaint& paint) {
- int n = paint.countText(text, bytes);
- void* pod = this->push<DrawPosText>(n * sizeof(SkPoint) + bytes, bytes, paint, n);
- copy_v(pod, pos, n, (const char*)text, bytes);
- mHasText = true;
-}
-void DisplayListData::drawPosTextH(const void* text, size_t bytes, const SkScalar xs[], SkScalar y,
- const SkPaint& paint) {
- int n = paint.countText(text, bytes);
- void* pod = this->push<DrawPosTextH>(n * sizeof(SkScalar) + bytes, bytes, y, paint, n);
- copy_v(pod, xs, n, (const char*)text, bytes);
- mHasText = true;
-}
-void DisplayListData::drawTextRSXform(const void* text, size_t bytes, const SkRSXform xforms[],
- const SkRect* cull, const SkPaint& paint) {
- int n = paint.countText(text, bytes);
- void* pod = this->push<DrawTextRSXform>(bytes + n * sizeof(SkRSXform), bytes, n, cull, paint);
- copy_v(pod, xforms, n, (const char*)text, bytes);
- mHasText = true;
-}
void DisplayListData::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
this->push<DrawTextBlob>(0, blob, x, y, paint);
diff --git a/libs/hwui/RecordingCanvas.h b/libs/hwui/RecordingCanvas.h
index ae3c4f05..caaef67 100644
--- a/libs/hwui/RecordingCanvas.h
+++ b/libs/hwui/RecordingCanvas.h
@@ -101,10 +101,6 @@
void drawDrawable(SkDrawable*, const SkMatrix*);
void drawPicture(const SkPicture*, const SkMatrix*, const SkPaint*);
- void drawText(const void*, size_t, SkScalar, SkScalar, const SkPaint&);
- void drawPosText(const void*, size_t, const SkPoint[], const SkPaint&);
- void drawPosTextH(const void*, size_t, const SkScalar[], SkScalar, const SkPaint&);
- void drawTextRSXform(const void*, size_t, const SkRSXform[], const SkRect*, const SkPaint&);
void drawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&);
void drawImage(sk_sp<const SkImage>, SkScalar, SkScalar, const SkPaint*, BitmapPalette palette);
diff --git a/libs/hwui/tests/common/scenes/ListViewAnimation.cpp b/libs/hwui/tests/common/scenes/ListViewAnimation.cpp
index 9a1ee54..4111bd2 100644
--- a/libs/hwui/tests/common/scenes/ListViewAnimation.cpp
+++ b/libs/hwui/tests/common/scenes/ListViewAnimation.cpp
@@ -16,7 +16,7 @@
#include "TestSceneBase.h"
#include "tests/common/TestListViewSceneBase.h"
-
+#include <SkFont.h>
#include <cstdio>
class ListViewAnimation;
@@ -46,11 +46,13 @@
SkColorGetR(randomColor) + SkColorGetG(randomColor) + SkColorGetB(randomColor) <
128 * 3;
paint.setColor(bgDark ? Color::White : Color::Grey_700);
- paint.setTextSize(size / 2);
+
+ SkFont font;
+ font.setSize(size / 2);
char charToShow = 'A' + (rand() % 26);
- const SkPoint pos[] = {{SkIntToScalar(size / 2),
- /*approximate centering*/ SkFloatToScalar(size * 0.7f)}};
- canvas.drawPosText(&charToShow, 1, pos, paint);
+ const SkPoint pos = {SkIntToScalar(size / 2),
+ /*approximate centering*/ SkFloatToScalar(size * 0.7f)};
+ canvas.drawSimpleText(&charToShow, 1, kUTF8_SkTextEncoding, pos.fX, pos.fY, font, paint);
return bitmap;
}