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

Use DlPathEffect Object #32159

Merged
merged 17 commits into from
May 12, 2022
Merged

Conversation

JsouLiang
Copy link
Contributor

@JsouLiang JsouLiang commented Mar 21, 2022

Use DlPathEffect Object to replace SkPathEffect Object

  • Change the impeller DLDispatcher SkPathEffect to flutter::DlPathEffect

@JsouLiang JsouLiang changed the title Use DlPathEffect Object [WIP] Use DlPathEffect Object Mar 21, 2022
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@JsouLiang JsouLiang changed the title [WIP] Use DlPathEffect Object Use DlPathEffect Object Mar 22, 2022
@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch from 3b53044 to eb221b8 Compare March 22, 2022 07:34
@JsouLiang
Copy link
Contributor Author

@flar Hey, this is about the DlPathEffect , please give me a review, Thank you! :)

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the information in this review is now covered under a new comment on the "graphics package neutral" issue.

In the end, implementing this particular may end up being eliminated by upcoming Impeller work. It may be useful in the short term (for weeks if not months) for "Flutter on DisplayList on Skia", but that is something to consider with respect to how much time to spend on this object.

Minimally, it implements way more flavors of PathEffect than we will ever see and so it should be cut down to only those sub-classes that we need (Dash + Unknown?)

If you want to finish this work off, then consider the comments below about trimming it down and I will review again in a more focused implementation.

@JsouLiang
Copy link
Contributor Author

JsouLiang commented Mar 23, 2022

@flar As you say, I have cut down other PathEffect,reserved only DlDashPathEffect and DlUnknownPathEffect

Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only done a light read through as I'd like to see the DlDashPathEffect use inline storage for the intervals to be bulk-compare compatible for the DisplayList buffer.

@JsouLiang
Copy link
Contributor Author

JsouLiang commented Mar 25, 2022

@flar hi, I have fixed the comments please help me take a look. Thanks

@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch 8 times, most recently from e494718 to 1639133 Compare March 31, 2022 03:12
@JsouLiang
Copy link
Contributor Author

@flar hey, I have fix the comments, please give me a review, thanks. And the impeller version has some issue, case the latest version display_list_dispatcher DlVertices has changed, but the engine doesn't have this class

@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch from 1639133 to 9aaea6a Compare March 31, 2022 15:51
@zanderso zanderso requested a review from flar March 31, 2022 19:58
@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch from ee2e487 to adad369 Compare April 1, 2022 06:56

TEST(DisplayListPathEffect, BlurNotEquals) {
const SkScalar TestDashes1[] = {4.0, 2.0};
const SkScalar TestDashes2[] = {1.0, 1.5};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You misread or misunderstood my comment.

Use the TestNotEquals helper methods in display_list_attributes_testing.h
Test 4 potential sources of inequality as below:

This is what I was asking for:

  const SkScalar TestDashes1[] = {4.0, 2.0};
  const SkScalar TestDashes2[] = {5.0, 2.0};
  const SkScalar TestDashes3[] = {4.0, 3.0};
  const SkScalar TestDashes4[] = {4.0, 2.0, 6.0};
  auto effect1 = DlDashPathEffect::Make(TestDashes1, 2, 0.0);
  auto effect2 = DlDashPathEffect::Make(TestDashes2, 2, 0.0);
  auto effect3 = DlDashPathEffect::Make(TestDashes3, 2, 0.0);
  auto effect4 = DlDashPathEffect::Make(TestDashes4, 3, 0.0);
  auto effect5 = DlDashPathEffect::Make(TestDashes1, 2, 1.0);

  TestNotEquals(*effect1, *effect2, "Interval 1 differs");
  TestNotEquals(*effect1, *effect3, "Interval 2 differs");
  TestNotEquals(*effect1, *effect4, "Dash count differs");
  TestNotEquals(*effect1, *effect5, "Dash phase differs");

@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch from d727302 to ab0a620 Compare May 6, 2022 05:01
@JsouLiang
Copy link
Contributor Author

This needs a rebase on ToT.

@chinmaygarde done.
Thanks

@JsouLiang JsouLiang requested a review from flar May 6, 2022 05:08
@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch from ab0a620 to 417c862 Compare May 6, 2022 05:47
@JsouLiang JsouLiang force-pushed the Use-DlPathEffect-Object branch from 417c862 to 563d368 Compare May 9, 2022 12:40
@chinmaygarde chinmaygarde removed their request for review May 10, 2022 17:23
@JsouLiang JsouLiang requested a review from chinmaygarde May 11, 2022 02:52
@eggfly eggfly removed the request for review from chinmaygarde May 11, 2022 02:54
Copy link
Contributor

@flar flar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really all just nits - include file over-including in most places.

Upgrading the DlStreamDispatcher::setPathEffect doesn't really fix/break anything, but it would be nice for new test writers to see the contents - and this PR is all about making it easy to see the contents.

(To see what the output looks like, I usually go to the dl_unittest that constructs a giant DL of every op (see

sk_sp<DisplayList> default_dl = Build(allGroups.size(), 0);
) and add a temporary FML_LOG(ERROR) << default_dl; line and that shows how all of the various DL ops show up in an output stream. Then just run the display_list_unittests and adjust the output until I'm happy.)

@@ -5,12 +5,14 @@
#ifndef FLUTTER_DISPLAY_LIST_DISPLAY_LIST_PAINT_H_
#define FLUTTER_DISPLAY_LIST_DISPLAY_LIST_PAINT_H_

#include <memory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

#ifndef FLUTTER_DISPLAY_LIST_DISPLAY_LIST_PATH_EFFECT_H_
#define FLUTTER_DISPLAY_LIST_DISPLAY_LIST_PATH_EFFECT_H_

#include <cstring>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this used?

ASSERT_NE(path_effect.shared().get(), &path_effect);
ASSERT_EQ(*path_effect.shared(), path_effect);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - other files have an "UnknownAsNone" test that verifies that all of the "asFoo()" methods return nullptr...

@@ -25,7 +25,9 @@
#include "third_party/skia/include/core/SkShader.h"
#include "third_party/skia/include/core/SkTextBlob.h"
#include "third_party/skia/include/core/SkVertices.h"
#include "third_party/skia/include/effects/SkCornerPathEffect.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is used any more.

@@ -4,6 +4,7 @@

#pragma once

#include "display_list/display_list_path_effect.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be relative to "flutter/display_list" as the others?

@@ -6,6 +6,7 @@

#include <optional>

#include "display_list/display_list_path_effect.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be needed as it will be included in the impeller/dl_dispatcher.h above.

@@ -479,7 +479,7 @@ void DisplayListStreamDispatcher::setBlendMode(DlBlendMode mode) {
void DisplayListStreamDispatcher::setBlender(sk_sp<SkBlender> blender) {
startl() << "setBlender(" << blender << ");" << std::endl;
}
void DisplayListStreamDispatcher::setPathEffect(sk_sp<SkPathEffect> effect) {
void DisplayListStreamDispatcher::setPathEffect(const DlPathEffect* effect) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be expanded to be more descriptive now that we can inspect the DlPathEffect.

@@ -9,6 +9,7 @@

#include "flutter/display_list/display_list.h"
#include "flutter/display_list/display_list_dispatcher.h"
#include "flutter/display_list/display_list_path_effect.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should come for free from the dl_dispatcher include.

@JsouLiang JsouLiang merged commit b8ca6a5 into flutter:main May 12, 2022
JsouLiang added a commit that referenced this pull request May 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants