diff --git a/ci/licenses_golden/excluded_files b/ci/licenses_golden/excluded_files index c05c7a7eb8fcc..340c1c965e884 100644 --- a/ci/licenses_golden/excluded_files +++ b/ci/licenses_golden/excluded_files @@ -38,7 +38,6 @@ ../../../flutter/display_list/effects/dl_color_source_unittests.cc ../../../flutter/display_list/effects/dl_image_filter_unittests.cc ../../../flutter/display_list/effects/dl_mask_filter_unittests.cc -../../../flutter/display_list/effects/dl_path_effect_unittests.cc ../../../flutter/display_list/geometry/dl_geometry_types_unittests.cc ../../../flutter/display_list/geometry/dl_region_unittests.cc ../../../flutter/display_list/geometry/dl_rtree_unittests.cc diff --git a/ci/licenses_golden/licenses_flutter b/ci/licenses_golden/licenses_flutter index c10a3d2883a51..70cbd7942ea7f 100644 --- a/ci/licenses_golden/licenses_flutter +++ b/ci/licenses_golden/licenses_flutter @@ -41545,8 +41545,6 @@ ORIGIN: ../../../flutter/display_list/effects/dl_image_filter.cc + ../../../flut ORIGIN: ../../../flutter/display_list/effects/dl_image_filter.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/display_list/effects/dl_mask_filter.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/display_list/effects/dl_mask_filter.h + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/display_list/effects/dl_path_effect.cc + ../../../flutter/LICENSE -ORIGIN: ../../../flutter/display_list/effects/dl_path_effect.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/display_list/effects/dl_runtime_effect.cc + ../../../flutter/LICENSE ORIGIN: ../../../flutter/display_list/effects/dl_runtime_effect.h + ../../../flutter/LICENSE ORIGIN: ../../../flutter/display_list/geometry/dl_geometry_types.h + ../../../flutter/LICENSE @@ -44411,8 +44409,6 @@ FILE: ../../../flutter/display_list/effects/dl_image_filter.cc FILE: ../../../flutter/display_list/effects/dl_image_filter.h FILE: ../../../flutter/display_list/effects/dl_mask_filter.cc FILE: ../../../flutter/display_list/effects/dl_mask_filter.h -FILE: ../../../flutter/display_list/effects/dl_path_effect.cc -FILE: ../../../flutter/display_list/effects/dl_path_effect.h FILE: ../../../flutter/display_list/effects/dl_runtime_effect.cc FILE: ../../../flutter/display_list/effects/dl_runtime_effect.h FILE: ../../../flutter/display_list/geometry/dl_geometry_types.h diff --git a/display_list/BUILD.gn b/display_list/BUILD.gn index dcd3972c500a0..d4ac72b67dfd4 100644 --- a/display_list/BUILD.gn +++ b/display_list/BUILD.gn @@ -56,8 +56,6 @@ source_set("display_list") { "effects/dl_image_filter.h", "effects/dl_mask_filter.cc", "effects/dl_mask_filter.h", - "effects/dl_path_effect.cc", - "effects/dl_path_effect.h", "effects/dl_runtime_effect.cc", "effects/dl_runtime_effect.h", "geometry/dl_geometry_types.h", @@ -119,7 +117,6 @@ if (enable_unittests) { "effects/dl_color_source_unittests.cc", "effects/dl_image_filter_unittests.cc", "effects/dl_mask_filter_unittests.cc", - "effects/dl_path_effect_unittests.cc", "geometry/dl_geometry_types_unittests.cc", "geometry/dl_region_unittests.cc", "geometry/dl_rtree_unittests.cc", diff --git a/display_list/benchmarking/dl_complexity_helper.h b/display_list/benchmarking/dl_complexity_helper.h index 13253affa2e0a..3b4e8dc06f6d9 100644 --- a/display_list/benchmarking/dl_complexity_helper.h +++ b/display_list/benchmarking/dl_complexity_helper.h @@ -110,7 +110,6 @@ class ComplexityCalculatorHelper void setColorSource(const DlColorSource* source) override {} void setImageFilter(const DlImageFilter* filter) override {} void setColorFilter(const DlColorFilter* filter) override {} - void setPathEffect(const DlPathEffect* effect) override {} void setMaskFilter(const DlMaskFilter* filter) override {} void save() override {} diff --git a/display_list/display_list.h b/display_list/display_list.h index 8658e35a63fb7..35c19ef9d4a0b 100644 --- a/display_list/display_list.h +++ b/display_list/display_list.h @@ -69,9 +69,6 @@ namespace flutter { V(SetColor) \ V(SetBlendMode) \ \ - V(SetPodPathEffect) \ - V(ClearPathEffect) \ - \ V(ClearColorFilter) \ V(SetPodColorFilter) \ \ diff --git a/display_list/display_list_unittests.cc b/display_list/display_list_unittests.cc index 88daac0062181..9794eab650e02 100644 --- a/display_list/display_list_unittests.cc +++ b/display_list/display_list_unittests.cc @@ -124,7 +124,6 @@ class DisplayListTestBase : public BaseT { EXPECT_EQ(builder_paint.getColorFilter(), defaults.getColorFilter()); EXPECT_EQ(builder_paint.getImageFilter(), defaults.getImageFilter()); EXPECT_EQ(builder_paint.getMaskFilter(), defaults.getMaskFilter()); - EXPECT_EQ(builder_paint.getPathEffect(), defaults.getPathEffect()); EXPECT_EQ(builder_paint, defaults); EXPECT_TRUE(builder_paint.isDefault()); @@ -445,10 +444,6 @@ TEST_F(DisplayListTest, BuildRestoresAttributes) { receiver.setMaskFilter(&kTestMaskFilter1); builder.Build(); check_defaults(builder, cull_rect); - - receiver.setPathEffect(kTestPathEffect1.get()); - builder.Build(); - check_defaults(builder, cull_rect); } TEST_F(DisplayListTest, BuilderBoundsTransformComparedToSkia) { diff --git a/display_list/dl_builder.cc b/display_list/dl_builder.cc index 2ff8c9b5a1f82..2ed0e6e65c782 100644 --- a/display_list/dl_builder.cc +++ b/display_list/dl_builder.cc @@ -338,22 +338,6 @@ void DisplayListBuilder::onSetColorFilter(const DlColorFilter* filter) { } UpdateCurrentOpacityCompatibility(); } -void DisplayListBuilder::onSetPathEffect(const DlPathEffect* effect) { - if (effect == nullptr) { - current_.setPathEffect(nullptr); - Push(0); - } else { - current_.setPathEffect(effect->shared()); - switch (effect->type()) { - case DlPathEffectType::kDash: { - const DlDashPathEffect* dash_effect = effect->asDash(); - void* pod = Push(dash_effect->size()); - new (pod) DlDashPathEffect(dash_effect); - break; - } - } - } -} void DisplayListBuilder::onSetMaskFilter(const DlMaskFilter* filter) { if (filter == nullptr) { current_.setMaskFilter(nullptr); @@ -405,9 +389,6 @@ void DisplayListBuilder::SetAttributesFromPaint( if (flags.applies_image_filter()) { setImageFilter(paint.getImageFilter().get()); } - if (flags.applies_path_effect()) { - setPathEffect(paint.getPathEffect().get()); - } if (flags.applies_mask_filter()) { setMaskFilter(paint.getMaskFilter().get()); } @@ -1726,14 +1707,7 @@ bool DisplayListBuilder::AdjustBoundsForPaint(SkRect& bounds, // Path effect occurs before stroking... DisplayListSpecialGeometryFlags special_flags = - flags.WithPathEffect(current_.getPathEffectPtr(), is_stroked); - if (current_.getPathEffect()) { - auto effect_bounds = current_.getPathEffect()->effect_bounds(bounds); - if (!effect_bounds.has_value()) { - return false; - } - bounds = effect_bounds.value(); - } + flags.GeometryFlags(is_stroked); if (is_stroked) { // Determine the max multiplier to the stroke width first. diff --git a/display_list/dl_builder.h b/display_list/dl_builder.h index a6bf3fabab1f6..438162c071949 100644 --- a/display_list/dl_builder.h +++ b/display_list/dl_builder.h @@ -12,7 +12,6 @@ #include "flutter/display_list/dl_op_receiver.h" #include "flutter/display_list/dl_paint.h" #include "flutter/display_list/dl_sampling_options.h" -#include "flutter/display_list/effects/dl_path_effect.h" #include "flutter/display_list/geometry/dl_geometry_types.h" #include "flutter/display_list/image/dl_image.h" #include "flutter/display_list/utils/dl_accumulation_rect.h" @@ -346,12 +345,6 @@ class DisplayListBuilder final : public virtual DlCanvas, } } // |DlOpReceiver| - void setPathEffect(const DlPathEffect* effect) override { - if (NotEquals(current_.getPathEffect(), effect)) { - onSetPathEffect(effect); - } - } - // |DlOpReceiver| void setMaskFilter(const DlMaskFilter* filter) override { if (NotEquals(current_.getMaskFilter(), filter)) { onSetMaskFilter(filter); @@ -771,7 +764,6 @@ class DisplayListBuilder final : public virtual DlCanvas, void onSetColorSource(const DlColorSource* source); void onSetImageFilter(const DlImageFilter* filter); void onSetColorFilter(const DlColorFilter* filter); - void onSetPathEffect(const DlPathEffect* effect); void onSetMaskFilter(const DlMaskFilter* filter); static DisplayListAttributeFlags FlagsForPointMode(PointMode mode); diff --git a/display_list/dl_op_flags.cc b/display_list/dl_op_flags.cc index 9293b2adcdc7f..6ce407db22b22 100644 --- a/display_list/dl_op_flags.cc +++ b/display_list/dl_op_flags.cc @@ -3,30 +3,9 @@ // found in the LICENSE file. #include "flutter/display_list/dl_op_flags.h" -#include "flutter/display_list/effects/dl_path_effect.h" namespace flutter { -const DisplayListSpecialGeometryFlags DisplayListAttributeFlags::WithPathEffect( - const DlPathEffect* effect, - bool is_stroked) const { - if (is_geometric() && effect) { - switch (effect->type()) { - case DlPathEffectType::kDash: { - // Dashing has no effect on filled geometry. - if (is_stroked) { - // A dash effect has a very simple impact. It cannot introduce any - // miter joins that weren't already present in the original path - // and it does not grow the bounds of the path, but it can add - // end caps to areas that might not have had them before so all - // we need to do is to indicate the potential for diagonal - // end caps and move on. - return special_flags_.with(kMayHaveCaps | kMayHaveDiagonalCaps); - } - } - } - } - return special_flags_; -} +// Just exists to ensure that the header can be cleanly imported. } // namespace flutter diff --git a/display_list/dl_op_flags.h b/display_list/dl_op_flags.h index ec9f7749e1692..f5d4cfb5c0064 100644 --- a/display_list/dl_op_flags.h +++ b/display_list/dl_op_flags.h @@ -10,7 +10,6 @@ namespace flutter { -class DlPathEffect; /// The base class for the classes that maintain a list of /// attributes that might be important for a number of operations /// including which rendering attributes need to be set before @@ -86,9 +85,8 @@ class DisplayListFlags { static constexpr int kUsesBlend = 1 << 13; static constexpr int kUsesShader = 1 << 14; static constexpr int kUsesColorFilter = 1 << 15; - static constexpr int kUsesPathEffect = 1 << 16; - static constexpr int kUsesMaskFilter = 1 << 17; - static constexpr int kUsesImageFilter = 1 << 18; + static constexpr int kUsesMaskFilter = 1 << 16; + static constexpr int kUsesImageFilter = 1 << 17; // Some ops have an optional paint argument. If the version // stored in the DisplayList ignores the paint, but there @@ -102,7 +100,7 @@ class DisplayListFlags { static constexpr int kAnyAttributeMask = // kUsesAntiAlias | kUsesAlpha | kUsesColor | kUsesBlend | kUsesShader | - kUsesColorFilter | kUsesPathEffect | kUsesMaskFilter | kUsesImageFilter; + kUsesColorFilter | kUsesMaskFilter | kUsesImageFilter; }; class DisplayListFlagsBase : protected DisplayListFlags { @@ -164,9 +162,9 @@ class DisplayListSpecialGeometryFlags : DisplayListFlagsBase { class DisplayListAttributeFlags : DisplayListFlagsBase { public: - const DisplayListSpecialGeometryFlags WithPathEffect( - const DlPathEffect* effect, - bool is_stroked) const; + const DisplayListSpecialGeometryFlags GeometryFlags(bool is_stroked) const { + return special_flags_; + } constexpr bool ignores_paint() const { return has_any(kIgnoresPaint); } @@ -198,9 +196,6 @@ class DisplayListAttributeFlags : DisplayListFlagsBase { } /// The primitive honors the DlBlendMode constexpr bool applies_blend() const { return has_any(kUsesBlend); } - constexpr bool applies_path_effect() const { - return has_any(kUsesPathEffect); - } /// The primitive honors the DlMaskFilter whether set using the /// filter object or using the convenience method |setMaskBlurFilter| constexpr bool applies_mask_filter() const { @@ -264,14 +259,12 @@ class DisplayListOpFlags : DisplayListFlags { // Flags common to all primitives that stroke or fill static constexpr int kBaseStrokeOrFillFlags = (kIsDrawnGeometry | // kUsesAntiAlias | // - kUsesMaskFilter | // - kUsesPathEffect); + kUsesMaskFilter); // Flags common to primitives that stroke geometry static constexpr int kBaseStrokeFlags = (kIsStrokedGeometry | // kUsesAntiAlias | // - kUsesMaskFilter | // - kUsesPathEffect); + kUsesMaskFilter); // Flags common to primitives that render an image with paint attributes static constexpr int kBaseImageFlags = (kIsNonGeometric | // diff --git a/display_list/dl_op_receiver.h b/display_list/dl_op_receiver.h index 8896febc94e1b..74c65e963c05b 100644 --- a/display_list/dl_op_receiver.h +++ b/display_list/dl_op_receiver.h @@ -15,7 +15,6 @@ #include "flutter/display_list/effects/dl_color_source.h" #include "flutter/display_list/effects/dl_image_filter.h" #include "flutter/display_list/effects/dl_mask_filter.h" -#include "flutter/display_list/effects/dl_path_effect.h" #include "flutter/display_list/image/dl_image.h" #include "flutter/impeller/geometry/path.h" @@ -157,7 +156,6 @@ class DlOpReceiver { // filter so that the color inversion happens after the ColorFilter. virtual void setInvertColors(bool invert) = 0; virtual void setBlendMode(DlBlendMode mode) = 0; - virtual void setPathEffect(const DlPathEffect* effect) = 0; virtual void setMaskFilter(const DlMaskFilter* filter) = 0; virtual void setImageFilter(const DlImageFilter* filter) = 0; diff --git a/display_list/dl_op_records.h b/display_list/dl_op_records.h index d3feba9b30e27..a8cf3063bbb42 100644 --- a/display_list/dl_op_records.h +++ b/display_list/dl_op_records.h @@ -231,7 +231,6 @@ DEFINE_SET_CLEAR_DLATTR_OP(ColorFilter, ColorFilter, filter) DEFINE_SET_CLEAR_DLATTR_OP(ImageFilter, ImageFilter, filter) DEFINE_SET_CLEAR_DLATTR_OP(MaskFilter, MaskFilter, filter) DEFINE_SET_CLEAR_DLATTR_OP(ColorSource, Shader, source) -DEFINE_SET_CLEAR_DLATTR_OP(PathEffect, PathEffect, effect) #undef DEFINE_SET_CLEAR_DLATTR_OP // 4 byte header + 80 bytes for the embedded DlImageColorSource diff --git a/display_list/dl_paint.cc b/display_list/dl_paint.cc index 81635a2a9f48d..498f2ec2e8fda 100644 --- a/display_list/dl_paint.cc +++ b/display_list/dl_paint.cc @@ -30,8 +30,7 @@ bool DlPaint::operator==(DlPaint const& other) const { Equals(color_source_, other.color_source_) && // Equals(color_filter_, other.color_filter_) && // Equals(image_filter_, other.image_filter_) && // - Equals(mask_filter_, other.mask_filter_) && // - Equals(path_effect_, other.path_effect_); + Equals(mask_filter_, other.mask_filter_); } const DlPaint DlPaint::kDefault; diff --git a/display_list/dl_paint.h b/display_list/dl_paint.h index d83bb55c37f6c..83e6dd8b0f362 100644 --- a/display_list/dl_paint.h +++ b/display_list/dl_paint.h @@ -13,7 +13,6 @@ #include "flutter/display_list/effects/dl_color_source.h" #include "flutter/display_list/effects/dl_image_filter.h" #include "flutter/display_list/effects/dl_mask_filter.h" -#include "flutter/display_list/effects/dl_path_effect.h" namespace flutter { @@ -177,19 +176,6 @@ class DlPaint { return *this; } - std::shared_ptr getPathEffect() const { - return path_effect_; - } - const DlPathEffect* getPathEffectPtr() const { return path_effect_.get(); } - DlPaint& setPathEffect(const std::shared_ptr& pathEffect) { - path_effect_ = pathEffect; - return *this; - } - DlPaint& setPathEffect(const DlPathEffect* effect) { - path_effect_ = effect ? effect->shared() : nullptr; - return *this; - } - bool isDefault() const { return *this == kDefault; } bool operator==(DlPaint const& other) const; @@ -228,7 +214,6 @@ class DlPaint { std::shared_ptr color_filter_; std::shared_ptr image_filter_; std::shared_ptr mask_filter_; - std::shared_ptr path_effect_; }; } // namespace flutter diff --git a/display_list/dl_paint_unittests.cc b/display_list/dl_paint_unittests.cc index e6a2b02e0308e..4974a209a7052 100644 --- a/display_list/dl_paint_unittests.cc +++ b/display_list/dl_paint_unittests.cc @@ -26,7 +26,6 @@ TEST(DisplayListPaint, ConstructorDefaults) { EXPECT_EQ(paint.getColorFilter(), nullptr); EXPECT_EQ(paint.getImageFilter(), nullptr); EXPECT_EQ(paint.getMaskFilter(), nullptr); - EXPECT_EQ(paint.getPathEffect(), nullptr); EXPECT_TRUE(paint.isDefault()); EXPECT_EQ(paint, DlPaint::kDefault); @@ -67,10 +66,6 @@ TEST(DisplayListPaint, ConstructorDefaults) { DlBlurMaskFilter mask_filter(DlBlurStyle::kInner, 3.14); EXPECT_NE(paint, DlPaint().setMaskFilter(mask_filter.shared())); - - SkScalar intervals[] = {1.0f, 2.0f}; - auto path_effect = DlDashPathEffect::Make(intervals, 2, 0.0f); - EXPECT_NE(paint, DlPaint().setPathEffect(path_effect.get())); } TEST(DisplayListPaint, NullPointerSetGet) { @@ -78,13 +73,11 @@ TEST(DisplayListPaint, NullPointerSetGet) { DlColorFilter* null_color_filter = nullptr; DlImageFilter* null_image_filter = nullptr; DlMaskFilter* null_mask_filter = nullptr; - DlPathEffect* null_path_effect = nullptr; DlPaint paint; EXPECT_EQ(paint.setColorSource(null_color_source).getColorSource(), nullptr); EXPECT_EQ(paint.setColorFilter(null_color_filter).getColorFilter(), nullptr); EXPECT_EQ(paint.setImageFilter(null_image_filter).getImageFilter(), nullptr); EXPECT_EQ(paint.setMaskFilter(null_mask_filter).getMaskFilter(), nullptr); - EXPECT_EQ(paint.setPathEffect(null_path_effect).getPathEffect(), nullptr); } TEST(DisplayListPaint, NullSharedPointerSetGet) { @@ -92,19 +85,14 @@ TEST(DisplayListPaint, NullSharedPointerSetGet) { std::shared_ptr null_color_filter; std::shared_ptr null_image_filter; std::shared_ptr null_mask_filter; - std::shared_ptr null_path_effect; DlPaint paint; EXPECT_EQ(paint.setColorSource(null_color_source).getColorSource(), nullptr); EXPECT_EQ(paint.setColorFilter(null_color_filter).getColorFilter(), nullptr); EXPECT_EQ(paint.setImageFilter(null_image_filter).getImageFilter(), nullptr); EXPECT_EQ(paint.setMaskFilter(null_mask_filter).getMaskFilter(), nullptr); - EXPECT_EQ(paint.setPathEffect(null_path_effect).getPathEffect(), nullptr); } TEST(DisplayListPaint, ChainingConstructor) { - SkScalar intervals[] = {1.0f, 2.0f}; - auto path_effect = DlDashPathEffect::Make(intervals, 2, 0.0f); - DlPaint paint = DlPaint() // .setAntiAlias(true) // @@ -123,8 +111,7 @@ TEST(DisplayListPaint, ChainingConstructor) { .shared()) .setImageFilter( DlBlurImageFilter(1.3, 4.7, DlTileMode::kClamp).shared()) - .setMaskFilter(DlBlurMaskFilter(DlBlurStyle::kInner, 3.14).shared()) - .setPathEffect(path_effect); + .setMaskFilter(DlBlurMaskFilter(DlBlurStyle::kInner, 3.14).shared()); EXPECT_TRUE(paint.isAntiAlias()); EXPECT_TRUE(paint.isInvertColors()); EXPECT_EQ(paint.getColor(), DlColor::kGreen().withAlpha(0x7F)); @@ -142,7 +129,6 @@ TEST(DisplayListPaint, ChainingConstructor) { DlBlurImageFilter(1.3, 4.7, DlTileMode::kClamp)); EXPECT_EQ(*paint.getMaskFilter(), DlBlurMaskFilter(DlBlurStyle::kInner, 3.14)); - EXPECT_EQ(*paint.getPathEffect(), *path_effect); EXPECT_NE(paint, DlPaint()); } diff --git a/display_list/effects/dl_path_effect.cc b/display_list/effects/dl_path_effect.cc deleted file mode 100644 index 658dd3b64dc7a..0000000000000 --- a/display_list/effects/dl_path_effect.cc +++ /dev/null @@ -1,35 +0,0 @@ -// 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 "flutter/display_list/effects/dl_path_effect.h" - -namespace flutter { - -static void DlPathEffectDeleter(void* p) { - // Some of our target environments would prefer a sized delete, - // but other target environments do not have that operator. - // Use an unsized delete until we get better agreement in the - // environments. - // See https://github.com/flutter/flutter/issues/100327 - ::operator delete(p); -} - -std::shared_ptr DlDashPathEffect::Make(const SkScalar* intervals, - int count, - SkScalar phase) { - size_t needed = sizeof(DlDashPathEffect) + sizeof(SkScalar) * count; - void* storage = ::operator new(needed); - - std::shared_ptr ret; - ret.reset(new (storage) DlDashPathEffect(intervals, count, phase), - DlPathEffectDeleter); - return std::move(ret); -} - -std::optional DlDashPathEffect::effect_bounds(SkRect& rect) const { - // The dashed path will always be a subset of the original. - return rect; -} - -} // namespace flutter diff --git a/display_list/effects/dl_path_effect.h b/display_list/effects/dl_path_effect.h deleted file mode 100644 index 9c874fc203b3f..0000000000000 --- a/display_list/effects/dl_path_effect.h +++ /dev/null @@ -1,125 +0,0 @@ -// 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. - -#ifndef FLUTTER_DISPLAY_LIST_EFFECTS_DL_PATH_EFFECT_H_ -#define FLUTTER_DISPLAY_LIST_EFFECTS_DL_PATH_EFFECT_H_ - -#include - -#include "flutter/display_list/dl_attributes.h" -#include "flutter/fml/logging.h" -#include "third_party/skia/include/core/SkRect.h" - -namespace flutter { - -class DlDashPathEffect; - -// The DisplayList PathEffect class. This class implements all of the -// facilities and adheres to the design goals of the |DlAttribute| base -// class. - -// An enumerated type for the supported PathEffect operations. -enum class DlPathEffectType { - kDash, -}; - -class DlPathEffect : public DlAttribute { - public: - virtual const DlDashPathEffect* asDash() const { return nullptr; } - - virtual std::optional effect_bounds(SkRect&) const = 0; - - protected: - DlPathEffect() = default; - - private: - FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlPathEffect); -}; - -/// The DashPathEffect which breaks a path up into dash segments, and it -/// only affects stroked paths. -/// intervals: array containing an even number of entries (>=2), with -/// the even indices specifying the length of "on" intervals, and the odd -/// indices specifying the length of "off" intervals. This array will be -/// copied in Make, and can be disposed of freely after. -/// count: number of elements in the intervals array. -/// phase: initial distance into the intervals at which to start the dashing -/// effect for the path. -/// -/// For example: if intervals[] = {10, 20}, count = 2, and phase = 25, -/// this will set up a dashed path like so: -/// 5 pixels off -/// 10 pixels on -/// 20 pixels off -/// 10 pixels on -/// 20 pixels off -/// ... -/// A phase of -5, 25, 55, 85, etc. would all result in the same path, -/// because the sum of all the intervals is 30. -/// -class DlDashPathEffect final : public DlPathEffect { - public: - static std::shared_ptr Make(const SkScalar intervals[], - int count, - SkScalar phase); - - DlPathEffectType type() const override { return DlPathEffectType::kDash; } - size_t size() const override { - return sizeof(*this) + sizeof(SkScalar) * count_; - } - - std::shared_ptr shared() const override { - return Make(intervals(), count_, phase_); - } - - const DlDashPathEffect* asDash() const override { return this; } - - const SkScalar* intervals() const { - return reinterpret_cast(this + 1); - } - int count() const { return count_; } - SkScalar phase() const { return phase_; } - - std::optional effect_bounds(SkRect& rect) const override; - - protected: - bool equals_(DlPathEffect const& other) const override { - FML_DCHECK(other.type() == DlPathEffectType::kDash); - auto that = static_cast(&other); - return count_ == that->count_ && phase_ == that->phase_ && - memcmp(intervals(), that->intervals(), sizeof(SkScalar) * count_) == - 0; - } - - private: - // DlDashPathEffect constructor assumes the caller has prealloced storage for - // the intervals. If the intervals is nullptr the intervals will - // uninitialized. - DlDashPathEffect(const SkScalar intervals[], int count, SkScalar phase) - : count_(count), phase_(phase) { - if (intervals != nullptr) { - SkScalar* intervals_ = reinterpret_cast(this + 1); - memcpy(intervals_, intervals, sizeof(SkScalar) * count); - } - } - - explicit DlDashPathEffect(const DlDashPathEffect* dash_effect) - : DlDashPathEffect(dash_effect->intervals(), - dash_effect->count_, - dash_effect->phase_) {} - - SkScalar* intervals_unsafe() { return reinterpret_cast(this + 1); } - - int count_; - SkScalar phase_; - - friend class DisplayListBuilder; - friend class DlPathEffect; - - FML_DISALLOW_COPY_ASSIGN_AND_MOVE(DlDashPathEffect); -}; - -} // namespace flutter - -#endif // FLUTTER_DISPLAY_LIST_EFFECTS_DL_PATH_EFFECT_H_ diff --git a/display_list/effects/dl_path_effect_unittests.cc b/display_list/effects/dl_path_effect_unittests.cc deleted file mode 100644 index 37675fd94a43e..0000000000000 --- a/display_list/effects/dl_path_effect_unittests.cc +++ /dev/null @@ -1,52 +0,0 @@ -// 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 "flutter/display_list/effects/dl_path_effect.h" -#include "flutter/display_list/testing/dl_test_equality.h" -#include "flutter/display_list/utils/dl_comparable.h" -#include "gtest/gtest.h" -#include "third_party/skia/include/core/SkScalar.h" - -namespace flutter { -namespace testing { - -TEST(DisplayListPathEffect, EffectShared) { - const SkScalar TestDashes2[] = {1.0, 1.5}; - auto effect = DlDashPathEffect::Make(TestDashes2, 2, 0.0); - ASSERT_TRUE(Equals(effect->shared(), effect)); -} - -TEST(DisplayListPathEffect, DashEffectAsDash) { - const SkScalar TestDashes2[] = {1.0, 1.5}; - auto effect = DlDashPathEffect::Make(TestDashes2, 2, 0.0); - ASSERT_NE(effect->asDash(), nullptr); - ASSERT_EQ(effect->asDash(), effect.get()); -} - -TEST(DisplayListPathEffect, DashEffectEquals) { - const SkScalar TestDashes2[] = {1.0, 1.5}; - auto effect1 = DlDashPathEffect::Make(TestDashes2, 2, 0.0); - auto effect2 = DlDashPathEffect::Make(TestDashes2, 2, 0.0); - TestEquals(*effect1, *effect1); -} - -TEST(DisplayListPathEffect, CheckEffectProperties) { - const SkScalar test_dashes[] = {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(test_dashes, 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(test_dashes, 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"); -} - -} // namespace testing -} // namespace flutter diff --git a/display_list/skia/dl_sk_canvas.cc b/display_list/skia/dl_sk_canvas.cc index 244b8af704048..a836360a0f088 100644 --- a/display_list/skia/dl_sk_canvas.cc +++ b/display_list/skia/dl_sk_canvas.cc @@ -11,6 +11,7 @@ #include "flutter/fml/trace_event.h" #include "third_party/skia/include/core/SkColorFilter.h" +#include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/gpu/GrDirectContext.h" #include "third_party/skia/include/gpu/GrRecordingContext.h" diff --git a/display_list/skia/dl_sk_conversions.cc b/display_list/skia/dl_sk_conversions.cc index ca30d2ad6f91e..f61c3e06b2b56 100644 --- a/display_list/skia/dl_sk_conversions.cc +++ b/display_list/skia/dl_sk_conversions.cc @@ -49,7 +49,6 @@ SkPaint ToSk(const DlPaint& paint) { } sk_paint.setMaskFilter(ToSk(paint.getMaskFilterPtr())); - sk_paint.setPathEffect(ToSk(paint.getPathEffectPtr())); return sk_paint; } @@ -275,20 +274,6 @@ sk_sp ToSk(const DlMaskFilter* filter) { } } -sk_sp ToSk(const DlPathEffect* effect) { - if (!effect) { - return nullptr; - } - switch (effect->type()) { - case DlPathEffectType::kDash: { - const DlDashPathEffect* dash_effect = effect->asDash(); - FML_DCHECK(dash_effect != nullptr); - return SkDashPathEffect::Make(dash_effect->intervals(), - dash_effect->count(), dash_effect->phase()); - } - } -} - sk_sp ToSk(const DlVertices* vertices) { const SkColor* sk_colors = reinterpret_cast(vertices->colors()); diff --git a/display_list/skia/dl_sk_conversions.h b/display_list/skia/dl_sk_conversions.h index b8970af7aa1fc..3d99401aae0a1 100644 --- a/display_list/skia/dl_sk_conversions.h +++ b/display_list/skia/dl_sk_conversions.h @@ -114,15 +114,6 @@ inline sk_sp ToSk(const DlMaskFilter& filter) { return ToSk(&filter); } -extern sk_sp ToSk(const DlPathEffect* effect); -inline sk_sp ToSk( - const std::shared_ptr& effect) { - return ToSk(effect.get()); -} -inline sk_sp ToSk(const DlPathEffect& effect) { - return ToSk(&effect); -} - extern sk_sp ToSk(const DlVertices* vertices); inline sk_sp ToSk( const std::shared_ptr& vertices) { diff --git a/display_list/skia/dl_sk_dispatcher.cc b/display_list/skia/dl_sk_dispatcher.cc index fdef98980970f..733dbd40f3cfd 100644 --- a/display_list/skia/dl_sk_dispatcher.cc +++ b/display_list/skia/dl_sk_dispatcher.cc @@ -9,6 +9,7 @@ #include "flutter/display_list/skia/dl_sk_types.h" #include "flutter/fml/trace_event.h" +#include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/utils/SkShadowUtils.h" namespace flutter { diff --git a/display_list/skia/dl_sk_paint_dispatcher.cc b/display_list/skia/dl_sk_paint_dispatcher.cc index 0e05739daff01..378f3bf585535 100644 --- a/display_list/skia/dl_sk_paint_dispatcher.cc +++ b/display_list/skia/dl_sk_paint_dispatcher.cc @@ -88,9 +88,6 @@ void DlSkPaintDispatchHelper::setColorFilter(const DlColorFilter* filter) { sk_color_filter_ = ToSk(filter); paint_.setColorFilter(makeColorFilter()); } -void DlSkPaintDispatchHelper::setPathEffect(const DlPathEffect* effect) { - paint_.setPathEffect(ToSk(effect)); -} void DlSkPaintDispatchHelper::setMaskFilter(const DlMaskFilter* filter) { paint_.setMaskFilter(ToSk(filter)); } diff --git a/display_list/skia/dl_sk_paint_dispatcher.h b/display_list/skia/dl_sk_paint_dispatcher.h index a027e7ee4777b..d4bb03be9dc18 100644 --- a/display_list/skia/dl_sk_paint_dispatcher.h +++ b/display_list/skia/dl_sk_paint_dispatcher.h @@ -33,7 +33,6 @@ class DlSkPaintDispatchHelper : public virtual DlOpReceiver { void setColorFilter(const DlColorFilter* filter) override; void setInvertColors(bool invert) override; void setBlendMode(DlBlendMode mode) override; - void setPathEffect(const DlPathEffect* effect) override; void setMaskFilter(const DlMaskFilter* filter) override; void setImageFilter(const DlImageFilter* filter) override; diff --git a/display_list/skia/dl_sk_types.h b/display_list/skia/dl_sk_types.h index 3348c4ba0aa42..2384df59860ca 100644 --- a/display_list/skia/dl_sk_types.h +++ b/display_list/skia/dl_sk_types.h @@ -29,8 +29,5 @@ #include "third_party/skia/include/core/SkTextBlob.h" #include "third_party/skia/include/core/SkTileMode.h" #include "third_party/skia/include/core/SkVertices.h" -#include "third_party/skia/include/effects/SkCornerPathEffect.h" -#include "third_party/skia/include/effects/SkDashPathEffect.h" -#include "third_party/skia/include/effects/SkDiscretePathEffect.h" #include "third_party/skia/include/gpu/GrTypes.h" #endif // FLUTTER_DISPLAY_LIST_SKIA_DL_SK_TYPES_H_ diff --git a/display_list/testing/dl_rendering_unittests.cc b/display_list/testing/dl_rendering_unittests.cc index e55288b2172cd..89102029e175b 100644 --- a/display_list/testing/dl_rendering_unittests.cc +++ b/display_list/testing/dl_rendering_unittests.cc @@ -30,6 +30,7 @@ #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkSurface.h" #include "third_party/skia/include/core/SkTypeface.h" +#include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "third_party/skia/include/effects/SkImageFilters.h" #include "third_party/skia/include/encode/SkPngEncoder.h" @@ -911,30 +912,14 @@ class TestParameters { if (flags_.is_stroked(ref_attr.getDrawStyle()) != is_stroked) { return false; } - DisplayListSpecialGeometryFlags geo_flags = - flags_.WithPathEffect(attr.getPathEffect().get(), is_stroked); - if (flags_.applies_path_effect() && // - ref_attr.getPathEffect() != attr.getPathEffect()) { - if (renderer.targets_impeller()) { - // Impeller ignores DlPathEffect objects: - // https://github.com/flutter/flutter/issues/109736 - } else { - switch (attr.getPathEffect()->type()) { - case DlPathEffectType::kDash: { - if (is_stroked && !ignores_dashes()) { - return false; - } - break; - } - } - } - } if (!is_stroked) { return true; } if (ref_attr.getStrokeWidth() != attr.getStrokeWidth()) { return false; } + DisplayListSpecialGeometryFlags geo_flags = + flags_.GeometryFlags(is_stroked); if (geo_flags.may_have_end_caps() && // getCap(ref_attr, geo_flags) != getCap(attr, geo_flags)) { return false; @@ -1009,10 +994,8 @@ class TestParameters { adjust = half_width * paint.getStrokeMiter() + tolerance.discrete_offset(); } - auto path_effect = paint.getPathEffect(); - DisplayListSpecialGeometryFlags geo_flags = - flags_.WithPathEffect(path_effect.get(), true); + DisplayListSpecialGeometryFlags geo_flags = flags_.GeometryFlags(true); if (paint.getStrokeCap() == DlStrokeCap::kButt && !geo_flags.butt_cap_becomes_square()) { adjust = std::max(adjust, half_width); diff --git a/display_list/testing/dl_test_snippets.cc b/display_list/testing/dl_test_snippets.cc index a5c06eb357764..7c360d7df2caf 100644 --- a/display_list/testing/dl_test_snippets.cc +++ b/display_list/testing/dl_test_snippets.cc @@ -221,15 +221,6 @@ std::vector CreateAllAttributesOps() { }}, {0, 0, 0, [](DlOpReceiver& r) { r.setColorFilter(nullptr); }}, }}, - {"SetPathEffect", - { - // sizeof(DlDashPathEffect) + 2 * sizeof(SkScalar) - {0, 32, 0, - [](DlOpReceiver& r) { r.setPathEffect(kTestPathEffect1.get()); }}, - {0, 32, 0, - [](DlOpReceiver& r) { r.setPathEffect(kTestPathEffect2.get()); }}, - {0, 0, 0, [](DlOpReceiver& r) { r.setPathEffect(nullptr); }}, - }}, {"SetMaskFilter", { {0, 32, 0, diff --git a/display_list/testing/dl_test_snippets.h b/display_list/testing/dl_test_snippets.h index e8a8631a2f0e8..0c8c97e06b195 100644 --- a/display_list/testing/dl_test_snippets.h +++ b/display_list/testing/dl_test_snippets.h @@ -11,7 +11,6 @@ #include "third_party/skia/include/core/SkCanvas.h" #include "third_party/skia/include/core/SkSurface.h" -#include "third_party/skia/include/effects/SkDashPathEffect.h" #include "third_party/skia/include/effects/SkGradientShader.h" #include "third_party/skia/include/effects/SkImageFilters.h" @@ -54,9 +53,6 @@ constexpr float kInvertColorMatrix[20] = { }; // clang-format on -const SkScalar kTestDashes1[] = {4.0, 2.0}; -const SkScalar kTestDashes2[] = {1.0, 1.5}; - constexpr SkPoint kTestPoints[] = { {10, 10}, {20, 20}, @@ -175,10 +171,6 @@ static const DlColorFilterImageFilter kTestCFImageFilter1( kTestBlendColorFilter1); static const DlColorFilterImageFilter kTestCFImageFilter2( kTestBlendColorFilter2); -static const std::shared_ptr kTestPathEffect1 = - DlDashPathEffect::Make(kTestDashes1, 2, 0.0f); -static const std::shared_ptr kTestPathEffect2 = - DlDashPathEffect::Make(kTestDashes2, 2, 0.0f); static const DlBlurMaskFilter kTestMaskFilter1(DlBlurStyle::kNormal, 3.0); static const DlBlurMaskFilter kTestMaskFilter2(DlBlurStyle::kNormal, 5.0); static const DlBlurMaskFilter kTestMaskFilter3(DlBlurStyle::kSolid, 3.0); diff --git a/display_list/utils/dl_receiver_utils.h b/display_list/utils/dl_receiver_utils.h index ada764ce61b3c..a47178a36c125 100644 --- a/display_list/utils/dl_receiver_utils.h +++ b/display_list/utils/dl_receiver_utils.h @@ -35,7 +35,6 @@ class IgnoreAttributeDispatchHelper : public virtual DlOpReceiver { void setColorSource(const DlColorSource* source) override {} void setImageFilter(const DlImageFilter* filter) override {} void setColorFilter(const DlColorFilter* filter) override {} - void setPathEffect(const DlPathEffect* effect) override {} void setMaskFilter(const DlMaskFilter* filter) override {} }; diff --git a/impeller/display_list/dl_dispatcher.cc b/impeller/display_list/dl_dispatcher.cc index e377f7b5e4e38..872c74f4cf7ab 100644 --- a/impeller/display_list/dl_dispatcher.cc +++ b/impeller/display_list/dl_dispatcher.cc @@ -478,12 +478,6 @@ void DlDispatcherBase::setBlendMode(flutter::DlBlendMode dl_mode) { paint_.blend_mode = ToBlendMode(dl_mode); } -// |flutter::DlOpReceiver| -void DlDispatcherBase::setPathEffect(const flutter::DlPathEffect* effect) { - // Needs https://github.com/flutter/flutter/issues/95434 - UNIMPLEMENTED; -} - static FilterContents::BlurStyle ToBlurStyle(flutter::DlBlurStyle blur_style) { switch (blur_style) { case flutter::DlBlurStyle::kNormal: diff --git a/impeller/display_list/dl_dispatcher.h b/impeller/display_list/dl_dispatcher.h index 91ea7f94fbaaa..bb2c8624e6e3e 100644 --- a/impeller/display_list/dl_dispatcher.h +++ b/impeller/display_list/dl_dispatcher.h @@ -60,9 +60,6 @@ class DlDispatcherBase : public flutter::DlOpReceiver { // |flutter::DlOpReceiver| void setBlendMode(flutter::DlBlendMode mode) override; - // |flutter::DlOpReceiver| - void setPathEffect(const flutter::DlPathEffect* effect) override; - // |flutter::DlOpReceiver| void setMaskFilter(const flutter::DlMaskFilter* filter) override; diff --git a/lib/ui/painting/paint.cc b/lib/ui/painting/paint.cc index 6b3dbfec7c4ef..b13f3bb6b1af7 100644 --- a/lib/ui/painting/paint.cc +++ b/lib/ui/painting/paint.cc @@ -170,12 +170,6 @@ const DlPaint* Paint::paint(DlPaint& paint, paint.setInvertColors(uint_data[kInvertColorIndex] != 0); } - if (flags.applies_path_effect()) { - // The paint API exposed to Dart does not support path effects. But other - // operations such as text may set a path effect, which must be cleared. - paint.setPathEffect(nullptr); - } - if (flags.applies_mask_filter()) { switch (uint_data[kMaskFilterIndex]) { case kNull: diff --git a/testing/display_list_testing.cc b/testing/display_list_testing.cc index 93db4107d773f..fa1c575dabe95 100644 --- a/testing/display_list_testing.cc +++ b/testing/display_list_testing.cc @@ -544,9 +544,6 @@ void DisplayListStreamDispatcher::setInvertColors(bool invert) { void DisplayListStreamDispatcher::setBlendMode(DlBlendMode mode) { startl() << "setBlendMode(" << mode << ");" << std::endl; } -void DisplayListStreamDispatcher::setPathEffect(const DlPathEffect* effect) { - startl() << "setPathEffect(" << effect << ");" << std::endl; -} void DisplayListStreamDispatcher::setMaskFilter(const DlMaskFilter* filter) { if (filter == nullptr) { startl() << "setMaskFilter(no MaskFilter);" << std::endl; diff --git a/testing/display_list_testing.h b/testing/display_list_testing.h index 895056f97b445..1f65e1645e806 100644 --- a/testing/display_list_testing.h +++ b/testing/display_list_testing.h @@ -93,7 +93,6 @@ class DisplayListStreamDispatcher final : public DlOpReceiver { void setColorFilter(const DlColorFilter* filter) override; void setInvertColors(bool invert) override; void setBlendMode(DlBlendMode mode) override; - void setPathEffect(const DlPathEffect* effect) override; void setMaskFilter(const DlMaskFilter* filter) override; void setImageFilter(const DlImageFilter* filter) override; diff --git a/third_party/txt/tests/paragraph_unittests.cc b/third_party/txt/tests/paragraph_unittests.cc index 3a3f990af3098..f34b83b5331be 100644 --- a/third_party/txt/tests/paragraph_unittests.cc +++ b/third_party/txt/tests/paragraph_unittests.cc @@ -48,7 +48,6 @@ class DlOpRecorder final : public virtual DlOpReceiver, int pathCount() const { return paths_.size(); } int textFrameCount() const { return text_frames_.size(); } int blobCount() const { return blobs_.size(); } - bool hasPathEffect() const { return path_effect_ != nullptr; } private: void drawLine(const SkPoint& p0, const SkPoint& p1) override { @@ -78,17 +77,12 @@ class DlOpRecorder final : public virtual DlOpReceiver, void drawPath(const SkPath& path) override { paths_.push_back(path); } - void setPathEffect(const DlPathEffect* effect) override { - path_effect_ = effect; - } - std::vector> text_frames_; std::vector> blobs_; std::vector> lines_; std::vector> dashed_lines_; std::vector rects_; std::vector paths_; - const DlPathEffect* path_effect_; }; template @@ -199,7 +193,6 @@ TEST_F(PainterTest, DrawsSolidLineSkia) { // Skia may draw a solid underline as a filled rectangle: // https://skia.googlesource.com/skia/+/refs/heads/main/modules/skparagraph/src/Decorations.cpp#91 EXPECT_EQ(recorder.rectCount(), 1); - EXPECT_FALSE(recorder.hasPathEffect()); } TEST_F(PainterTest, DrawDashedLineSkia) { @@ -212,7 +205,6 @@ TEST_F(PainterTest, DrawDashedLineSkia) { // Skia draws a dashed underline as a filled rectangle with a path effect. EXPECT_EQ(recorder.lineCount(), 0); EXPECT_EQ(recorder.dashedLineCount(), 1); - EXPECT_FALSE(recorder.hasPathEffect()); } #ifdef IMPELLER_SUPPORTS_RENDERING @@ -226,7 +218,6 @@ TEST_F(PainterTest, DrawsSolidLineImpeller) { // Skia may draw a solid underline as a filled rectangle: // https://skia.googlesource.com/skia/+/refs/heads/main/modules/skparagraph/src/Decorations.cpp#91 EXPECT_EQ(recorder.rectCount(), 1); - EXPECT_FALSE(recorder.hasPathEffect()); } TEST_F(PainterTest, DrawDashedLineImpeller) { @@ -239,7 +230,6 @@ TEST_F(PainterTest, DrawDashedLineImpeller) { // Impeller draws a dashed underline as a path. EXPECT_EQ(recorder.pathCount(), 0); EXPECT_EQ(recorder.dashedLineCount(), 1); - EXPECT_FALSE(recorder.hasPathEffect()); } TEST_F(PainterTest, DrawTextFrameImpeller) {