Skip to content

Commit

Permalink
LibWeb: Ensure SkiaSurface is fully defined before it is allocated
Browse files Browse the repository at this point in the history
LLVM 18 on macOS correctly errs when we try to allocate an incomplete
SkiaSurface object.
  • Loading branch information
trflynn89 committed Jun 28, 2024
1 parent d9470d6 commit 6369737
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@

namespace Web::Painting {

class DisplayListPlayerSkia::SkiaSurface {
public:
SkCanvas& canvas() const { return *surface->getCanvas(); }

SkiaSurface(sk_sp<SkSurface> surface)
: surface(move(surface))
{
}

private:
sk_sp<SkSurface> surface;
};

#ifdef AK_OS_MACOS
class SkiaMetalBackendContext final : public SkiaBackendContext {
AK_MAKE_NONCOPYABLE(SkiaMetalBackendContext);
Expand Down Expand Up @@ -94,19 +107,6 @@ DisplayListPlayerSkia::DisplayListPlayerSkia(SkiaBackendContext& context, Core::
}
#endif

class DisplayListPlayerSkia::SkiaSurface {
public:
SkCanvas& canvas() const { return *surface->getCanvas(); }

SkiaSurface(sk_sp<SkSurface> surface)
: surface(move(surface))
{
}

private:
sk_sp<SkSurface> surface;
};

DisplayListPlayerSkia::DisplayListPlayerSkia(Gfx::Bitmap& bitmap)
{
VERIFY(bitmap.format() == Gfx::BitmapFormat::BGRA8888);
Expand Down

0 comments on commit 6369737

Please sign in to comment.