LibGfx+LibWeb: Specify bottom left origin for WebGL's PaintingSurface

By doing that we eliminate the need for the vertical flip flag.

As a side effect it fixes the bug when doing:
`canvasContext2d.drawImage(canvasWithWebGLContext, 0, 0);`
produced a flipped image because we didn't account for different origin
while serializing PaintingSurface into Gfx::Bitmap.

Visual progress on https://ciechanow.ski/curves-and-surfaces/
This commit is contained in:
Aliaksandr Kalenik 2024-12-20 16:46:12 +01:00 committed by Alexander Kalenik
commit 30d915c361
Notes: github-actions[bot] 2024-12-20 19:48:39 +00:00
4 changed files with 20 additions and 19 deletions

View file

@ -152,17 +152,7 @@ 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)