diff --git a/display_list/display_list_color_source.cc b/display_list/display_list_color_source.cc index 1a59463bb0561..6c5a5ce746b81 100644 --- a/display_list/display_list_color_source.cc +++ b/display_list/display_list_color_source.cc @@ -84,6 +84,15 @@ std::shared_ptr DlColorSource::From(SkShader* sk_shader) { return source; } +static void DlGradientDeleter(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 DlColorSource::MakeLinear( const SkPoint start_point, const SkPoint end_point, @@ -98,8 +107,10 @@ std::shared_ptr DlColorSource::MakeLinear( void* storage = ::operator new(needed); std::shared_ptr ret; - ret.reset(new (storage) DlLinearGradientColorSource( - start_point, end_point, stop_count, colors, stops, tile_mode, matrix)); + ret.reset(new (storage) + DlLinearGradientColorSource(start_point, end_point, stop_count, + colors, stops, tile_mode, matrix), + DlGradientDeleter); return std::move(ret); } @@ -118,7 +129,8 @@ std::shared_ptr DlColorSource::MakeRadial( std::shared_ptr ret; ret.reset(new (storage) DlRadialGradientColorSource( - center, radius, stop_count, colors, stops, tile_mode, matrix)); + center, radius, stop_count, colors, stops, tile_mode, matrix), + DlGradientDeleter); return std::move(ret); } @@ -139,8 +151,9 @@ std::shared_ptr DlColorSource::MakeConical( std::shared_ptr ret; ret.reset(new (storage) DlConicalGradientColorSource( - start_center, start_radius, end_center, end_radius, stop_count, colors, - stops, tile_mode, matrix)); + start_center, start_radius, end_center, end_radius, stop_count, + colors, stops, tile_mode, matrix), + DlGradientDeleter); return std::move(ret); } @@ -159,8 +172,10 @@ std::shared_ptr DlColorSource::MakeSweep( void* storage = ::operator new(needed); std::shared_ptr ret; - ret.reset(new (storage) DlSweepGradientColorSource( - center, start, end, stop_count, colors, stops, tile_mode, matrix)); + ret.reset(new (storage) + DlSweepGradientColorSource(center, start, end, stop_count, + colors, stops, tile_mode, matrix), + DlGradientDeleter); return std::move(ret); }