Skip to content

[impeller] antialias lines don't handle scale correctly #165905

@gaaclarke

Description

@gaaclarke

reproduction

TEST_P(AiksTest, ScaleExperimentAntialiasLines) {
  Scalar scale = 1.0;
  Scalar line_width = 10.f;
  auto callback = [&]() -> sk_sp<DisplayList> {
    if (AiksTest::ImGuiBegin("Controls", nullptr,
                             ImGuiWindowFlags_AlwaysAutoResize)) {
      ImGui::SliderFloat("Scale", &scale, 0.001, 5);
      ImGui::SliderFloat("Width", &line_width, 1, 20);
      ImGui::End();
    }
    DisplayListBuilder builder;
    builder.Scale(GetContentScale().x, GetContentScale().y);

    DlPaint paint;
    paint.setColor(DlColor::kGreenYellow());
    paint.setStrokeWidth(line_width);

    builder.Translate(100, 100);
    builder.Scale(scale, scale);
    builder.Translate(-100, -100);
    builder.DrawLine(DlPoint(100, 100), DlPoint(350, 100), paint);
    builder.DrawLine(DlPoint(100, 100), DlPoint(350, 150), paint);

    return builder.Build();
  };
  ASSERT_TRUE(OpenPlaygroundHere(callback));
}

observed

(With kSampleRadius = 3.0)

Image Image

expected

I would have expected the blur to be a fixed pixel size. That however will be problematic for lines that are scaled down though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    e: impellerImpeller rendering backend issues and features requeststeam-engineOwned by Engine team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions