Skip to content

Commit

Permalink
Merge branch 'master' of github.com:flutter/engine into uv_computation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahwilliams committed Mar 13, 2023
2 parents 04e8d80 + 7c5a9d5 commit 0877a53
Show file tree
Hide file tree
Showing 57 changed files with 8,169 additions and 476 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Expand Up @@ -65,6 +65,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@32dc499307d133bb5085bae78498c0ac2cf762d5
uses: github/codeql-action/upload-sarif@16964e90ba004cdf0cd845b866b5df21038b7723
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/third_party_scan.yml
Expand Up @@ -51,6 +51,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@32dc499307d133bb5085bae78498c0ac2cf762d5
uses: github/codeql-action/upload-sarif@16964e90ba004cdf0cd845b866b5df21038b7723
with:
sarif_file: osvReport.sarif
18 changes: 9 additions & 9 deletions DEPS
Expand Up @@ -48,7 +48,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '7240b35cc401ad8cf3107e83c04b055ef3cc895d',
'dart_revision': 'c766fffb626ecac3be237703d4c68178f308e5f3',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand All @@ -61,14 +61,14 @@ vars = {
'dart_devtools_rev': 'bf15e7348d53dc83531d503be94e0c035b604984',
'dart_libprotobuf_rev': '24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb',
'dart_perfetto_rev': 'b8da07095979310818f0efde2ef3c69ea70d62c5',
'dart_protobuf_gn_rev': '5f87ef9990fc4f4ffd76b3f5b0138562178db8bc',
'dart_protobuf_gn_rev': 'f872f05cb0378eef9a7a2609076929f0f35b4141',
'dart_protobuf_rev': '75bc380a6e9601565606a13dee16c5ab2bf5019c',
'dart_pub_rev': '048e3ad2b5e1b4ebe6883addbc95722be6904a7b',
'dart_root_certificates_rev': '692f6d6488af68e0121317a9c2c9eb393eb0ee50',
'dart_watcher_rev': '5968409e1d73e21e75fc22a6481d5efaef7f3558',
'dart_webdev_rev': 'c007560346a53728920362e5ccaa7eaae85301a7',
'dart_webdev_rev': 'cfe97534b33d37c7e0bbac2a3576085f74f2eaa3',
'dart_webkit_inspection_protocol_rev': '8401098ace995e4dcd9855a2741c2dacccaa780b',
'dart_yaml_edit_rev': '998eea2e4fc474a5e95cfea117e4233d35c3069b',
'dart_yaml_edit_rev': '6abc42a74b76700ad02fa1c1ebd94951b62626b9',
'dart_zlib_rev': '27c2f474b71d0d20764f86f60ef8b00da1a16cda',

'ocmock_rev': 'c4ec0e3a7a9f56cfdbd0aa01f4f97bb4b75c5ef8', # v3.7.1
Expand Down Expand Up @@ -239,7 +239,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'a357fb6285af70772dbca8b164cd61af16cc8af1',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '287917d342224d34d6fbdf863aee8417a5f2e8b8',

# Fuchsia compatibility
#
Expand Down Expand Up @@ -449,13 +449,13 @@ deps = {
Var('dart_git') + '/term_glyph.git@d275a8f7482b6a5e4f15d0da6feb66c24f52eb94',

'src/third_party/dart/third_party/pkg/test':
Var('dart_git') + '/test.git@92da93a83615f2bc0483aa00e6a85c4f89d616e4',
Var('dart_git') + '/test.git@3ba78f15538399073d0b5aba4ec19b1378af1625',

'src/third_party/dart/third_party/pkg/test_reflective_loader':
Var('dart_git') + '/test_reflective_loader.git@c4c2d5c3f94a96f3fc79e9e28944fba391bc544c',

'src/third_party/dart/third_party/pkg/tools':
Var('dart_git') + '/tools.git@a1c35060d920122ecbecb8c5a389b58ccbceb125',
Var('dart_git') + '/tools.git@bed358ea8ca10551c710282be96cf6e95620fb24',

'src/third_party/dart/third_party/pkg/typed_data':
Var('dart_git') + '/typed_data.git@f858046fb420cf644e7d8cb86b7893f2830d8a6c',
Expand All @@ -476,7 +476,7 @@ deps = {
Var('dart_git') + '/external/github.com/google/webkit_inspection_protocol.dart.git' + '@' + Var('dart_webkit_inspection_protocol_rev'),

'src/third_party/dart/third_party/pkg/yaml':
Var('dart_git') + '/yaml.git@a6d8781744d34c391368664b4c1e174f0433bbb6',
Var('dart_git') + '/yaml.git@0f80b12978f066b3547632dec4a273649138fae4',

'src/third_party/dart/third_party/pkg/yaml_edit':
Var('dart_git') + '/yaml_edit.git' + '@' + Var('dart_yaml_edit_rev'),
Expand Down Expand Up @@ -842,7 +842,7 @@ deps = {
'packages': [
{
'package': 'fuchsia/sdk/core/linux-amd64',
'version': '2R3ybztMdyKjvEdPR-vchKcZhjxosgkdGCod1t8MApUC'
'version': 'VFZ_BtgLOf7FaEr6XYKW1wXqPuy7nQFMxd3P6-d9XwgC'
}
],
'condition': 'host_os == "linux" and not download_fuchsia_sdk',
Expand Down
1 change: 0 additions & 1 deletion ci/licenses_golden/excluded_files
Expand Up @@ -408,7 +408,6 @@
../../../flutter/third_party/web_locale_keymap/README.md
../../../flutter/third_party/web_locale_keymap/pubspec.yaml
../../../flutter/third_party/web_locale_keymap/test
../../../flutter/third_party/web_sdk_version/pubspec.yaml
../../../flutter/third_party/web_test_fonts/pubspec.yaml
../../../flutter/third_party/web_unicode/README.md
../../../flutter/third_party/web_unicode/pubspec.yaml
Expand Down
11 changes: 4 additions & 7 deletions ci/licenses_golden/licenses_flutter
Expand Up @@ -680,7 +680,6 @@ LIBRARY: engine
LIBRARY: spring_animation
LIBRARY: tonic
LIBRARY: txt
LIBRARY: web_sdk_version
LIBRARY: web_test_fonts
LIBRARY: web_unicode
ORIGIN: ../../../flutter/LICENSE
Expand Down Expand Up @@ -1122,6 +1121,8 @@ ORIGIN: ../../../flutter/impeller/entity/contents/clip_contents.cc + ../../../fl
ORIGIN: ../../../flutter/impeller/entity/contents/clip_contents.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/color_source_contents.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/color_source_contents.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/color_source_text_contents.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/color_source_text_contents.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/content_context.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/content_context.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/contents/contents.cc + ../../../flutter/LICENSE
Expand Down Expand Up @@ -1251,7 +1252,6 @@ ORIGIN: ../../../flutter/impeller/entity/shaders/linear_to_srgb_filter.frag + ..
ORIGIN: ../../../flutter/impeller/entity/shaders/linear_to_srgb_filter.vert + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/morphology_filter.frag + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/morphology_filter.vert + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/position.vert + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/position_color.vert + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/position_uv.vert + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/impeller/entity/shaders/radial_gradient_fill.frag + ../../../flutter/LICENSE
Expand Down Expand Up @@ -3169,8 +3169,6 @@ ORIGIN: ../../../flutter/third_party/txt/src/txt/platform_fuchsia.cc + ../../../
ORIGIN: ../../../flutter/third_party/txt/src/txt/platform_linux.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/txt/src/txt/platform_mac.mm + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/txt/src/txt/platform_windows.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/web_sdk_version/lib/web_sdk_version.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/web_sdk_version/lib/web_sdk_version/web_sdk_version.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/web_test_fonts/lib/web_test_fonts.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/web_test_fonts/lib/web_test_fonts/web_test_fonts.dart + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/third_party/web_unicode/lib/web_unicode.dart + ../../../flutter/LICENSE
Expand Down Expand Up @@ -3652,6 +3650,8 @@ FILE: ../../../flutter/impeller/entity/contents/clip_contents.cc
FILE: ../../../flutter/impeller/entity/contents/clip_contents.h
FILE: ../../../flutter/impeller/entity/contents/color_source_contents.cc
FILE: ../../../flutter/impeller/entity/contents/color_source_contents.h
FILE: ../../../flutter/impeller/entity/contents/color_source_text_contents.cc
FILE: ../../../flutter/impeller/entity/contents/color_source_text_contents.h
FILE: ../../../flutter/impeller/entity/contents/content_context.cc
FILE: ../../../flutter/impeller/entity/contents/content_context.h
FILE: ../../../flutter/impeller/entity/contents/contents.cc
Expand Down Expand Up @@ -3781,7 +3781,6 @@ FILE: ../../../flutter/impeller/entity/shaders/linear_to_srgb_filter.frag
FILE: ../../../flutter/impeller/entity/shaders/linear_to_srgb_filter.vert
FILE: ../../../flutter/impeller/entity/shaders/morphology_filter.frag
FILE: ../../../flutter/impeller/entity/shaders/morphology_filter.vert
FILE: ../../../flutter/impeller/entity/shaders/position.vert
FILE: ../../../flutter/impeller/entity/shaders/position_color.vert
FILE: ../../../flutter/impeller/entity/shaders/position_uv.vert
FILE: ../../../flutter/impeller/entity/shaders/radial_gradient_fill.frag
Expand Down Expand Up @@ -5720,8 +5719,6 @@ FILE: ../../../flutter/third_party/txt/src/txt/platform_fuchsia.cc
FILE: ../../../flutter/third_party/txt/src/txt/platform_linux.cc
FILE: ../../../flutter/third_party/txt/src/txt/platform_mac.mm
FILE: ../../../flutter/third_party/txt/src/txt/platform_windows.cc
FILE: ../../../flutter/third_party/web_sdk_version/lib/web_sdk_version.dart
FILE: ../../../flutter/third_party/web_sdk_version/lib/web_sdk_version/web_sdk_version.dart
FILE: ../../../flutter/third_party/web_test_fonts/lib/web_test_fonts.dart
FILE: ../../../flutter/third_party/web_test_fonts/lib/web_test_fonts/web_test_fonts.dart
FILE: ../../../flutter/third_party/web_unicode/lib/web_unicode.dart
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/licenses_fuchsia
@@ -1,4 +1,4 @@
Signature: 3b439c79749ab1a71ef2b21c0b2018f1
Signature: 943c8628754a36c980fd63c32c301539

====================================================================================================
LIBRARY: fuchsia_sdk
Expand Down
2 changes: 1 addition & 1 deletion ci/licenses_golden/licenses_third_party
@@ -1,4 +1,4 @@
Signature: 479841c56f2e6285f5971d095ed2306c
Signature: 2959cbbbe19ce6fbee5f838b9de1f204

====================================================================================================
LIBRARY: angle
Expand Down
8 changes: 6 additions & 2 deletions common/config.gni
Expand Up @@ -16,6 +16,9 @@ declare_args() {

# Whether to use a prebuilt Dart SDK instead of building one.
flutter_prebuilt_dart_sdk = false

# Whether to build host-side development artifacts.
flutter_build_engine_artifacts = true
}

# feature_defines_list ---------------------------------------------------------
Expand Down Expand Up @@ -122,5 +125,6 @@ if (flutter_prebuilt_dart_sdk) {
# TODO: We can't build the engine artifacts for arm (32-bit) right now;
# see https://github.com/flutter/flutter/issues/74322
build_engine_artifacts =
current_toolchain == host_toolchain ||
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win
flutter_build_engine_artifacts &&
(current_toolchain == host_toolchain ||
(is_linux && !is_chromeos && current_cpu != "arm") || is_mac || is_win)
31 changes: 28 additions & 3 deletions impeller/aiks/canvas.cc
Expand Up @@ -12,6 +12,7 @@
#include "impeller/aiks/paint_pass_delegate.h"
#include "impeller/entity/contents/atlas_contents.h"
#include "impeller/entity/contents/clip_contents.h"
#include "impeller/entity/contents/color_source_text_contents.h"
#include "impeller/entity/contents/rrect_shadow_contents.h"
#include "impeller/entity/contents/text_contents.h"
#include "impeller/entity/contents/texture_contents.h"
Expand Down Expand Up @@ -380,16 +381,40 @@ void Canvas::DrawTextFrame(const TextFrame& text_frame,
const Paint& paint) {
lazy_glyph_atlas_->AddTextFrame(text_frame);

Entity entity;
entity.SetStencilDepth(GetStencilDepth());
entity.SetBlendMode(paint.blend_mode);

auto text_contents = std::make_shared<TextContents>();
text_contents->SetTextFrame(text_frame);
text_contents->SetGlyphAtlas(lazy_glyph_atlas_);

if (paint.color_source.has_value()) {
auto& source = paint.color_source.value();
auto color_text_contents = std::make_shared<ColorSourceTextContents>();
entity.SetTransformation(GetCurrentTransformation());

Entity test;
auto cvg = text_contents->GetCoverage(test).value();
color_text_contents->SetTextPosition(cvg.origin + position);

text_contents->SetInverseMatrix(
Matrix::MakeTranslation(Vector3(-cvg.origin.x, -cvg.origin.y, 0)));
color_text_contents->SetTextContents(std::move(text_contents));
color_text_contents->SetColorSourceContents(source());

entity.SetContents(
paint.WithFilters(std::move(color_text_contents), false));

GetCurrentPass().AddEntity(entity);
return;
}

text_contents->SetColor(paint.color);

Entity entity;
entity.SetTransformation(GetCurrentTransformation() *
Matrix::MakeTranslation(position));
entity.SetStencilDepth(GetStencilDepth());
entity.SetBlendMode(paint.blend_mode);

entity.SetContents(paint.WithFilters(std::move(text_contents), true));

GetCurrentPass().AddEntity(entity);
Expand Down
19 changes: 19 additions & 0 deletions impeller/display_list/display_list_unittests.cc
Expand Up @@ -57,6 +57,25 @@ TEST_P(DisplayListTest, CanDrawTextBlob) {
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
}

TEST_P(DisplayListTest, CanDrawTextBlobWithGradient) {
flutter::DisplayListBuilder builder;

std::vector<flutter::DlColor> colors = {flutter::DlColor::kBlue(),
flutter::DlColor::kRed()};
const float stops[2] = {0.0, 1.0};

auto linear = flutter::DlColorSource::MakeLinear({0.0, 0.0}, {300.0, 300.0},
2, colors.data(), stops,
flutter::DlTileMode::kClamp);
flutter::DlPaint paint;
paint.setColorSource(linear);

builder.DrawTextBlob(
SkTextBlob::MakeFromString("Hello World", CreateTestFont()), 100, 100,
paint);
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
}

TEST_P(DisplayListTest, CanDrawTextWithSaveLayer) {
flutter::DisplayListBuilder builder;
builder.setColor(SK_ColorRED);
Expand Down
3 changes: 2 additions & 1 deletion impeller/entity/BUILD.gn
Expand Up @@ -45,7 +45,6 @@ impeller_shaders("entity_shaders") {
"shaders/morphology_filter.vert",
"shaders/position_color.vert",
"shaders/position_uv.vert",
"shaders/position.vert",
"shaders/radial_gradient_fill.frag",
"shaders/rrect_blur.vert",
"shaders/rrect_blur.frag",
Expand Down Expand Up @@ -121,6 +120,8 @@ impeller_component("entity") {
"contents/clip_contents.h",
"contents/color_source_contents.cc",
"contents/color_source_contents.h",
"contents/color_source_text_contents.cc",
"contents/color_source_text_contents.h",
"contents/content_context.cc",
"contents/content_context.h",
"contents/contents.cc",
Expand Down
4 changes: 2 additions & 2 deletions impeller/entity/contents/color_source_contents.h
Expand Up @@ -22,6 +22,8 @@ class ColorSourceContents : public Contents {

void SetEffectTransform(Matrix matrix);

const Matrix& GetInverseMatrix() const;

void SetAlpha(Scalar alpha);

// |Contents|
Expand All @@ -34,8 +36,6 @@ class ColorSourceContents : public Contents {
protected:
const std::shared_ptr<Geometry>& GetGeometry() const;

const Matrix& GetInverseMatrix() const;

Scalar GetAlpha() const;

private:
Expand Down
84 changes: 84 additions & 0 deletions impeller/entity/contents/color_source_text_contents.cc
@@ -0,0 +1,84 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "impeller/entity/contents/color_source_text_contents.h"

#include "impeller/entity/contents/content_context.h"
#include "impeller/entity/contents/texture_contents.h"
#include "impeller/renderer/render_pass.h"

namespace impeller {

ColorSourceTextContents::ColorSourceTextContents() = default;

ColorSourceTextContents::~ColorSourceTextContents() = default;

void ColorSourceTextContents::SetTextContents(
std::shared_ptr<TextContents> text_contents) {
text_contents_ = std::move(text_contents);
}

void ColorSourceTextContents::SetColorSourceContents(
std::shared_ptr<ColorSourceContents> color_source_contents) {
color_source_contents_ = std::move(color_source_contents);
}

std::optional<Rect> ColorSourceTextContents::GetCoverage(
const Entity& entity) const {
return text_contents_->GetCoverage(entity);
}

void ColorSourceTextContents::SetTextPosition(Point position) {
position_ = position;
}

bool ColorSourceTextContents::Render(const ContentContext& renderer,
const Entity& entity,
RenderPass& pass) const {
auto coverage = text_contents_->GetCoverage(entity);
if (!coverage.has_value()) {
return true;
}
auto transform = entity.GetTransformation();

text_contents_->SetColor(Color::Black());
color_source_contents_->SetGeometry(
Geometry::MakeRect(Rect::MakeSize(coverage->size)));

// offset the color source so it behaves as if it were drawn in the original
// position.
auto effect_transform =
color_source_contents_->GetInverseMatrix().Invert().Translate(-position_);
color_source_contents_->SetEffectTransform(effect_transform);

auto new_texture = renderer.MakeSubpass(
"Text Color Blending", ISize::Ceil(coverage.value().size),
[&](const ContentContext& context, RenderPass& pass) {
Entity sub_entity;
sub_entity.SetTransformation(transform);
sub_entity.SetContents(text_contents_);
sub_entity.SetBlendMode(BlendMode::kSource);
if (!sub_entity.Render(context, pass)) {
return false;
}

sub_entity.SetContents(color_source_contents_);
sub_entity.SetBlendMode(BlendMode::kSourceIn);
return sub_entity.Render(context, pass);
});
if (!new_texture) {
return false;
}

auto dest_rect = Rect::MakeSize(new_texture->GetSize())
.TransformBounds(transform.Invert())
.Shift(position_);

auto texture_contents = TextureContents::MakeRect(dest_rect);
texture_contents->SetTexture(new_texture);
texture_contents->SetSourceRect(Rect::MakeSize(new_texture->GetSize()));
return texture_contents->Render(renderer, entity, pass);
}

} // namespace impeller

0 comments on commit 0877a53

Please sign in to comment.