mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Use anti-aliasing to draw images and painting surfaces
Fixes the jagged edges on the transformed badge on https://aaronfrancis.com/backstage.
This commit is contained in:
parent
489dea58ba
commit
2811c75031
Notes:
github-actions[bot]
2025-11-12 16:44:03 +00:00
Author: https://github.com/gmta
Commit: 2811c75031
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6799
Reviewed-by: https://github.com/kalenikaliaksandr ✅
4 changed files with 27 additions and 0 deletions
|
|
@ -155,6 +155,7 @@ void DisplayListPlayerSkia::draw_painting_surface(DrawPaintingSurface const& com
|
|||
auto& canvas = surface().canvas();
|
||||
auto image = sk_surface.makeImageSnapshot();
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
canvas.drawImageRect(image, src_rect, dst_rect, to_skia_sampling_options(command.scaling_mode), &paint, SkCanvas::kStrict_SrcRectConstraint);
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +165,7 @@ void DisplayListPlayerSkia::draw_scaled_immutable_bitmap(DrawScaledImmutableBitm
|
|||
auto clip_rect = to_skia_rect(command.clip_rect);
|
||||
auto& canvas = surface().canvas();
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
canvas.save();
|
||||
canvas.clipRect(clip_rect, true);
|
||||
canvas.drawImageRect(command.bitmap->sk_image(), dst_rect, to_skia_sampling_options(command.scaling_mode), &paint);
|
||||
|
|
@ -184,6 +186,7 @@ void DisplayListPlayerSkia::draw_repeated_immutable_bitmap(DrawRepeatedImmutable
|
|||
auto shader = command.bitmap->sk_image()->makeShader(tile_mode_x, tile_mode_y, sampling_options, matrix);
|
||||
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setShader(shader);
|
||||
auto& canvas = surface().canvas();
|
||||
canvas.drawPaint(paint);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue