Title: [289109] trunk/Source/WebCore
Revision
289109
Author
commit-qu...@webkit.org
Date
2022-02-04 05:52:36 -0800 (Fri, 04 Feb 2022)

Log Message

[GTK][WPE] Use a Vector when defining the EGLImage attributes in the createImage
https://bugs.webkit.org/show_bug.cgi?id=236133

Patch by Alejandro G. Castro <a...@igalia.com> on 2022-02-04
Reviewed by Žan Doberšek.

No new tests, no change in behaviour

* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::createImage const): Replace the parameter
of createImage with a Vector, and use map to transform in case we
have to use the extension function.
* platform/graphics/egl/GLContextEGL.h: Ditto.
* platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
(WebCore::TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer):
Fix a warning caused by the order of the parameter initialization.
* platform/graphics/texmap/TextureMapperPlatformLayerDmabuf.cpp:
(WebCore::TextureMapperPlatformLayerDmabuf::validateTexture):
Replace the C array with a Vector object.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289108 => 289109)


--- trunk/Source/WebCore/ChangeLog	2022-02-04 11:58:52 UTC (rev 289108)
+++ trunk/Source/WebCore/ChangeLog	2022-02-04 13:52:36 UTC (rev 289109)
@@ -1,3 +1,24 @@
+2022-02-04  Alejandro G. Castro  <a...@igalia.com>
+
+        [GTK][WPE] Use a Vector when defining the EGLImage attributes in the createImage
+        https://bugs.webkit.org/show_bug.cgi?id=236133
+
+        Reviewed by Žan Doberšek.
+
+        No new tests, no change in behaviour
+
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::GLContextEGL::createImage const): Replace the parameter
+        of createImage with a Vector, and use map to transform in case we
+        have to use the extension function.
+        * platform/graphics/egl/GLContextEGL.h: Ditto.
+        * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
+        (WebCore::TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer):
+        Fix a warning caused by the order of the parameter initialization.
+        * platform/graphics/texmap/TextureMapperPlatformLayerDmabuf.cpp:
+        (WebCore::TextureMapperPlatformLayerDmabuf::validateTexture):
+        Replace the C array with a Vector object.
+
 2022-02-04  Sergio Villar Senin  <svil...@igalia.com>
 
         HTMLMediaElement should dispatch the resize event asynchronously

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp (289108 => 289109)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2022-02-04 11:58:52 UTC (rev 289108)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2022-02-04 13:52:36 UTC (rev 289109)
@@ -399,18 +399,15 @@
 #endif
 }
 
-EGLImage GLContextEGL::createImage(EGLenum target, EGLClientBuffer clientBuffer, const EGLAttrib* attribList) const
+EGLImage GLContextEGL::createImage(EGLenum target, EGLClientBuffer clientBuffer, const Vector<EGLAttrib>& attribList) const
 {
     if (m_eglCreateImage)
-        return m_eglCreateImage(m_display.eglDisplay(), attribList ? EGL_NO_CONTEXT : m_context, target, clientBuffer, attribList);
+        return m_eglCreateImage(m_display.eglDisplay(), !attribList.isEmpty() ? EGL_NO_CONTEXT : m_context, target, clientBuffer, attribList.data());
     if (m_eglCreateImageKHR) {
-        Vector<EGLint> intAttribList;
-        for (int i = 0; attribList[i] != EGL_NONE; i += 2) {
-            intAttribList.append(attribList[i]);
-            intAttribList.append(attribList[i+1]);
-        }
-        intAttribList.append(EGL_NONE);
-        return m_eglCreateImageKHR(m_display.eglDisplay(), attribList ? EGL_NO_CONTEXT : m_context, target, clientBuffer, intAttribList.data());
+        auto intAttribList = attribList.map<Vector<EGLint>>([] (EGLAttrib value) {
+            return value;
+        });
+        return m_eglCreateImageKHR(m_display.eglDisplay(), !attribList.isEmpty() ? EGL_NO_CONTEXT : m_context, target, clientBuffer, intAttribList.data());
     }
     return EGL_NO_IMAGE;
 }

Modified: trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h (289108 => 289109)


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h	2022-02-04 11:58:52 UTC (rev 289108)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.h	2022-02-04 13:52:36 UTC (rev 289109)
@@ -73,7 +73,7 @@
     static const char* lastErrorString();
 
     EGLConfig config() const { return m_config; }
-    EGLImage createImage(EGLenum target, EGLClientBuffer, const EGLAttrib*) const;
+    EGLImage createImage(EGLenum target, EGLClientBuffer, const Vector<EGLAttrib>&) const;
     bool destroyImage(EGLImage) const;
 
     virtual ~GLContextEGL();

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp (289108 => 289109)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp	2022-02-04 11:58:52 UTC (rev 289108)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp	2022-02-04 13:52:36 UTC (rev 289109)
@@ -34,8 +34,8 @@
 namespace WebCore {
 
 TextureMapperPlatformLayerBuffer::TextureMapperPlatformLayerBuffer(RefPtr<BitmapTexture>&& texture, TextureMapperGL::Flags flags)
-    : m_texture(WTFMove(texture))
-    , m_variant(RGBTexture { 0 })
+    : m_variant(RGBTexture { 0 })
+    , m_texture(WTFMove(texture))
     , m_extraFlags(flags)
     , m_hasManagedTexture(true)
 {

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerDmabuf.cpp (289108 => 289109)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerDmabuf.cpp	2022-02-04 11:58:52 UTC (rev 289108)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerDmabuf.cpp	2022-02-04 13:52:36 UTC (rev 289109)
@@ -89,7 +89,7 @@
     context->makeContextCurrent();
 
     auto size = TextureMapperPlatformLayerBuffer::size();
-    EGLAttrib imageAttributes[] = {
+    Vector<EGLAttrib> imageAttributes {
         EGL_WIDTH, size.width(),
         EGL_HEIGHT, size.height(),
         EGL_LINUX_DRM_FOURCC_EXT, static_cast<EGLAttrib>(m_format),
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to