mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Support radial gradient with asymmetrical size in Skia painter
Progress on Tests/Ref/css-gradients.html
This commit is contained in:
parent
af9b91e0f7
commit
be1075e673
Notes:
sideshowbarker
2024-07-17 05:13:53 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/be1075e673 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/641
1 changed files with 8 additions and 2 deletions
|
@ -1143,8 +1143,14 @@ CommandResult DisplayListPlayerSkia::paint_radial_gradient(PaintRadialGradient c
|
||||||
|
|
||||||
auto const& rect = command.rect;
|
auto const& rect = command.rect;
|
||||||
auto center = to_skia_point(command.center.translated(command.rect.location()));
|
auto center = to_skia_point(command.center.translated(command.rect.location()));
|
||||||
auto radius = command.size.height();
|
|
||||||
auto shader = SkGradientShader::MakeRadial(center, radius, colors.data(), positions.data(), positions.size(), SkTileMode::kClamp, 0);
|
auto const size = command.size.to_type<float>();
|
||||||
|
SkMatrix matrix;
|
||||||
|
// Skia does not support specifying of horizontal and vertical radius's separately,
|
||||||
|
// so instead we apply scale matrix
|
||||||
|
matrix.setScale(size.width() / size.height(), 1.0f, center.x(), center.y());
|
||||||
|
|
||||||
|
auto shader = SkGradientShader::MakeRadial(center, size.height(), colors.data(), positions.data(), positions.size(), SkTileMode::kClamp, 0, &matrix);
|
||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
paint.setShader(shader);
|
paint.setShader(shader);
|
||||||
|
|
Loading…
Reference in a new issue