mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibGfx: Use Skia for TinyVG rendering
This commit is contained in:
parent
331f26a88b
commit
39c500ec7c
Notes:
github-actions[bot]
2024-11-25 11:15:23 +00:00
Author: https://github.com/shlyakpavel
Commit: 39c500ec7c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2512
Reviewed-by: https://github.com/gmta ✅
5 changed files with 51 additions and 31 deletions
|
@ -4,12 +4,12 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibGfx/DeprecatedPainter.h>
|
||||
#include <LibGfx/PainterSkia.h>
|
||||
#include <LibGfx/VectorGraphic.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
||||
void VectorGraphic::draw_into(DeprecatedPainter& painter, IntRect const& dest, AffineTransform transform) const
|
||||
void VectorGraphic::draw_into(Painter& painter, IntRect const& dest, AffineTransform transform) const
|
||||
{
|
||||
// Apply the transform then center within destination rectangle (this ignores any translation from the transform):
|
||||
// This allows you to easily rotate or flip the image before painting.
|
||||
|
@ -21,14 +21,14 @@ void VectorGraphic::draw_into(DeprecatedPainter& painter, IntRect const& dest, A
|
|||
.multiply(AffineTransform {}.scale(scale, scale))
|
||||
.multiply(AffineTransform {}.translate(-transformed_rect.location()))
|
||||
.multiply(transform);
|
||||
return draw_transformed(painter, view_transform);
|
||||
draw_transformed(painter, view_transform);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> VectorGraphic::bitmap(IntSize size, AffineTransform transform) const
|
||||
{
|
||||
auto bitmap = TRY(Bitmap::create(Gfx::BitmapFormat::BGRA8888, size));
|
||||
DeprecatedPainter painter { *bitmap };
|
||||
draw_into(painter, IntRect { {}, size }, transform);
|
||||
auto painter = PainterSkia::create(bitmap);
|
||||
draw_into(*painter, IntRect { {}, size }, transform);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue