Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions display_list/display_list_color_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ std::shared_ptr<DlColorSource> 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> DlColorSource::MakeLinear(
const SkPoint start_point,
const SkPoint end_point,
Expand All @@ -98,8 +107,10 @@ std::shared_ptr<DlColorSource> DlColorSource::MakeLinear(
void* storage = ::operator new(needed);

std::shared_ptr<DlLinearGradientColorSource> 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);
}

Expand All @@ -118,7 +129,8 @@ std::shared_ptr<DlColorSource> DlColorSource::MakeRadial(

std::shared_ptr<DlRadialGradientColorSource> 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);
}

Expand All @@ -139,8 +151,9 @@ std::shared_ptr<DlColorSource> DlColorSource::MakeConical(

std::shared_ptr<DlConicalGradientColorSource> 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);
}

Expand All @@ -159,8 +172,10 @@ std::shared_ptr<DlColorSource> DlColorSource::MakeSweep(
void* storage = ::operator new(needed);

std::shared_ptr<DlSweepGradientColorSource> 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);
}

Expand Down