mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 15:49:15 +00:00
LibWeb+LibGfx: Replace BackingStore with PaintingSurface
Now, when Skia backend context is available by the time backing stores are allocated, there is no need to have a separate BackingStore class. This allows us to get rid of BackingStore -> PaintingSurface cache.
This commit is contained in:
parent
082053d781
commit
c18314b942
Notes:
github-actions[bot]
2025-07-04 14:14:05 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: c18314b942
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5259
Reviewed-by: https://github.com/gmta ✅
14 changed files with 52 additions and 189 deletions
|
@ -21,8 +21,7 @@
|
|||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/BackingStore.h>
|
||||
#include <LibWeb/Painting/ViewportPaintable.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -1413,19 +1412,19 @@ void TraversableNavigable::process_screenshot_requests()
|
|||
}
|
||||
auto rect = page().enclosing_device_rect(dom_node->paintable_box()->absolute_border_box_rect());
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect.size().to_type<int>()).release_value_but_fixme_should_propagate_errors();
|
||||
auto backing_store = Painting::BitmapBackingStore::create(*bitmap);
|
||||
auto painting_surface = Gfx::PaintingSurface::wrap_bitmap(*bitmap);
|
||||
PaintConfig paint_config { .canvas_fill_rect = rect.to_type<int>() };
|
||||
start_display_list_rendering(backing_store, paint_config, [backing_store, &client] {
|
||||
client.page_did_take_screenshot(backing_store->bitmap().to_shareable_bitmap());
|
||||
start_display_list_rendering(painting_surface, paint_config, [bitmap, &client] {
|
||||
client.page_did_take_screenshot(bitmap->to_shareable_bitmap());
|
||||
});
|
||||
} else {
|
||||
auto scrollable_overflow_rect = active_document()->layout_node()->paintable_box()->scrollable_overflow_rect();
|
||||
auto rect = page().enclosing_device_rect(scrollable_overflow_rect.value());
|
||||
auto bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, rect.size().to_type<int>()).release_value_but_fixme_should_propagate_errors();
|
||||
auto backing_store = Painting::BitmapBackingStore::create(*bitmap);
|
||||
auto painting_surface = Gfx::PaintingSurface::wrap_bitmap(*bitmap);
|
||||
PaintConfig paint_config { .paint_overlay = true, .canvas_fill_rect = rect.to_type<int>() };
|
||||
start_display_list_rendering(backing_store, paint_config, [backing_store, &client] {
|
||||
client.page_did_take_screenshot(backing_store->bitmap().to_shareable_bitmap());
|
||||
start_display_list_rendering(painting_surface, paint_config, [bitmap, &client] {
|
||||
client.page_did_take_screenshot(bitmap->to_shareable_bitmap());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue