Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit db8dfbe
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Mar 13 10:44:36 2023 -0700

    update malioc diff

commit 0877a53
Merge: 04e8d80 7c5a9d5
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Mar 13 10:40:07 2023 -0700

    Merge branch 'master' of github.com:flutter/engine into uv_computation

commit 7c5a9d5
Author: Jackson Gardner <jacksongardner@google.com>
Date:   Mon Mar 13 09:54:22 2023 -0700

    Use plain Uint32List objects with the fragmenter APIs. (flutter#40239)

    Use plain Uint32List objects with the fragmenter APIs.

commit 04e8d80
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Mar 13 09:50:23 2023 -0700

    fix double divide and add test

commit 9b42cbc
Author: jonahwilliams <jonahwilliams@google.com>
Date:   Mon Mar 13 09:32:48 2023 -0700

    [impeller] implement GetPositionUVBuffer

commit 3d545ad
Author: Dan Field <dnfield@google.com>
Date:   Mon Mar 13 09:22:28 2023 -0700

    [Impeller][Compute] Fix visual issues with heart (flutter#40240)

commit 650c6e3
Author: Zachary Anderson <zanderso@users.noreply.github.com>
Date:   Mon Mar 13 08:45:38 2023 -0700

    Revert "[Impeller] More sundry fixes to the Vulkan backend. (flutter#40244)" (flutter#40247)

    Revert "[Impeller] More sundry fixes to the Vulkan backend."

commit 3ac895e
Author: Jonah Williams <jonahwilliams@google.com>
Date:   Mon Mar 13 08:42:13 2023 -0700

    [Impeller] support for foreground shaders on text (flutter#40193)

    [Impeller] support for foreground shaders on text

commit bb1ca8f
Author: Lasse R.H. Nielsen <lrn@google.com>
Date:   Mon Mar 13 13:43:04 2023 +0100

    Change `extends Iterator` to using `implements` (flutter#40175)

    The Dart 3.0 libraries will mark Iterator with the interface class modifier, which prevents extends. It will do so because the class has no implementation to inherit, and is only intended as an interface, which it is now possible to express.

    This should unblock relanding https://dart-review.googlesource.com/c/sdk/+/287760
    (Also working on disabling the class-modifiers experiment for Flutter dart: libraries, which was enabled along with the Dart SDK libraries, until the experiment can be intentionally turned back on.)

commit 24afaf9
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Mon Mar 13 09:44:31 2023 +0000

    Bump github/codeql-action from 2.2.5 to 2.2.6 (flutter#40246)

    Bump github/codeql-action from 2.2.5 to 2.2.6

commit ae979a8
Author: Chinmay Garde <chinmaygarde@google.com>
Date:   Sun Mar 12 23:49:22 2023 -0700

    [Impeller] More sundry fixes to the Vulkan backend. (flutter#40244)

    [Impeller] More sundry fixes to the Vulkan backend.

commit 57f7120
Author: Zachary Anderson <zanderso@users.noreply.github.com>
Date:   Sat Mar 11 19:38:43 2023 -0800

    Add GN arguments that disable building host artifacts (flutter#40242)

commit 04e8d54
Author: Chris Bracken <chris@bracken.jp>
Date:   Sat Mar 11 12:49:59 2023 -0800

    [macOS] Forward mouseDown/Up to view controller (flutter#40241)

    This works around an AppKit bug in which mouseDown/mouseUp events are
    not correctly forwarded up the responder chain for views nested inside
    an NSPopover if (and only if) the macOS "Reduce Transparency"
    accessibility setting is enabled in the System Settings.

    When the above conditions are satisfied, the nested NSView receives the
    mouseDown:/mouseUp: call but if it delegates to the default
    implementation (implemented in NSResponder) mouseDown/mouseUp calls are
    triggered on containing views (in our case FlutterViewWrapper) but not
    triggered on the view controller and other responders in the responder
    chain until we an _NSPopoverWindow class is hit.

    A minimal AppKit-only (non-Flutter) repro shows this behaviour repros
    with even a minimal NSViewController implementation and an unmodified NSView.
    See: https://github.com/cbracken/PopoverRepro

    A radar has been filed with Apple and a copy posted to OpenRadar.
    See: http://www.openradar.me/FB12050037

    In order to work around this bug, we override mouseDown/mouseUp in the
    topmost containing view of FlutterView (in our case, FlutterViewWrapper)
    to have the behaviour documented as the default behaviour in
    NSResponder's mouseDown/mouseUp documentation. In otherwords, to simply
    forward the call to self.nextResponder.
    See: https://developer.apple.com/documentation/appkit/nsresponder/1524634-mousedown

    Because replicating the exact configuration of a FlutterView contained
    in an NSPopover and System Settings that have been modified to enable
    the "Reduce Transparency" setting is difficult and likely error-prone in
    infra, we instead simulate the bug by testing that even if NSResponder's
    mouseDown/mouseUp method are swizzled to no-op, these calls are
    correctly forwarded to the next responder in the chain.

    If, in the future Apple does fix this issue, this workaround can be
    removed once Flutter's minimum supported macOS SDK is at least the
    version that contains the fix.

    Issue: flutter/flutter#115015

commit c7894a6
Author: Dan Field <dnfield@google.com>
Date:   Fri Mar 10 16:39:04 2023 -0800

    Make the context current before accessing GL in MakeSkiaGpuImage (flutter#40208)

    Make the context current before accessing GL in MakeSkiaGpuImage

commit 7f25023
Author: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
Date:   Fri Mar 10 15:42:18 2023 -0800

    Revert "Make FlutterTest the default test font (flutter#40188)" (flutter#40237)

    This reverts commit 9270e3d.

commit 12f2fdf
Author: Yegor <yjbanov@google.com>
Date:   Fri Mar 10 14:46:06 2023 -0800

    Revert "[web] Access engine version to get correct gstatic URL (flutter#40194)" (flutter#40235)

    This reverts commit 161f759.

commit 3018843
Author: skia-flutter-autoroll <skia-flutter-autoroll@skia.org>
Date:   Fri Mar 10 17:44:48 2023 -0500

    Manual roll Dart SDK from 7240b35cc401 to c766fffb626e (9 revisions) (flutter#40233)

    Manual roll requested by asiva@google.com

    https://dart.googlesource.com/sdk.git/+log/7240b35cc401..c766fffb626e

    2023-03-10 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-322.0.dev
    2023-03-10 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-321.0.dev
    2023-03-10 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-320.0.dev
    2023-03-10 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-319.0.dev
    2023-03-09 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-318.0.dev
    2023-03-09 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-317.0.dev
    2023-03-09 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-316.0.dev
    2023-03-09 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-315.0.dev
    2023-03-09 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.0.0-314.0.dev

    If this roll has caused a breakage, revert this CL and stop the roller
    using the controls here:
    https://autoroll.skia.org/r/dart-sdk-flutter-engine
    Please CC aam@google.com,asiva@google.com,dart-vm-team@google.com,jimgraham@google.com,rmistry@google.com on the revert to ensure that a human
    is aware of the problem.

    To file a bug in Flutter Engine: https://github.com/flutter/flutter/issues/new/choose

    To report a problem with the AutoRoller itself, please file a bug:
    https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

commit 220e867
Author: Zachary Anderson <zanderso@users.noreply.github.com>
Date:   Fri Mar 10 14:38:58 2023 -0800

    Roll buildroot to 287917d (flutter#40232)

    To pick up flutter/buildroot#691

commit c99baf2
Author: Jim Graham <flar@google.com>
Date:   Fri Mar 10 14:32:52 2023 -0800

    Roll Fuchsia Linux SDK to 12.20230309.0.1 (flutter#40231)

    Roll Fuchsia Linux SDK to 12.20230309.0.1

commit 3b07c4c
Author: Jonah Williams <jonahwilliams@google.com>
Date:   Fri Mar 10 14:24:45 2023 -0800

    [Impeller] remove unused shader, format malioc diff (flutter#40230)

    [Impeller] remove unused shader, format malioc diff
  • Loading branch information
jonahwilliams committed Mar 13, 2023
1 parent b2766d0 commit bd9cdb0
Show file tree
Hide file tree
Showing 64 changed files with 8,389 additions and 682 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Signature: 479841c56f2e6285f5971d095ed2306c
Signature: 2959cbbbe19ce6fbee5f838b9de1f204

====================================================================================================
LIBRARY: angle
Expand Down
8 changes: 6 additions & 2 deletions common/config.gni
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ -398,16 +399,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@ -122,6 +121,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit bd9cdb0

Please sign in to comment.