mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibWeb: Return ImmutableBitmap from PaintingSurface::create_snapshot()
This is a preparation for upcoming changes where ImmutableBitmap will own SkImage allowing Skia to cache GPU textures across repaints.
This commit is contained in:
committed by
Alexander Kalenik
parent
31bf40b659
commit
a2c33ea4e1
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -130,7 +131,10 @@ WebIDL::ExceptionOr<JS::GCPtr<CanvasPattern>> CanvasPattern::create(JS::Realm& r
|
||||
auto bitmap = image.visit(
|
||||
[](JS::Handle<HTMLImageElement> const& source) -> RefPtr<Gfx::Bitmap> { return *source->bitmap(); },
|
||||
[](JS::Handle<SVG::SVGImageElement> const& source) -> RefPtr<Gfx::Bitmap> { return *source->bitmap(); },
|
||||
[](JS::Handle<HTMLCanvasElement> const& source) -> RefPtr<Gfx::Bitmap> { return source->surface()->create_snapshot(); },
|
||||
[](JS::Handle<HTMLCanvasElement> const& source) -> RefPtr<Gfx::Bitmap> {
|
||||
auto snapshot = source->surface()->create_snapshot();
|
||||
return snapshot->bitmap();
|
||||
},
|
||||
[](JS::Handle<HTMLVideoElement> const& source) -> RefPtr<Gfx::Bitmap> { return *source->bitmap(); },
|
||||
[](JS::Handle<ImageBitmap> const& source) -> RefPtr<Gfx::Bitmap> { return *source->bitmap(); });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user