mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Deduplicate the WebGL null_terminated_string helper
This commit is contained in:
parent
6c115171da
commit
df1aeda955
Notes:
github-actions[bot]
2025-11-05 01:20:56 +00:00
Author: https://github.com/cqundefine
Commit: df1aeda955
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6676
Reviewed-by: https://github.com/kalenikaliaksandr ✅
Reviewed-by: https://github.com/konradekk
4 changed files with 12 additions and 18 deletions
|
|
@ -16,6 +16,7 @@ using GLuint = unsigned int;
|
|||
using GLint = int;
|
||||
using GLsizei = int;
|
||||
using GLintptr = long long;
|
||||
using GLchar = char;
|
||||
|
||||
// FIXME: This should really be "struct __GLsync*", but the linker doesn't recognise it.
|
||||
// Since this conflicts with the original definition of GLsync, the suffix "Internal" has been added.
|
||||
|
|
|
|||
|
|
@ -37,15 +37,6 @@ extern "C" {
|
|||
|
||||
namespace Web::WebGL {
|
||||
|
||||
static Vector<GLchar> null_terminated_string(StringView string)
|
||||
{
|
||||
Vector<GLchar> result;
|
||||
for (auto c : string.bytes())
|
||||
result.append(c);
|
||||
result.append('\0');
|
||||
return result;
|
||||
}
|
||||
|
||||
WebGL2RenderingContextImpl::WebGL2RenderingContextImpl(JS::Realm& realm, NonnullOwnPtr<OpenGLContext> context)
|
||||
: m_realm(realm)
|
||||
, m_context(move(context))
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibJS/Runtime/DataView.h>
|
||||
#include <LibJS/Runtime/TypedArray.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/WebGL/Types.h>
|
||||
#include <LibWeb/WebIDL/Buffers.h>
|
||||
#include <LibWeb/WebIDL/Types.h>
|
||||
|
||||
|
|
@ -127,6 +128,16 @@ public:
|
|||
Optional<ConvertedTexture> read_and_pixel_convert_texture_image_source(TexImageSource const& source, WebIDL::UnsignedLong format, WebIDL::UnsignedLong type, Optional<int> destination_width = OptionalNone {}, Optional<int> destination_height = OptionalNone {});
|
||||
|
||||
protected:
|
||||
static Vector<GLchar> null_terminated_string(StringView string)
|
||||
{
|
||||
Vector<GLchar> result;
|
||||
result.ensure_capacity(string.length() + 1);
|
||||
for (auto c : string.bytes())
|
||||
result.append(c);
|
||||
result.append('\0');
|
||||
return result;
|
||||
}
|
||||
|
||||
// UNPACK_FLIP_Y_WEBGL of type boolean
|
||||
// If set, then during any subsequent calls to texImage2D or texSubImage2D, the source data is flipped along
|
||||
// the vertical axis, so that conceptually the last row is the first one transferred. The initial value is false.
|
||||
|
|
|
|||
|
|
@ -33,15 +33,6 @@ extern "C" {
|
|||
|
||||
namespace Web::WebGL {
|
||||
|
||||
static Vector<GLchar> null_terminated_string(StringView string)
|
||||
{
|
||||
Vector<GLchar> result;
|
||||
for (auto c : string.bytes())
|
||||
result.append(c);
|
||||
result.append('\0');
|
||||
return result;
|
||||
}
|
||||
|
||||
WebGLRenderingContextImpl::WebGLRenderingContextImpl(JS::Realm& realm, NonnullOwnPtr<OpenGLContext> context)
|
||||
: m_realm(realm)
|
||||
, m_context(move(context))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue