mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibWeb/WebGL: Support ArrayBuffer and DataView for BufferSource
This commit is contained in:
parent
5392aabded
commit
460f5fe511
Notes:
github-actions[bot]
2024-12-05 20:42:03 +00:00
Author: https://github.com/Lubrsi
Commit: 460f5fe511
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2791
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/shannonbooth
1 changed files with 8 additions and 1 deletions
|
@ -314,6 +314,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
implementation_file_generator.append(R"~~~(
|
implementation_file_generator.append(R"~~~(
|
||||||
#include <LibJS/Runtime/ArrayBuffer.h>
|
#include <LibJS/Runtime/ArrayBuffer.h>
|
||||||
|
#include <LibJS/Runtime/DataView.h>
|
||||||
#include <LibJS/Runtime/TypedArray.h>
|
#include <LibJS/Runtime/TypedArray.h>
|
||||||
#include <LibWeb/HTML/HTMLCanvasElement.h>
|
#include <LibWeb/HTML/HTMLCanvasElement.h>
|
||||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||||
|
@ -796,7 +797,13 @@ public:
|
||||||
ptr = typed_array_base.viewed_array_buffer()->buffer().data();
|
ptr = typed_array_base.viewed_array_buffer()->buffer().data();
|
||||||
byte_size = typed_array_base.viewed_array_buffer()->byte_length();
|
byte_size = typed_array_base.viewed_array_buffer()->byte_length();
|
||||||
} else if (@buffer_source_name@->is_data_view()) {
|
} else if (@buffer_source_name@->is_data_view()) {
|
||||||
VERIFY_NOT_REACHED();
|
auto& data_view = static_cast<JS::DataView&>(*@buffer_source_name@->raw_object());
|
||||||
|
ptr = data_view.viewed_array_buffer()->buffer().data();
|
||||||
|
byte_size = data_view.viewed_array_buffer()->byte_length();
|
||||||
|
} else if (@buffer_source_name@->is_array_buffer()) {
|
||||||
|
auto& array_buffer = static_cast<JS::ArrayBuffer&>(*@buffer_source_name@->raw_object());
|
||||||
|
ptr = array_buffer.buffer().data();
|
||||||
|
byte_size = array_buffer.byte_length();
|
||||||
} else {
|
} else {
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue