diff options
author | Herb Derby <herb@google.com> | 2018-05-22 12:01:50 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-22 17:50:35 +0000 |
commit | 1724db1658c48c20c75bc39497d70cb1e227fbdb (patch) | |
tree | d395cca0f161d6d0d400920203d916d5d3034acb /src/utils/SkLua.cpp | |
parent | d90cd3b2796b693b2d6af6fe13a8ca6c4795d80e (diff) |
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>
Diffstat (limited to 'src/utils/SkLua.cpp')
-rw-r--r-- | src/utils/SkLua.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp index c90c13a399..36bd0b228b 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 @@ static int lsk_newRRect(lua_State* L) { 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 @@ static int lsk_newTextBlob(lua_State* L) { 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; } |