mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Delegate painting surface allocation to canvas's active context
This change prepares for the addition of WebGL support, where painting surface allocation process will differ from that of context2d.
This commit is contained in:
parent
e683700fe6
commit
f719b05ab9
Notes:
github-actions[bot]
2024-12-03 22:37:53 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: f719b05ab9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2688
Reviewed-by: https://github.com/ADKaster ✅
8 changed files with 116 additions and 67 deletions
|
@ -42,8 +42,10 @@ ErrorOr<GC::Ref<HTML::HTMLCanvasElement>, WebDriver::Error> draw_bounding_box_fr
|
|||
MUST(canvas.set_height(paint_height));
|
||||
|
||||
// FIXME: 5. Let context, a canvas context mode, be the result of invoking the 2D context creation algorithm given canvas as the target.
|
||||
if (!canvas.allocate_painting_surface(paint_width, paint_height))
|
||||
return Error::from_code(ErrorCode::UnableToCaptureScreen, "Unable to create a screenshot bitmap"sv);
|
||||
canvas.create_2d_context();
|
||||
canvas.allocate_painting_surface_if_needed();
|
||||
if (!canvas.surface())
|
||||
return Error::from_code(ErrorCode::UnableToCaptureScreen, "Failed to allocate painting surface"sv);
|
||||
|
||||
// 6. Complete implementation specific steps equivalent to drawing the region of the framebuffer specified by the following coordinates onto context:
|
||||
// - X coordinate: rectangle x coordinate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue