mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 01:56:38 +00:00
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:
parent
28388f1fd2
commit
30d915c361
Notes:
github-actions[bot]
2024-12-20 19:48:39 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 30d915c361
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2994
4 changed files with 20 additions and 19 deletions
|
@ -24,11 +24,16 @@ namespace Gfx {
|
|||
|
||||
class PaintingSurface : public RefCounted<PaintingSurface> {
|
||||
public:
|
||||
enum class Origin {
|
||||
TopLeft,
|
||||
BottomLeft,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<PaintingSurface> create_with_size(RefPtr<SkiaBackendContext> context, Gfx::IntSize size, Gfx::BitmapFormat color_type, Gfx::AlphaType alpha_type);
|
||||
static NonnullRefPtr<PaintingSurface> wrap_bitmap(Bitmap&);
|
||||
|
||||
#ifdef AK_OS_MACOS
|
||||
static NonnullRefPtr<PaintingSurface> wrap_iosurface(Core::IOSurfaceHandle const&, RefPtr<SkiaBackendContext>);
|
||||
static NonnullRefPtr<PaintingSurface> wrap_iosurface(Core::IOSurfaceHandle const&, RefPtr<SkiaBackendContext>, Origin = Origin::TopLeft);
|
||||
#endif
|
||||
|
||||
void read_into_bitmap(Bitmap&);
|
||||
|
@ -47,9 +52,6 @@ public:
|
|||
|
||||
void flush() const;
|
||||
|
||||
bool flip_vertically() const { return m_flip_vertically; }
|
||||
void set_flip_vertically() { m_flip_vertically = true; }
|
||||
|
||||
~PaintingSurface();
|
||||
|
||||
private:
|
||||
|
@ -58,7 +60,6 @@ private:
|
|||
PaintingSurface(NonnullOwnPtr<Impl>&&);
|
||||
|
||||
NonnullOwnPtr<Impl> m_impl;
|
||||
bool m_flip_vertically { false };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue