Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
paragraph_builder.cc File Reference
#include "flutter/skwasm/export.h"
#include "flutter/skwasm/live_objects.h"
#include "flutter/skwasm/text/text_types.h"
#include "flutter/skwasm/wrappers.h"
#include "third_party/skia/modules/skparagraph/include/ParagraphBuilder.h"
#include "third_party/skia/modules/skunicode/include/SkUnicode_client.h"

Go to the source code of this file.

Functions

SKWASM_EXPORT void paragraphBuilder_dispose (Skwasm::ParagraphBuilder *builder)
 
SKWASM_EXPORT void paragraphBuilder_addPlaceholder (Skwasm::ParagraphBuilder *builder, SkScalar width, SkScalar height, skia::textlayout::PlaceholderAlignment alignment, SkScalar baseline_offset, skia::textlayout::TextBaseline baseline)
 
SKWASM_EXPORT void paragraphBuilder_addText (Skwasm::ParagraphBuilder *builder, std::u16string *text)
 
SKWASM_EXPORT char * paragraphBuilder_getUtf8Text (Skwasm::ParagraphBuilder *builder, uint32_t *out_length)
 
SKWASM_EXPORT void paragraphBuilder_pushStyle (Skwasm::ParagraphBuilder *builder, Skwasm::TextStyle *style)
 
SKWASM_EXPORT void paragraphBuilder_pop (Skwasm::ParagraphBuilder *builder)
 
SKWASM_EXPORT std::vector< SkUnicode::Position > * unicodePositionBuffer_create (size_t length)
 
SKWASM_EXPORT SkUnicode::Position * unicodePositionBuffer_getDataPointer (std::vector< SkUnicode::Position > *buffer)
 
SKWASM_EXPORT void unicodePositionBuffer_free (std::vector< SkUnicode::Position > *buffer)
 
SKWASM_EXPORT std::vector< SkUnicode::LineBreakBefore > * lineBreakBuffer_create (size_t length)
 
SKWASM_EXPORT SkUnicode::LineBreakBefore * lineBreakBuffer_getDataPointer (std::vector< SkUnicode::LineBreakBefore > *buffer)
 
SKWASM_EXPORT void lineBreakBuffer_free (std::vector< SkUnicode::LineBreakBefore > *buffer)
 

Function Documentation

◆ lineBreakBuffer_create()

SKWASM_EXPORT std::vector< SkUnicode::LineBreakBefore > * lineBreakBuffer_create ( size_t  length)

Definition at line 69 of file paragraph_builder.cc.

70 {
72 return new std::vector<SkUnicode::LineBreakBefore>(
73 length, {0, SkUnicode::LineBreakType::kSoftLineBreak});
74}
size_t length
uint32_t live_line_break_buffer_count

References length, and Skwasm::live_line_break_buffer_count.

◆ lineBreakBuffer_free()

SKWASM_EXPORT void lineBreakBuffer_free ( std::vector< SkUnicode::LineBreakBefore > *  buffer)

Definition at line 81 of file paragraph_builder.cc.

82 {
84 delete buffer;
85}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98

References Skwasm::live_line_break_buffer_count.

◆ lineBreakBuffer_getDataPointer()

SKWASM_EXPORT SkUnicode::LineBreakBefore * lineBreakBuffer_getDataPointer ( std::vector< SkUnicode::LineBreakBefore > *  buffer)

Definition at line 76 of file paragraph_builder.cc.

77 {
78 return buffer->data();
79}

◆ paragraphBuilder_addPlaceholder()

SKWASM_EXPORT void paragraphBuilder_addPlaceholder ( Skwasm::ParagraphBuilder builder,
SkScalar  width,
SkScalar  height,
skia::textlayout::PlaceholderAlignment  alignment,
SkScalar  baseline_offset,
skia::textlayout::TextBaseline  baseline 
)

Definition at line 17 of file paragraph_builder.cc.

23 {
24 builder->skia_paragraph_builder->addPlaceholder(
25 skia::textlayout::PlaceholderStyle(width, height, alignment, baseline,
26 baseline_offset));
27}
int32_t height
int32_t width
std::unique_ptr< skia::textlayout::ParagraphBuilder > skia_paragraph_builder
Definition text_types.h:44

References height, Skwasm::ParagraphBuilder::skia_paragraph_builder, and width.

◆ paragraphBuilder_addText()

SKWASM_EXPORT void paragraphBuilder_addText ( Skwasm::ParagraphBuilder builder,
std::u16string *  text 
)

Definition at line 29 of file paragraph_builder.cc.

30 {
31 builder->skia_paragraph_builder->addText(*text);
32}
std::u16string text

References Skwasm::ParagraphBuilder::skia_paragraph_builder, and text.

◆ paragraphBuilder_dispose()

SKWASM_EXPORT void paragraphBuilder_dispose ( Skwasm::ParagraphBuilder builder)

Definition at line 12 of file paragraph_builder.cc.

12 {
14 delete builder;
15}
uint32_t live_paragraph_builder_count

References Skwasm::live_paragraph_builder_count.

◆ paragraphBuilder_getUtf8Text()

SKWASM_EXPORT char * paragraphBuilder_getUtf8Text ( Skwasm::ParagraphBuilder builder,
uint32_t *  out_length 
)

Definition at line 34 of file paragraph_builder.cc.

36 {
37 auto span = builder->skia_paragraph_builder->getText();
38 *out_length = span.size();
39 return span.data();
40}

References Skwasm::ParagraphBuilder::skia_paragraph_builder.

◆ paragraphBuilder_pop()

SKWASM_EXPORT void paragraphBuilder_pop ( Skwasm::ParagraphBuilder builder)

Definition at line 48 of file paragraph_builder.cc.

48 {
49 builder->skia_paragraph_builder->pop();
50}

References Skwasm::ParagraphBuilder::skia_paragraph_builder.

◆ paragraphBuilder_pushStyle()

SKWASM_EXPORT void paragraphBuilder_pushStyle ( Skwasm::ParagraphBuilder builder,
Skwasm::TextStyle style 
)

Definition at line 42 of file paragraph_builder.cc.

43 {
44 style->PopulatePaintIds(builder->paints);
45 builder->skia_paragraph_builder->pushStyle(style->skia_style);
46}
std::vector< flutter::DlPaint > paints
Definition text_types.h:45
void PopulatePaintIds(std::vector< flutter::DlPaint > &paints)
Definition text_types.h:21
skia::textlayout::TextStyle skia_style
Definition text_types.h:17

References Skwasm::ParagraphBuilder::paints, Skwasm::TextStyle::PopulatePaintIds(), Skwasm::ParagraphBuilder::skia_paragraph_builder, and Skwasm::TextStyle::skia_style.

◆ unicodePositionBuffer_create()

SKWASM_EXPORT std::vector< SkUnicode::Position > * unicodePositionBuffer_create ( size_t  length)

Definition at line 52 of file paragraph_builder.cc.

53 {
55 return new std::vector<SkUnicode::Position>(length);
56}
uint32_t live_unicode_position_buffer_count

References length, and Skwasm::live_unicode_position_buffer_count.

◆ unicodePositionBuffer_free()

SKWASM_EXPORT void unicodePositionBuffer_free ( std::vector< SkUnicode::Position > *  buffer)

◆ unicodePositionBuffer_getDataPointer()

SKWASM_EXPORT SkUnicode::Position * unicodePositionBuffer_getDataPointer ( std::vector< SkUnicode::Position > *  buffer)

Definition at line 58 of file paragraph_builder.cc.

59 {
60 return buffer->data();
61}