[canvaskit] Initial addition of SkParagraph
There are more parts of ParagraphStyle and TextStyle, but
this should be a bulk of the components.
Bug: skia:9469
Change-Id: I87fff6700f41cff49ecbee3a1339e84c36699c93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244837
Reviewed-by: Julia Lavrova <jlavrova@google.com>
diff --git a/modules/canvaskit/canvaskit_bindings.cpp b/modules/canvaskit/canvaskit_bindings.cpp
index eae1169..3f33045 100644
--- a/modules/canvaskit/canvaskit_bindings.cpp
+++ b/modules/canvaskit/canvaskit_bindings.cpp
@@ -68,6 +68,9 @@
#include <emscripten/html5.h>
#endif
+#ifdef SK_INCLUDE_PARAGRAPH
+#include "modules/skparagraph/include/Paragraph.h"
+#endif
// Aliases for less typing
using BoneIndices = SkVertices::BoneIndices;
using BoneWeights = SkVertices::BoneWeights;
@@ -846,6 +849,12 @@
.function("drawLine", select_overload<void (SkScalar, SkScalar, SkScalar, SkScalar, const SkPaint&)>(&SkCanvas::drawLine))
.function("drawOval", &SkCanvas::drawOval)
.function("drawPaint", &SkCanvas::drawPaint)
+#ifdef SK_INCLUDE_PARAGRAPH
+ .function("drawParagraph", optional_override([](SkCanvas& self, skia::textlayout::Paragraph* p,
+ SkScalar x, SkScalar y) {
+ p->paint(&self, x, y);
+ }), allow_raw_pointers())
+#endif
.function("drawPath", &SkCanvas::drawPath)
// Of note, picture is *not* what is colloquially thought of as a "picture", what we call
// a bitmap. An SkPicture is a series of draw commands.
@@ -909,8 +918,7 @@
SkImageInfo dstInfo = toSkImageInfo(di);
return self.writePixels(dstInfo, pixels, srcRowBytes, dstX, dstY);
- }))
- ;
+ }));
class_<SkColorFilter>("SkColorFilter")
.smart_ptr<sk_sp<SkColorFilter>>("sk_sp<SkColorFilter>>")