소스 검색

LibWeb: Respect selected painter in SVGDecodedImageData

Now SVGDecodedImageData uses Skia painter, if it's selected.
Aliaksandr Kalenik 1 년 전
부모
커밋
de6d99e940
1개의 변경된 파일19개의 추가작업 그리고 2개의 파일을 삭제
  1. 19 2
      Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp

+ 19 - 2
Userland/Libraries/LibWeb/SVG/SVGDecodedImageData.cpp

@@ -16,6 +16,7 @@
 #include <LibWeb/Layout/Viewport.h>
 #include <LibWeb/Page/Page.h>
 #include <LibWeb/Painting/CommandExecutorCPU.h>
+#include <LibWeb/Painting/CommandExecutorSkia.h>
 #include <LibWeb/Painting/PaintContext.h>
 #include <LibWeb/Painting/ViewportPaintable.h>
 #include <LibWeb/SVG/SVGDecodedImageData.h>
@@ -94,10 +95,26 @@ RefPtr<Gfx::Bitmap> SVGDecodedImageData::render(Gfx::IntSize size) const
 
     Painting::CommandList painting_commands;
     Painting::RecordingPainter recording_painter(painting_commands);
-    Painting::CommandExecutorCPU executor { *bitmap };
 
     m_document->navigable()->record_painting_commands(recording_painter, {});
-    painting_commands.execute(executor);
+
+    auto painting_command_executor_type = m_page_client->painting_command_executor_type();
+    switch (painting_command_executor_type) {
+    case PaintingCommandExecutorType::CPU:
+    case PaintingCommandExecutorType::CPUWithExperimentalTransformSupport:
+    case PaintingCommandExecutorType::GPU: { // GPU painter does not have any path rasterization support so we always fall back to CPU painter
+        Painting::CommandExecutorCPU executor { *bitmap };
+        painting_commands.execute(executor);
+        break;
+    }
+    case PaintingCommandExecutorType::Skia: {
+        Painting::CommandExecutorSkia executor { *bitmap };
+        painting_commands.execute(executor);
+        break;
+    }
+    default:
+        VERIFY_NOT_REACHED();
+    }
 
     return bitmap;
 }