mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-03 14:50:02 +00:00
LibWeb: Flip vertically PaintingSurface attached to WebGL context
OpenGL's origin is at the bottom-left corner, while Skia's origin is at the top-left corner. This change adds a transformation to compensate for this difference when rendering PaintingSurface attached to WebGL context.
This commit is contained in:
parent
38488b9ef3
commit
45e0f50463
Notes:
github-actions[bot]
2024-12-03 22:37:23 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 45e0f50463
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2688
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 15 additions and 0 deletions
|
@ -329,7 +329,17 @@ void DisplayListPlayerSkia::draw_painting_surface(DrawPaintingSurface const& com
|
|||
auto& canvas = surface().canvas();
|
||||
auto image = sk_surface.makeImageSnapshot();
|
||||
SkPaint paint;
|
||||
if (command.surface->flip_vertically()) {
|
||||
canvas.save();
|
||||
SkMatrix matrix;
|
||||
matrix.setIdentity();
|
||||
matrix.preScale(1, -1, dst_rect.centerX(), dst_rect.centerY());
|
||||
canvas.concat(matrix);
|
||||
}
|
||||
canvas.drawImageRect(image, src_rect, dst_rect, to_skia_sampling_options(command.scaling_mode), &paint, SkCanvas::kStrict_SrcRectConstraint);
|
||||
if (command.surface->flip_vertically()) {
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayListPlayerSkia::draw_scaled_immutable_bitmap(DrawScaledImmutableBitmap const& command)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue