Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -43298,6 +43298,12 @@ ORIGIN: ../../../flutter/impeller/toolkit/interop/object.cc + ../../../flutter/L
ORIGIN: ../../../flutter/impeller/toolkit/interop/object.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paint.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paint.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paragraph.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paragraph.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paragraph_builder.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paragraph_builder.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paragraph_style.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/paragraph_style.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/path.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/path.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/path_builder.cc + ../../../flutter/LICENSE
Expand All @@ -43308,6 +43314,8 @@ ORIGIN: ../../../flutter/impeller/toolkit/interop/surface.cc + ../../../flutter/
ORIGIN: ../../../flutter/impeller/toolkit/interop/surface.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/texture.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/texture.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/typography_context.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/toolkit/interop/typography_context.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/typographer/backends/skia/text_frame_skia.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/typographer/backends/skia/text_frame_skia.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/typographer/backends/skia/typeface_skia.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -46168,6 +46176,12 @@ FILE: ../../../flutter/impeller/toolkit/interop/object.cc
FILE: ../../../flutter/impeller/toolkit/interop/object.h
FILE: ../../../flutter/impeller/toolkit/interop/paint.cc
FILE: ../../../flutter/impeller/toolkit/interop/paint.h
FILE: ../../../flutter/impeller/toolkit/interop/paragraph.cc
FILE: ../../../flutter/impeller/toolkit/interop/paragraph.h
FILE: ../../../flutter/impeller/toolkit/interop/paragraph_builder.cc
FILE: ../../../flutter/impeller/toolkit/interop/paragraph_builder.h
FILE: ../../../flutter/impeller/toolkit/interop/paragraph_style.cc
FILE: ../../../flutter/impeller/toolkit/interop/paragraph_style.h
FILE: ../../../flutter/impeller/toolkit/interop/path.cc
FILE: ../../../flutter/impeller/toolkit/interop/path.h
FILE: ../../../flutter/impeller/toolkit/interop/path_builder.cc
Expand All @@ -46178,6 +46192,8 @@ FILE: ../../../flutter/impeller/toolkit/interop/surface.cc
FILE: ../../../flutter/impeller/toolkit/interop/surface.h
FILE: ../../../flutter/impeller/toolkit/interop/texture.cc
FILE: ../../../flutter/impeller/toolkit/interop/texture.h
FILE: ../../../flutter/impeller/toolkit/interop/typography_context.cc
FILE: ../../../flutter/impeller/toolkit/interop/typography_context.h
FILE: ../../../flutter/impeller/tools/malioc.json
FILE: ../../../flutter/impeller/typographer/backends/skia/text_frame_skia.cc
FILE: ../../../flutter/impeller/typographer/backends/skia/text_frame_skia.h
Expand Down
21 changes: 20 additions & 1 deletion impeller/toolkit/interop/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

import("//flutter/impeller/tools/impeller.gni")

embed_blob("embedded_icu_data") {
symbol_name = "embedded_icu_data"
blob = "//flutter/third_party/icu/flutter/icudtl.dat"
hdr = "$target_gen_dir/embedded_icu_data.h"
cc = "$target_gen_dir/embedded_icu_data.cc"
deps = []
}

impeller_component("interop") {
sources = [
"color_filter.cc",
Expand All @@ -29,6 +37,12 @@ impeller_component("interop") {
"object.h",
"paint.cc",
"paint.h",
"paragraph.cc",
"paragraph.h",
"paragraph_builder.cc",
"paragraph_builder.h",
"paragraph_style.cc",
"paragraph_style.h",
"path.cc",
"path.h",
"path_builder.cc",
Expand All @@ -37,16 +51,21 @@ impeller_component("interop") {
"surface.h",
"texture.cc",
"texture.h",
"typography_context.cc",
"typography_context.h",
]

deps = [
public_deps = [
"../../base",
"../../display_list",
"../../entity",
"../../renderer/backend",
"//flutter/display_list",
"//flutter/fml",
"//flutter/third_party/txt",
]

deps = [ ":embedded_icu_data" ]
}

impeller_component("library") {
Expand Down
9 changes: 9 additions & 0 deletions impeller/toolkit/interop/dl_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,13 @@ void DisplayListBuilder::DrawTextureRect(const Texture& texture,
);
}

void DisplayListBuilder::DrawParagraph(const Paragraph& paragraph,
Point point) {
const auto& handle = paragraph.GetHandle();
if (!handle) {
return;
}
handle->Paint(&builder_, point.x, point.y);
}

} // namespace impeller::interop
3 changes: 3 additions & 0 deletions impeller/toolkit/interop/dl_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "impeller/toolkit/interop/impeller.h"
#include "impeller/toolkit/interop/object.h"
#include "impeller/toolkit/interop/paint.h"
#include "impeller/toolkit/interop/paragraph.h"
#include "impeller/toolkit/interop/path.h"
#include "impeller/toolkit/interop/texture.h"

Expand Down Expand Up @@ -106,6 +107,8 @@ class DisplayListBuilder final

void DrawDisplayList(const DisplayList& dl, Scalar opacity);

void DrawParagraph(const Paragraph& paragraph, Point point);

ScopedObject<DisplayList> Build();

private:
Expand Down
65 changes: 65 additions & 0 deletions impeller/toolkit/interop/formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

#include "flutter/display_list/dl_builder.h"
#include "flutter/display_list/dl_color.h"
#include "flutter/third_party/txt/src/txt/font_style.h"
#include "flutter/third_party/txt/src/txt/font_weight.h"
#include "flutter/third_party/txt/src/txt/paragraph_style.h"
#include "impeller/entity/entity.h"
#include "impeller/geometry/color.h"
#include "impeller/geometry/matrix.h"
Expand Down Expand Up @@ -418,6 +421,68 @@ constexpr flutter::DlColor ToDisplayListType(ImpellerColor color) {
);
}

constexpr txt::FontWeight ToTxtType(ImpellerFontWeight weight) {
switch (weight) {
case kImpellerFontWeight100:
return txt::FontWeight::w100;
case kImpellerFontWeight200:
return txt::FontWeight::w200;
case kImpellerFontWeight300:
return txt::FontWeight::w300;
case kImpellerFontWeight400:
return txt::FontWeight::w400;
case kImpellerFontWeight500:
return txt::FontWeight::w500;
case kImpellerFontWeight600:
return txt::FontWeight::w600;
case kImpellerFontWeight700:
return txt::FontWeight::w700;
case kImpellerFontWeight800:
return txt::FontWeight::w800;
case kImpellerFontWeight900:
return txt::FontWeight::w900;
}
return txt::FontWeight::w400;
}

constexpr txt::FontStyle ToTxtType(ImpellerFontStyle style) {
switch (style) {
case kImpellerFontStyleNormal:
return txt::FontStyle::normal;
case kImpellerFontStyleItalic:
return txt::FontStyle::italic;
}
return txt::FontStyle::normal;
}

constexpr txt::TextAlign ToTxtType(ImpellerTextAlignment align) {
switch (align) {
case kImpellerTextAlignmentLeft:
return txt::TextAlign::left;
case kImpellerTextAlignmentRight:
return txt::TextAlign::right;
case kImpellerTextAlignmentCenter:
return txt::TextAlign::center;
case kImpellerTextAlignmentJustify:
return txt::TextAlign::justify;
case kImpellerTextAlignmentStart:
return txt::TextAlign::start;
case kImpellerTextAlignmentEnd:
return txt::TextAlign::end;
}
return txt::TextAlign::left;
}

constexpr txt::TextDirection ToTxtType(ImpellerTextDirection direction) {
switch (direction) {
case kImpellerTextDirectionRTL:
return txt::TextDirection::rtl;
case kImpellerTextDirectionLTR:
return txt::TextDirection::ltr;
}
return txt::TextDirection::ltr;
}

} // namespace impeller::interop

#endif // FLUTTER_IMPELLER_TOOLKIT_INTEROP_FORMATS_H_
Loading