mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-24 00:49:46 +00:00
LibWeb/WebGL: Move Float32List -> Span<float> conversion into helper
This allows to remove lots of duplicated code.
This commit is contained in:
parent
d54cab60a8
commit
655cd339a7
Notes:
github-actions[bot]
2025-09-30 14:48:27 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 655cd339a7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6346
Reviewed-by: https://github.com/gmta
4 changed files with 84 additions and 359 deletions
|
|
@ -1,11 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
* Copyright (c) 2024-2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/WebIDL/Types.h>
|
||||
|
||||
|
|
@ -23,6 +24,13 @@ public:
|
|||
virtual GC::Cell const* gc_cell() const = 0;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) = 0;
|
||||
virtual OpenGLContext& context() = 0;
|
||||
|
||||
static Span<float> span_from_float32_list(Float32List& float32_list)
|
||||
{
|
||||
if (float32_list.has<Vector<float>>())
|
||||
return float32_list.get<Vector<float>>();
|
||||
return float32_list.get<GC::Root<JS::Float32Array>>()->data();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue