mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 11:20:03 +00:00
LibWeb/WebGL: Implement readPixels()
This commit is contained in:
committed by
Alexander Kalenik
parent
c199be061a
commit
4e8ec1e793
@@ -621,6 +621,28 @@ public:
|
||||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "readPixels"sv) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
if (!pixels) {
|
||||
return;
|
||||
}
|
||||
|
||||
void *ptr = nullptr;
|
||||
if (pixels->is_data_view()) {
|
||||
auto& data_view = static_cast<JS::DataView&>(*pixels->raw_object());
|
||||
ptr = data_view.viewed_array_buffer()->buffer().data();
|
||||
} else if (pixels->is_typed_array_base()) {
|
||||
auto& typed_array_base = static_cast<JS::TypedArrayBase&>(*pixels->raw_object());
|
||||
ptr = typed_array_base.viewed_array_buffer()->buffer().data();
|
||||
} else {
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
glReadPixels(x, y, width, height, format, type, ptr);
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "drawElements"sv) {
|
||||
function_impl_generator.append(R"~~~(
|
||||
glDrawElements(mode, count, type, reinterpret_cast<void*>(offset));
|
||||
|
||||
Reference in New Issue
Block a user