瀏覽代碼

LibWeb: Ensure SkiaSurface is fully defined before it is allocated

LLVM 18 on macOS correctly errs when we try to allocate an incomplete
SkiaSurface object.
Timothy Flynn 1 年之前
父節點
當前提交
6369737676
共有 1 個文件被更改,包括 13 次插入13 次删除
  1. 13 13
      Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp

+ 13 - 13
Userland/Libraries/LibWeb/Painting/DisplayListPlayerSkia.cpp

@@ -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);
@@ -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);