Skip to content

Commit 8005793

Browse files
authored
Remove LineContents experimental AA line shader that is no longer used (#189619)
After #188514, `LineContents` can no longer be enabled. This deletes its code and its associated `antialiased_lines` flag. See #188514 (comment) for some more context. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
1 parent 09599d4 commit 8005793

28 files changed

Lines changed: 4 additions & 1333 deletions

‎engine/src/flutter/common/settings.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,6 @@ struct Settings {
241241
// Whether to lazily initialize impeller PSO state.
242242
bool impeller_enable_lazy_shader_mode = false;
243243

244-
// An experimental mode that antialiases lines.
245-
bool impeller_antialiased_lines = false;
246-
247244
// Whether to use SDFs for rendering in Impeller.
248245
bool impeller_use_sdfs = false;
249246

‎engine/src/flutter/impeller/base/flags.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace impeller {
99
struct Flags {
10-
/// When turned on DrawLine will use the experimental antialiased path.
11-
bool antialiased_lines = false;
1210
/// Use SDFs for rendering.
1311
bool use_sdfs = false;
1412

‎engine/src/flutter/impeller/display_list/aiks_dl_path_unittests.cc‎

Lines changed: 0 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -669,183 +669,6 @@ TEST_P(AiksTest, DrawLinesRenderCorrectly) {
669669
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
670670
}
671671

672-
// The goal of this test is to show that scaling the lines doesn't also scale
673-
// the antialiasing. The amount of blurring should be the same for both
674-
// horizontal lines.
675-
TEST_P(AiksTest, ScaleExperimentAntialiasLines) {
676-
// Must be called before any methods that use the context to ensure that
677-
// this test is run with the antialias flag.
678-
if (!EnsureContextSupportsAntialiasLines()) {
679-
GTEST_SKIP() << "This backend doesn't yet support experimental AA lines.";
680-
}
681-
682-
Scalar scale = 5.0;
683-
Scalar line_width = 10.f;
684-
auto callback = [&]() -> sk_sp<DisplayList> {
685-
if (IsPlaygroundEnabled()) {
686-
ImGui::Begin("Controls", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
687-
ImGui::SliderFloat("Scale", &scale, 0.001, 5);
688-
ImGui::SliderFloat("Width", &line_width, 1, 20);
689-
690-
ImGui::End();
691-
}
692-
DisplayListBuilder builder;
693-
builder.Scale(GetContentScale().x, GetContentScale().y);
694-
695-
builder.DrawPaint(DlPaint(DlColor(0xff111111)));
696-
697-
{
698-
DlPaint paint;
699-
paint.setColor(DlColor::kGreenYellow());
700-
paint.setStrokeWidth(line_width);
701-
702-
builder.DrawLine(DlPoint(100, 100), DlPoint(350, 100), paint);
703-
builder.DrawLine(DlPoint(100, 100), DlPoint(350, 150), paint);
704-
705-
builder.Save();
706-
builder.Translate(100, 300);
707-
builder.Scale(scale, scale);
708-
builder.Translate(-100, -300);
709-
builder.DrawLine(DlPoint(100, 300), DlPoint(350, 300), paint);
710-
builder.DrawLine(DlPoint(100, 300), DlPoint(350, 450), paint);
711-
builder.Restore();
712-
}
713-
714-
{
715-
DlPaint paint;
716-
paint.setColor(DlColor::kGreenYellow());
717-
paint.setStrokeWidth(2.0);
718-
719-
builder.Save();
720-
builder.Translate(100, 500);
721-
builder.Scale(0.2, 0.2);
722-
builder.Translate(-100, -500);
723-
builder.DrawLine(DlPoint(100, 500), DlPoint(350, 500), paint);
724-
builder.DrawLine(DlPoint(100, 500), DlPoint(350, 650), paint);
725-
builder.Restore();
726-
}
727-
728-
return builder.Build();
729-
};
730-
ASSERT_TRUE(OpenPlaygroundHere(callback));
731-
}
732-
733-
TEST_P(AiksTest, HexagonExperimentAntialiasLines) {
734-
// Must be called before any methods that use the context to ensure that
735-
// this test is run with the antialias flag.
736-
if (!EnsureContextSupportsAntialiasLines()) {
737-
GTEST_SKIP() << "This backend doesn't yet support experimental AA lines.";
738-
}
739-
740-
float scale = 5.0f;
741-
float line_width = 10.f;
742-
float rotation = 0.f;
743-
744-
auto callback = [&]() -> sk_sp<DisplayList> {
745-
if (IsPlaygroundEnabled()) {
746-
ImGui::Begin("Controls", nullptr, ImGuiWindowFlags_AlwaysAutoResize);
747-
// Use ImGui::SliderFloat for consistency
748-
ImGui::SliderFloat("Scale", &scale, 0.001f, 5.0f);
749-
ImGui::SliderFloat("Width", &line_width, 1.0f, 20.0f);
750-
ImGui::SliderFloat("Rotation", &rotation, 0.0f, 180.0f);
751-
752-
ImGui::End();
753-
}
754-
DisplayListBuilder builder;
755-
builder.Scale(static_cast<float>(GetContentScale().x),
756-
static_cast<float>(GetContentScale().y));
757-
758-
builder.DrawPaint(DlPaint(DlColor(0xff111111))); // Background
759-
760-
{
761-
DlPaint hex_paint;
762-
hex_paint.setColor(
763-
DlColor::kGreen()); // Changed color to Red for visibility
764-
hex_paint.setStrokeWidth(line_width); // Use the interactive width
765-
766-
float cx = 512.0f; // Center X
767-
float cy = 384.0f; // Center Y
768-
float r = 80.0f; // Radius (distance from center to vertex)
769-
770-
float r_sin60 = r * std::sqrt(3.0f) / 2.0f;
771-
float r_cos60 = r / 2.0f;
772-
773-
DlPoint v0 = DlPoint(cx + r, cy); // Right vertex
774-
DlPoint v1 = DlPoint(cx + r_cos60, cy - r_sin60); // Top-right vertex
775-
DlPoint v2 = DlPoint(
776-
cx - r_cos60,
777-
cy - r_sin60); // Top-left vertex (v1-v2 is top horizontal side)
778-
DlPoint v3 = DlPoint(cx - r, cy); // Left vertex
779-
DlPoint v4 = DlPoint(cx - r_cos60, cy + r_sin60); // Bottom-left vertex
780-
DlPoint v5 =
781-
DlPoint(cx + r_cos60, cy + r_sin60); // Bottom-right vertex (v4-v5 is
782-
// bottom horizontal side)
783-
784-
builder.Translate(cx, cy);
785-
builder.Scale(scale, scale);
786-
builder.Rotate(rotation);
787-
builder.Translate(-cx, -cy);
788-
789-
builder.DrawLine(v0, v1, hex_paint);
790-
builder.DrawLine(v1, v2, hex_paint); // Top side
791-
builder.DrawLine(v2, v3, hex_paint);
792-
builder.DrawLine(v3, v4, hex_paint);
793-
builder.DrawLine(v4, v5, hex_paint); // Bottom side
794-
builder.DrawLine(v5, v0, hex_paint); // Close the hexagon
795-
}
796-
797-
return builder.Build();
798-
};
799-
ASSERT_TRUE(OpenPlaygroundHere(callback));
800-
}
801-
802-
TEST_P(AiksTest, SimpleExperimentAntialiasLines) {
803-
// Must be called before any methods that use the context to ensure that
804-
// this test is run with the antialias flag.
805-
if (!EnsureContextSupportsAntialiasLines()) {
806-
GTEST_SKIP() << "This backend doesn't yet support experimental AA lines.";
807-
}
808-
809-
DisplayListBuilder builder;
810-
builder.Scale(GetContentScale().x, GetContentScale().y);
811-
812-
builder.DrawPaint(DlPaint(DlColor(0xff111111)));
813-
814-
DlPaint paint;
815-
paint.setColor(DlColor::kGreenYellow());
816-
paint.setStrokeWidth(10);
817-
818-
auto draw = [&builder](DlPaint& paint) {
819-
for (auto cap :
820-
{DlStrokeCap::kButt, DlStrokeCap::kSquare, DlStrokeCap::kRound}) {
821-
paint.setStrokeCap(cap);
822-
DlPoint origin = {100, 100};
823-
builder.DrawLine(DlPoint(150, 100), DlPoint(250, 100), paint);
824-
for (int d = 15; d < 90; d += 15) {
825-
Matrix m = Matrix::MakeRotationZ(Degrees(d));
826-
Point origin = {100, 100};
827-
Point p0 = {50, 0};
828-
Point p1 = {150, 0};
829-
auto a = origin + m * p0;
830-
auto b = origin + m * p1;
831-
832-
builder.DrawLine(a, b, paint);
833-
}
834-
builder.DrawLine(DlPoint(100, 150), DlPoint(100, 250), paint);
835-
builder.DrawCircle(origin, 35, paint);
836-
837-
builder.DrawLine(DlPoint(250, 250), DlPoint(250, 250), paint);
838-
839-
builder.Translate(250, 0);
840-
}
841-
builder.Translate(-750, 250);
842-
};
843-
844-
draw(paint);
845-
846-
ASSERT_TRUE(OpenPlaygroundHere(builder.Build()));
847-
}
848-
849672
TEST_P(AiksTest, DrawRectStrokesRenderCorrectly) {
850673
DisplayListBuilder builder;
851674
DlPaint paint;

‎engine/src/flutter/impeller/display_list/canvas.cc‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#include "impeller/entity/contents/content_context.h"
3535
#include "impeller/entity/contents/filters/filter_contents.h"
3636
#include "impeller/entity/contents/framebuffer_blend_contents.h"
37-
#include "impeller/entity/contents/line_contents.h"
3837
#include "impeller/entity/contents/shadow_vertices_contents.h"
3938
#include "impeller/entity/contents/solid_color_contents.h"
4039
#include "impeller/entity/contents/solid_rrect_blur_contents.h"
@@ -810,8 +809,7 @@ bool Canvas::AttemptDrawLineSDF(const Point& p0,
810809
const Point& p1,
811810
const Paint& paint,
812811
bool reuse_depth) {
813-
if (!(renderer_.GetContext()->GetFlags().use_sdfs ||
814-
renderer_.GetContext()->GetFlags().antialiased_lines) ||
812+
if (!renderer_.GetContext()->GetFlags().use_sdfs ||
815813
!IsCompatibleWithSDFRendering(paint)) {
816814
return false;
817815
}

‎engine/src/flutter/impeller/entity/BUILD.gn‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ impeller_shaders("entity_shaders") {
3939
"shaders/gradients/radial_gradient_uniform_fill.frag",
4040
"shaders/gradients/sweep_gradient_fill.frag",
4141
"shaders/gradients/sweep_gradient_uniform_fill.frag",
42-
"shaders/line.frag",
43-
"shaders/line.vert",
4442
"shaders/rrect_blur.frag",
4543
"shaders/rrect_like_blur.vert",
4644
"shaders/rsuperellipse_blur.frag",
@@ -175,8 +173,6 @@ impeller_component("entity") {
175173
"contents/framebuffer_blend_contents.h",
176174
"contents/gradient_generator.cc",
177175
"contents/gradient_generator.h",
178-
"contents/line_contents.cc",
179-
"contents/line_contents.h",
180176
"contents/linear_gradient_contents.cc",
181177
"contents/linear_gradient_contents.h",
182178
"contents/pipelines.h",
@@ -294,7 +290,6 @@ impeller_component("entity_unittests") {
294290
"contents/filters/matrix_filter_contents_unittests.cc",
295291
"contents/filters/morphology_filter_contents_unittests.cc",
296292
"contents/host_buffer_unittests.cc",
297-
"contents/line_contents_unittests.cc",
298293
"contents/text_contents_unittests.cc",
299294
"contents/tiled_texture_contents_unittests.cc",
300295
"contents/uber_sdf_contents_unittests.cc",

‎engine/src/flutter/impeller/entity/contents/content_context.cc‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ struct ContentContext::Pipelines {
265265
Variants<FramebufferBlendSoftLightPipeline> framebuffer_blend_softlight;
266266
Variants<GaussianBlurPipeline> gaussian_blur;
267267
Variants<GlyphAtlasPipeline> glyph_atlas;
268-
Variants<LinePipeline> line;
269268
Variants<LinearGradientFillPipeline> linear_gradient_fill;
270269
Variants<LinearGradientSSBOFillPipeline> linear_gradient_ssbo_fill;
271270
Variants<LinearGradientUniformFillPipeline> linear_gradient_uniform_fill;
@@ -637,10 +636,8 @@ ContentContext::ContentContext(
637636
pipelines_->solid_fill.CreateDefault(*context_, options);
638637
pipelines_->texture.CreateDefault(*context_, options);
639638
pipelines_->fast_gradient.CreateDefault(*context_, options);
640-
pipelines_->line.CreateDefault(*context_, options);
641639
pipelines_->circle.CreateDefault(*context_, options);
642-
if (context_->GetFlags().use_sdfs ||
643-
context_->GetFlags().antialiased_lines) {
640+
if (context_->GetFlags().use_sdfs) {
644641
pipelines_->uber_sdf.CreateDefault(*context_, options);
645642
pipelines_->complex_rse.CreateDefault(*context_, options);
646643
}
@@ -1542,10 +1539,6 @@ PipelineRef ContentContext::GetCirclePipeline(
15421539
return GetPipeline(this, pipelines_->circle, opts);
15431540
}
15441541

1545-
PipelineRef ContentContext::GetLinePipeline(ContentContextOptions opts) const {
1546-
return GetPipeline(this, pipelines_->line, opts);
1547-
}
1548-
15491542
#ifdef IMPELLER_ENABLE_OPENGLES
15501543

15511544
#if !defined(FML_OS_EMSCRIPTEN)

‎engine/src/flutter/impeller/entity/contents/content_context.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ class ContentContext {
184184
PipelineRef GetFramebufferBlendSoftLightPipeline(ContentContextOptions opts) const;
185185
PipelineRef GetGaussianBlurPipeline(ContentContextOptions opts) const;
186186
PipelineRef GetGlyphAtlasPipeline(ContentContextOptions opts) const;
187-
PipelineRef GetLinePipeline(ContentContextOptions opts) const;
188187
PipelineRef GetLinearGradientFillPipeline(ContentContextOptions opts) const;
189188
PipelineRef GetLinearGradientSSBOFillPipeline(ContentContextOptions opts) const;
190189
PipelineRef GetLinearGradientUniformFillPipeline(ContentContextOptions opts) const;

0 commit comments

Comments
 (0)