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

@ -126,8 +126,7 @@ void OpenGLContext::allocate_painting_surface_if_needed()
VERIFY(!m_size.is_empty());
auto iosurface = Core::IOSurfaceHandle::create(m_size.width(), m_size.height());
m_painting_surface = Gfx::PaintingSurface::wrap_iosurface(iosurface, m_skia_backend_context);
m_painting_surface->set_flip_vertically();
m_painting_surface = Gfx::PaintingSurface::wrap_iosurface(iosurface, m_skia_backend_context, Gfx::PaintingSurface::Origin::BottomLeft);
auto width = m_size.width();
auto height = m_size.height();