Add hooks to implement Canvas.drawTextOnPath() in GL
Change-Id: I165c9e05facf5365aa6850605688e538640c7fcc
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index f9088ac..8153823 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -61,6 +61,7 @@
"DrawLines",
"DrawPoints",
"DrawText",
+ "DrawTextOnPath",
"DrawPosText",
"ResetShader",
"SetupShader",
@@ -483,7 +484,7 @@
break;
case DrawText: {
getText(&text);
- int count = getInt();
+ int32_t count = getInt();
float x = getFloat();
float y = getFloat();
SkPaint* paint = getPaint(renderer);
@@ -492,6 +493,17 @@
text.text(), text.length(), count, x, y, paint, length);
}
break;
+ case DrawTextOnPath: {
+ getText(&text);
+ int32_t count = getInt();
+ SkPath* path = getPath();
+ float hOffset = getFloat();
+ float vOffset = getFloat();
+ SkPaint* paint = getPaint(renderer);
+ ALOGD("%s%s %s, %d, %d, %p", (char*) indent, OP_NAMES[op],
+ text.text(), text.length(), count, paint);
+ }
+ break;
case DrawPosText: {
getText(&text);
int count = getInt();
@@ -890,6 +902,19 @@
renderer.drawText(text.text(), text.length(), count, x, y, paint, length);
}
break;
+ case DrawTextOnPath: {
+ getText(&text);
+ int32_t count = getInt();
+ SkPath* path = getPath();
+ float hOffset = getFloat();
+ float vOffset = getFloat();
+ SkPaint* paint = getPaint(renderer);
+ DISPLAY_LIST_LOGD("%s%s %s, %d, %d, %p", (char*) indent, OP_NAMES[op],
+ text.text(), text.length(), count, paint);
+ renderer.drawTextOnPath(text.text(), text.length(), count, path,
+ hOffset, vOffset, paint);
+ }
+ break;
case DrawPosText: {
getText(&text);
int32_t count = getInt();
@@ -1331,6 +1356,19 @@
addSkip(location);
}
+void DisplayListRenderer::drawTextOnPath(const char* text, int bytesCount, int count,
+ SkPath* path, float hOffset, float vOffset, SkPaint* paint) {
+ if (!text || count <= 0) return;
+ addOp(DisplayList::DrawTextOnPath);
+ addText(text, bytesCount);
+ addInt(count);
+ addPath(path);
+ addFloat(hOffset);
+ addFloat(vOffset);
+ paint->setAntiAlias(true);
+ addPaint(paint);
+}
+
void DisplayListRenderer::drawPosText(const char* text, int bytesCount, int count,
const float* positions, SkPaint* paint) {
if (!text || count <= 0) return;