Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 71d3189

Browse files
authored
Merge branch 'main' into blur-mask-gradients
2 parents 391d967 + e96e96c commit 71d3189

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+541
-336
lines changed

DEPS

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ vars = {
1414
'flutter_git': 'https://flutter.googlesource.com',
1515
'skia_git': 'https://skia.googlesource.com',
1616
'llvm_git': 'https://llvm.googlesource.com',
17-
'skia_revision': 'a4fb847f47d9a63a999e57b6ff2b623d4689da2d',
17+
'skia_revision': 'ff1eb5af6ce4ff6147366bce77f4a959661ab5da',
1818

1919
# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
2020
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
@@ -62,7 +62,7 @@ vars = {
6262
# Dart is: https://github.com/dart-lang/sdk/blob/main/DEPS
6363
# You can use //tools/dart/create_updated_flutter_deps.py to produce
6464
# updated revision list of existing dependencies.
65-
'dart_revision': '4c64fcc134bf46e18fe1d9191b635fea3e5ebdff',
65+
'dart_revision': 'c3bd630e89bbf4bc5d24c5d62236ac8610d1759b',
6666

6767
# WARNING: DO NOT EDIT MANUALLY
6868
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
@@ -283,7 +283,7 @@ allowed_hosts = [
283283
]
284284

285285
deps = {
286-
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'ef514ca5144ba0a4ce5e7075c325d24cd6da73a4',
286+
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'e9df434539745202fa5f9b729fe5f82e5de3f025',
287287

288288
'src/flutter/third_party/depot_tools':
289289
Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '580b4ff3f5cd0dcaa2eacda28cefe0f45320e8f7',
@@ -425,7 +425,7 @@ deps = {
425425
Var('dart_git') + '/leak_tracker.git@f5620600a5ce1c44f65ddaa02001e200b096e14c',
426426

427427
'src/third_party/dart/third_party/pkg/logging':
428-
Var('dart_git') + '/logging.git@cbaf4ee2e59c318d7519edb5381f5fe2a7f69587',
428+
Var('dart_git') + '/logging.git@7a7bd5e31ddfe23e34d37ded82d6d0cd5706862c',
429429

430430
'src/third_party/dart/third_party/pkg/markdown':
431431
Var('dart_git') + '/markdown.git@1ca51664e7b1b7fe789f6be2668c909ce3aea342',
@@ -1010,7 +1010,7 @@ deps = {
10101010
'packages': [
10111011
{
10121012
'package': 'fuchsia/sdk/core/linux-amd64',
1013-
'version': 'lAV5jgp4796siOZgIDxa2NLJP7lcfcjMuVLO5FVgSjAC'
1013+
'version': 'L6_XzizcJqjneCvGA941vq-Dpu0FPwhdyfqJ0qXDUG0C'
10141014
}
10151015
],
10161016
'condition': 'host_os == "linux" and not download_fuchsia_sdk',

ci/licenses_golden/licenses_dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 58f9ae331e51c20b083f826def5adcec
1+
Signature: a4bee0c26a5856eab11811eacd69f3e6
22

33
====================================================================================================
44
LIBRARY: dart
@@ -4747,7 +4747,7 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
47474747
This Source Code Form is "Incompatible With Secondary Licenses", as
47484748
defined by the Mozilla Public License, v. 2.0.
47494749

4750-
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/4c64fcc134bf46e18fe1d9191b635fea3e5ebdff
4750+
You may obtain a copy of this library's Source Code Form from: https://dart.googlesource.com/sdk/+/b52b754d5d3e3d6772b85c297d5d0c5988f3164d
47514751
/third_party/fallback_root_certificates/
47524752

47534753
====================================================================================================

ci/licenses_golden/licenses_flutter

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38073,8 +38073,8 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.h
3807338073
ORIGIN: ../../../flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.mm + ../../../flutter/LICENSE
3807438074
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/allocator_vk.cc + ../../../flutter/LICENSE
3807538075
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/allocator_vk.h + ../../../flutter/LICENSE
38076-
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/android_hardware_buffer_texture_source_vk.cc + ../../../flutter/LICENSE
38077-
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/android_hardware_buffer_texture_source_vk.h + ../../../flutter/LICENSE
38076+
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.cc + ../../../flutter/LICENSE
38077+
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.h + ../../../flutter/LICENSE
3807838078
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/barrier_vk.cc + ../../../flutter/LICENSE
3807938079
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/barrier_vk.h + ../../../flutter/LICENSE
3808038080
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/blit_command_vk.cc + ../../../flutter/LICENSE
@@ -38103,7 +38103,7 @@ ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
3810338103
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h + ../../../flutter/LICENSE
3810438104
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc + ../../../flutter/LICENSE
3810538105
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h + ../../../flutter/LICENSE
38106-
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_holder.h + ../../../flutter/LICENSE
38106+
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/device_holder_vk.h + ../../../flutter/LICENSE
3810738107
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc + ../../../flutter/LICENSE
3810838108
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h + ../../../flutter/LICENSE
3810938109
ORIGIN: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc + ../../../flutter/LICENSE
@@ -40924,8 +40924,8 @@ FILE: ../../../flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.h
4092440924
FILE: ../../../flutter/impeller/renderer/backend/metal/vertex_descriptor_mtl.mm
4092540925
FILE: ../../../flutter/impeller/renderer/backend/vulkan/allocator_vk.cc
4092640926
FILE: ../../../flutter/impeller/renderer/backend/vulkan/allocator_vk.h
40927-
FILE: ../../../flutter/impeller/renderer/backend/vulkan/android_hardware_buffer_texture_source_vk.cc
40928-
FILE: ../../../flutter/impeller/renderer/backend/vulkan/android_hardware_buffer_texture_source_vk.h
40927+
FILE: ../../../flutter/impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.cc
40928+
FILE: ../../../flutter/impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.h
4092940929
FILE: ../../../flutter/impeller/renderer/backend/vulkan/barrier_vk.cc
4093040930
FILE: ../../../flutter/impeller/renderer/backend/vulkan/barrier_vk.h
4093140931
FILE: ../../../flutter/impeller/renderer/backend/vulkan/blit_command_vk.cc
@@ -40954,7 +40954,7 @@ FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.cc
4095440954
FILE: ../../../flutter/impeller/renderer/backend/vulkan/descriptor_pool_vk.h
4095540955
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.cc
4095640956
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_buffer_vk.h
40957-
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_holder.h
40957+
FILE: ../../../flutter/impeller/renderer/backend/vulkan/device_holder_vk.h
4095840958
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.cc
4095940959
FILE: ../../../flutter/impeller/renderer/backend/vulkan/fence_waiter_vk.h
4096040960
FILE: ../../../flutter/impeller/renderer/backend/vulkan/formats_vk.cc

ci/licenses_golden/licenses_fuchsia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 6ee5b48d8afe7372bf9fdc0cdf27eac5
1+
Signature: de13e8fff48507f700eb41b7a0aa9cf0
22

33
====================================================================================================
44
LIBRARY: fuchsia_sdk

ci/licenses_golden/licenses_skia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Signature: 7bf5931b9d26515f1d100ceb509c287a
1+
Signature: f0ff62ebc4e848f1835a459c3c733ae6
22

33
====================================================================================================
44
LIBRARY: etc1

impeller/aiks/aiks_blur_unittests.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,32 @@ TEST_P(AiksTest, GaussianBlurStyleSolid) {
939939
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
940940
}
941941

942+
TEST_P(AiksTest, MaskBlurTexture) {
943+
Scalar sigma = 30;
944+
auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
945+
if (AiksTest::ImGuiBegin("Controls", nullptr,
946+
ImGuiWindowFlags_AlwaysAutoResize)) {
947+
ImGui::SliderFloat("Sigma", &sigma, 0, 500);
948+
ImGui::End();
949+
}
950+
Canvas canvas;
951+
canvas.Scale(GetContentScale());
952+
Paint paint;
953+
paint.color = Color::Green();
954+
paint.mask_blur_descriptor = Paint::MaskBlurDescriptor{
955+
.style = FilterContents::BlurStyle::kNormal,
956+
.sigma = Sigma(sigma),
957+
};
958+
std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
959+
canvas.DrawImage(std::make_shared<Image>(boston), {200, 200}, paint);
960+
Paint red;
961+
red.color = Color::Red();
962+
canvas.DrawRect(Rect::MakeXYWH(0, 0, 200, 200), red);
963+
return canvas.EndRecordingAsPicture();
964+
};
965+
ASSERT_TRUE(OpenPlaygroundHere(callback));
966+
}
967+
942968
TEST_P(AiksTest, GuassianBlurUpdatesMipmapContents) {
943969
// This makes sure if mip maps are recycled across invocations of blurs the
944970
// contents get updated each frame correctly. If they aren't updated the color

impeller/aiks/canvas.cc

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -728,14 +728,19 @@ void Canvas::DrawImageRect(const std::shared_ptr<Image>& image,
728728
return;
729729
}
730730

731-
auto contents = TextureContents::MakeRect(dest);
732-
contents->SetTexture(image->GetTexture());
733-
contents->SetSourceRect(source);
734-
contents->SetStrictSourceRect(src_rect_constraint ==
735-
SourceRectConstraint::kStrict);
736-
contents->SetSamplerDescriptor(std::move(sampler));
737-
contents->SetOpacity(paint.color.alpha);
738-
contents->SetDeferApplyingOpacity(paint.HasColorFilter());
731+
auto texture_contents = TextureContents::MakeRect(dest);
732+
texture_contents->SetTexture(image->GetTexture());
733+
texture_contents->SetSourceRect(source);
734+
texture_contents->SetStrictSourceRect(src_rect_constraint ==
735+
SourceRectConstraint::kStrict);
736+
texture_contents->SetSamplerDescriptor(std::move(sampler));
737+
texture_contents->SetOpacity(paint.color.alpha);
738+
texture_contents->SetDeferApplyingOpacity(paint.HasColorFilter());
739+
740+
std::shared_ptr<Contents> contents = texture_contents;
741+
if (paint.mask_blur_descriptor.has_value()) {
742+
contents = paint.mask_blur_descriptor->CreateMaskBlur(texture_contents);
743+
}
739744

740745
Entity entity;
741746
entity.SetBlendMode(paint.blend_mode);

impeller/aiks/paint.cc

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "impeller/entity/contents/color_source_contents.h"
1010
#include "impeller/entity/contents/filters/color_filter_contents.h"
1111
#include "impeller/entity/contents/filters/filter_contents.h"
12+
#include "impeller/entity/contents/filters/gaussian_blur_filter_contents.h"
1213
#include "impeller/entity/contents/solid_color_contents.h"
1314
#include "impeller/entity/geometry/geometry.h"
1415

@@ -121,6 +122,34 @@ std::shared_ptr<Contents> Paint::WithColorFilter(
121122
absorb_opacity);
122123
}
123124

125+
std::shared_ptr<FilterContents> Paint::MaskBlurDescriptor::CreateMaskBlur(
126+
std::shared_ptr<TextureContents> texture_contents) const {
127+
Scalar expand_amount = GaussianBlurFilterContents::CalculateBlurRadius(
128+
GaussianBlurFilterContents::ScaleSigma(sigma.sigma));
129+
texture_contents->SetSourceRect(
130+
texture_contents->GetSourceRect().Expand(expand_amount, expand_amount));
131+
auto mask = std::make_shared<SolidColorContents>();
132+
mask->SetColor(Color::White());
133+
std::optional<Rect> coverage = texture_contents->GetCoverage({});
134+
std::shared_ptr<Geometry> geometry;
135+
if (coverage) {
136+
texture_contents->SetDestinationRect(
137+
coverage.value().Expand(expand_amount, expand_amount));
138+
geometry = Geometry::MakeRect(coverage.value());
139+
}
140+
mask->SetGeometry(geometry);
141+
auto descriptor = texture_contents->GetSamplerDescriptor();
142+
texture_contents->SetSamplerDescriptor(descriptor);
143+
std::shared_ptr<FilterContents> blurred_mask =
144+
FilterContents::MakeGaussianBlur(FilterInput::Make(mask), sigma, sigma,
145+
Entity::TileMode::kDecal, style,
146+
geometry);
147+
148+
return ColorFilterContents::MakeBlend(
149+
BlendMode::kSourceIn,
150+
{FilterInput::Make(blurred_mask), FilterInput::Make(texture_contents)});
151+
}
152+
124153
std::shared_ptr<FilterContents> Paint::MaskBlurDescriptor::CreateMaskBlur(
125154
std::shared_ptr<ColorSourceContents> color_source_contents,
126155
const std::shared_ptr<ColorFilter>& color_filter) const {

impeller/aiks/paint.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "impeller/entity/contents/contents.h"
1414
#include "impeller/entity/contents/filters/color_filter_contents.h"
1515
#include "impeller/entity/contents/filters/filter_contents.h"
16+
#include "impeller/entity/contents/texture_contents.h"
1617
#include "impeller/entity/entity.h"
1718
#include "impeller/entity/geometry/geometry.h"
1819
#include "impeller/geometry/color.h"
@@ -43,6 +44,9 @@ struct Paint {
4344
std::shared_ptr<ColorSourceContents> color_source_contents,
4445
const std::shared_ptr<ColorFilter>& color_filter) const;
4546

47+
std::shared_ptr<FilterContents> CreateMaskBlur(
48+
std::shared_ptr<TextureContents> texture_contents) const;
49+
4650
std::shared_ptr<FilterContents> CreateMaskBlur(
4751
const FilterInput::Ref& input,
4852
bool is_solid_color) const;

impeller/renderer/backend/vulkan/BUILD.gn

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ impeller_component("vulkan") {
3434
sources = [
3535
"allocator_vk.cc",
3636
"allocator_vk.h",
37-
"android_hardware_buffer_texture_source_vk.cc",
38-
"android_hardware_buffer_texture_source_vk.h",
3937
"barrier_vk.cc",
4038
"barrier_vk.h",
4139
"blit_command_vk.cc",
@@ -64,6 +62,7 @@ impeller_component("vulkan") {
6462
"descriptor_pool_vk.h",
6563
"device_buffer_vk.cc",
6664
"device_buffer_vk.h",
65+
"device_holder_vk.h",
6766
"fence_waiter_vk.cc",
6867
"fence_waiter_vk.h",
6968
"formats_vk.cc",
@@ -122,6 +121,13 @@ impeller_component("vulkan") {
122121
"yuv_conversion_vk.h",
123122
]
124123

124+
if (is_android) {
125+
sources += [
126+
"android/ahb_texture_source_vk.cc",
127+
"android/ahb_texture_source_vk.h",
128+
]
129+
}
130+
125131
public_deps = [
126132
"../../:renderer",
127133
"../../../shader_archive",

0 commit comments

Comments
 (0)