mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibWeb: Respect selected painter in SVGDecodedImageData
Now SVGDecodedImageData uses Skia painter, if it's selected.
This commit is contained in:
parent
6dd124fc87
commit
de6d99e940
Notes:
sideshowbarker
2024-07-16 23:34:44 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/de6d99e940 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/208
1 changed files with 19 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue