LibWeb: Respect selected painter in SVGDecodedImageData

Now SVGDecodedImageData uses Skia painter, if it's selected.
This commit is contained in:
Aliaksandr Kalenik 2024-06-19 15:03:04 +03:00 committed by Alexander Kalenik
parent 6dd124fc87
commit de6d99e940
Notes: sideshowbarker 2024-07-16 23:34:44 +09:00

View File

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