Title: [289731] trunk/Source/WebCore
Revision
289731
Author
[email protected]
Date
2022-02-14 05:04:06 -0800 (Mon, 14 Feb 2022)

Log Message

[GTK][WPE] Avoid mapping attributes when the vector is empty in createImage
https://bugs.webkit.org/show_bug.cgi?id=236521

Patch by Alejandro G. Castro <[email protected]> on 2022-02-14
Reviewed by Žan Doberšek.

We are just refactoring the function to avoid calling the map of
the original vector in case it is empty. Also we changed a double
negative in the isEmpty condition to make it clearer.

No new tests, there are tests checking this code.

* platform/graphics/egl/GLContextEGL.cpp:
(WebCore::GLContextEGL::createImage const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289730 => 289731)


--- trunk/Source/WebCore/ChangeLog	2022-02-14 12:20:41 UTC (rev 289730)
+++ trunk/Source/WebCore/ChangeLog	2022-02-14 13:04:06 UTC (rev 289731)
@@ -1,3 +1,19 @@
+2022-02-14  Alejandro G. Castro  <[email protected]>
+
+        [GTK][WPE] Avoid mapping attributes when the vector is empty in createImage
+        https://bugs.webkit.org/show_bug.cgi?id=236521
+
+        Reviewed by Žan Doberšek.
+
+        We are just refactoring the function to avoid calling the map of
+        the original vector in case it is empty. Also we changed a double
+        negative in the isEmpty condition to make it clearer.
+
+        No new tests, there are tests checking this code.
+
+        * platform/graphics/egl/GLContextEGL.cpp:
+        (WebCore::GLContextEGL::createImage const):
+
 2022-02-14  Enrique Ocaña González  <[email protected]>
 
         Don't throw exception when controls are removed

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


--- trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2022-02-14 12:20:41 UTC (rev 289730)
+++ trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp	2022-02-14 13:04:06 UTC (rev 289731)
@@ -402,12 +402,16 @@
 EGLImage GLContextEGL::createImage(EGLenum target, EGLClientBuffer clientBuffer, const Vector<EGLAttrib>& attribList) const
 {
     if (m_eglCreateImage)
-        return m_eglCreateImage(m_display.eglDisplay(), !attribList.isEmpty() ? EGL_NO_CONTEXT : m_context, target, clientBuffer, attribList.data());
+        return m_eglCreateImage(m_display.eglDisplay(), attribList.isEmpty() ? m_context : EGL_NO_CONTEXT, target, clientBuffer, attribList.data());
+
     if (m_eglCreateImageKHR) {
+        if (attribList.isEmpty())
+            return m_eglCreateImageKHR(m_display.eglDisplay(), m_context, target, clientBuffer, nullptr);
+
         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 m_eglCreateImageKHR(m_display.eglDisplay(), EGL_NO_CONTEXT, target, clientBuffer, intAttribList.data());
     }
     return EGL_NO_IMAGE;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to