Remove SkTextBox

Change-Id: I697135475fa9c1b7e803500b743f10c3877c1e10
Reviewed-on: https://skia-review.googlesource.com/129560
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index c90c13a..36bd0b2 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -26,6 +26,7 @@
 #include "SkPictureRecorder.h"
 #include "SkPixelRef.h"
 #include "SkRRect.h"
+#include "SkShaper.h"
 #include "SkString.h"
 #include "SkSurface.h"
 #include "SkTextBlob.h"
@@ -1960,7 +1961,6 @@
     return 1;
 }
 
-#include "SkTextBox.h"
 // Sk.newTextBlob(text, rect, paint)
 static int lsk_newTextBlob(lua_State* L) {
     const char* text = lua_tolstring(L, 1, nullptr);
@@ -1968,14 +1968,14 @@
     lua2rect(L, 2, &bounds);
     const SkPaint& paint = *get_obj<SkPaint>(L, 3);
 
-    SkTextBox box;
-    box.setMode(SkTextBox::kLineBreak_Mode);
-    box.setBox(bounds);
-    box.setText(text, strlen(text), paint);
+    SkShaper shaper(nullptr);
 
-    SkScalar newBottom;
-    push_ref<SkTextBlob>(L, box.snapshotTextBlob(&newBottom));
-    SkLua(L).pushScalar(newBottom);
+    SkTextBlobBuilder builder;
+    SkPoint end = shaper.shape(&builder, paint, text, strlen(text), true,
+                               { bounds.left(), bounds.top() }, bounds.width());
+
+    push_ref<SkTextBlob>(L, builder.make());
+    SkLua(L).pushScalar(end.fY);
     return 2;
 }