mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Make all clip rects anti-aliased
This fixes aliased edges when e.g. applying rotation transforms to certain shapes or SVGs. Although the clip rects themselves are rectangular, a non-identity matrix transform can be active for the canvas. Fixes #5909.
This commit is contained in:
parent
b9244903fc
commit
489dea58ba
Notes:
github-actions[bot]
2025-11-12 16:44:10 +00:00
Author: https://github.com/gmta
Commit: 489dea58ba
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6799
Reviewed-by: https://github.com/kalenikaliaksandr ✅
4 changed files with 24 additions and 3 deletions
|
|
@ -165,7 +165,7 @@ void DisplayListPlayerSkia::draw_scaled_immutable_bitmap(DrawScaledImmutableBitm
|
|||
auto& canvas = surface().canvas();
|
||||
SkPaint paint;
|
||||
canvas.save();
|
||||
canvas.clipRect(clip_rect);
|
||||
canvas.clipRect(clip_rect, true);
|
||||
canvas.drawImageRect(command.bitmap->sk_image(), dst_rect, to_skia_sampling_options(command.scaling_mode), &paint);
|
||||
canvas.restore();
|
||||
}
|
||||
|
|
@ -193,7 +193,7 @@ void DisplayListPlayerSkia::add_clip_rect(AddClipRect const& command)
|
|||
{
|
||||
auto& canvas = surface().canvas();
|
||||
auto const& rect = command.rect;
|
||||
canvas.clipRect(to_skia_rect(rect));
|
||||
canvas.clipRect(to_skia_rect(rect), true);
|
||||
}
|
||||
|
||||
void DisplayListPlayerSkia::save(Save const&)
|
||||
|
|
@ -780,7 +780,7 @@ void DisplayListPlayerSkia::apply_backdrop_filter(ApplyBackdropFilter const& com
|
|||
|
||||
auto rect = to_skia_rect(command.backdrop_region);
|
||||
canvas.save();
|
||||
canvas.clipRect(rect);
|
||||
canvas.clipRect(rect, true);
|
||||
ScopeGuard guard = [&] { canvas.restore(); };
|
||||
|
||||
if (command.backdrop_filter.has_value()) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
}
|
||||
body {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<img src="../images/svg-rotation-anti-aliasing-ref.png">
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="match" href="../expected/svg-rotation-anti-aliasing-ref.html" />
|
||||
<meta name="fuzzy" content="maxDifference=0-0;totalPixels=0-0">
|
||||
<style>
|
||||
svg {
|
||||
rotate: 22.5deg;
|
||||
}
|
||||
</style>
|
||||
<svg viewbox="0,0,100,100" width="100" height="100">
|
||||
<rect x="0" y="0" width="100" height="100" fill="blue"></rect>
|
||||
</svg>
|
||||
Loading…
Add table
Add a link
Reference in a new issue