summaryrefslogtreecommitdiffstats
path: root/gfx/angle/checkout/src/libANGLE/AttributeMap.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /gfx/angle/checkout/src/libANGLE/AttributeMap.h
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/angle/checkout/src/libANGLE/AttributeMap.h')
-rw-r--r--gfx/angle/checkout/src/libANGLE/AttributeMap.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/gfx/angle/checkout/src/libANGLE/AttributeMap.h b/gfx/angle/checkout/src/libANGLE/AttributeMap.h
new file mode 100644
index 0000000000..0000ecd817
--- /dev/null
+++ b/gfx/angle/checkout/src/libANGLE/AttributeMap.h
@@ -0,0 +1,66 @@
+//
+// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#ifndef LIBANGLE_ATTRIBUTEMAP_H_
+#define LIBANGLE_ATTRIBUTEMAP_H_
+
+#include "common/PackedEnums.h"
+
+#include <EGL/egl.h>
+
+#include <map>
+#include <vector>
+
+namespace egl
+{
+
+class AttributeMap final
+{
+ public:
+ AttributeMap();
+ AttributeMap(const AttributeMap &other);
+ ~AttributeMap();
+
+ void insert(EGLAttrib key, EGLAttrib value);
+ bool contains(EGLAttrib key) const;
+
+ EGLAttrib get(EGLAttrib key) const;
+ EGLAttrib get(EGLAttrib key, EGLAttrib defaultValue) const;
+ EGLint getAsInt(EGLAttrib key) const;
+ EGLint getAsInt(EGLAttrib key, EGLint defaultValue) const;
+
+ template <typename PackedEnumT>
+ PackedEnumT getAsPackedEnum(EGLAttrib key) const
+ {
+ return FromEGLenum<PackedEnumT>(static_cast<EGLenum>(get(key)));
+ }
+
+ template <typename PackedEnumT>
+ PackedEnumT getAsPackedEnum(EGLAttrib key, PackedEnumT defaultValue) const
+ {
+ auto iter = mAttributes.find(key);
+ return (mAttributes.find(key) != mAttributes.end())
+ ? FromEGLenum<PackedEnumT>(static_cast<EGLenum>(iter->second))
+ : defaultValue;
+ }
+
+ bool isEmpty() const;
+ std::vector<EGLint> toIntVector() const;
+
+ typedef std::map<EGLAttrib, EGLAttrib>::const_iterator const_iterator;
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ static AttributeMap CreateFromIntArray(const EGLint *attributes);
+ static AttributeMap CreateFromAttribArray(const EGLAttrib *attributes);
+
+ private:
+ std::map<EGLAttrib, EGLAttrib> mAttributes;
+};
+} // namespace egl
+
+#endif // LIBANGLE_ATTRIBUTEMAP_H_