Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | From baebc004111289ef658c78a42f8332f3dceef41e Mon Sep 17 00:00:00 2001 |
| 2 | From: "ryuan.choi@navercorp.com" <ryuan.choi@navercorp.com> |
| 3 | Date: Thu, 13 Nov 2014 07:07:16 +0000 |
| 4 | Subject: [PATCH 4/4] Fix the build with EFL 1.12 |
| 5 | https://bugs.webkit.org/show_bug.cgi?id=138245 |
| 6 | |
| 7 | Reviewed by Gyuyoung Kim. |
| 8 | |
| 9 | Source/WebKit2: |
| 10 | |
| 11 | * UIProcess/API/efl/EwkView.cpp: |
| 12 | First, modified to use Evas_GL raw pointer instead of UniquePtrEfl because |
| 13 | Evas_GL.h can't be included in UniquePtrEfl.h |
| 14 | It should be moved into EvasGLContext because WebKit/EFL use only one Evas_GL. |
| 15 | Second, provided the version of GLES in Evas_GL_Config not to break build with |
| 16 | EFL 1.12 |
| 17 | (EwkView::EwkView): |
| 18 | (EwkView::~EwkView): |
| 19 | (EwkView::displayTimerFired): |
| 20 | (EwkView::createGLSurface): |
| 21 | * UIProcess/API/efl/EwkView.h: |
| 22 | |
| 23 | Source/WTF: |
| 24 | |
| 25 | * wtf/efl/UniquePtrEfl.h: |
| 26 | Removed Evas_GL.h from UniquePtrEfl.h, which is commonly included, because |
| 27 | it should not be included with official GL headers. |
| 28 | |
| 29 | git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176066 268f45cc-cd09-0410-ab3c-d52691b4dbfc |
| 30 | --- |
| 31 | Source/WTF/wtf/efl/UniquePtrEfl.h | 2 -- |
| 32 | Source/WebKit2/UIProcess/API/efl/EwkView.cpp | 24 ++++++++++++++++-------- |
| 33 | Source/WebKit2/UIProcess/API/efl/EwkView.h | 3 ++- |
| 34 | 3 files changed, 18 insertions(+), 11 deletions(-) |
| 35 | |
| 36 | diff --git a/Source/WTF/wtf/efl/UniquePtrEfl.h b/Source/WTF/wtf/efl/UniquePtrEfl.h |
| 37 | index ba0110a..038d3fb 100644 |
| 38 | --- a/Source/WTF/wtf/efl/UniquePtrEfl.h |
| 39 | +++ b/Source/WTF/wtf/efl/UniquePtrEfl.h |
| 40 | @@ -33,7 +33,6 @@ |
| 41 | #include <Ecore_IMF.h> |
| 42 | #include <Eina.h> |
| 43 | #include <Evas.h> |
| 44 | -#include <Evas_GL.h> |
| 45 | |
| 46 | namespace WTF { |
| 47 | |
| 48 | @@ -51,7 +50,6 @@ using EflUniquePtr = std::unique_ptr<T, EflPtrDeleter<T>>; |
| 49 | macro(Eina_Hash, eina_hash_free) \ |
| 50 | macro(Eina_Module, eina_module_free) \ |
| 51 | macro(Evas_Object, evas_object_del) \ |
| 52 | - macro(Evas_GL, evas_gl_free) |
| 53 | |
| 54 | #define WTF_DEFINE_EFLPTR_DELETER(typeName, deleterFunc) \ |
| 55 | template<> struct EflPtrDeleter<typeName> \ |
| 56 | diff --git a/Source/WebKit2/UIProcess/API/efl/EwkView.cpp b/Source/WebKit2/UIProcess/API/efl/EwkView.cpp |
| 57 | index 50d34ed..6ff3394 100755 |
| 58 | --- a/Source/WebKit2/UIProcess/API/efl/EwkView.cpp |
| 59 | +++ b/Source/WebKit2/UIProcess/API/efl/EwkView.cpp |
| 60 | @@ -299,9 +299,11 @@ EwkView::EwkView(WKViewRef view, Evas_Object* evasObject) |
| 61 | |
| 62 | // FIXME: Remove when possible. |
| 63 | static_cast<WebViewEfl*>(webView())->setEwkView(this); |
| 64 | - m_evasGL = EflUniquePtr<Evas_GL>(evas_gl_new(evas_object_evas_get(m_evasObject))); |
| 65 | + |
| 66 | + // FIXME: Consider it to move into EvasGLContext. |
| 67 | + m_evasGL = evas_gl_new(evas_object_evas_get(m_evasObject)); |
| 68 | if (m_evasGL) |
| 69 | - m_evasGLContext = EvasGLContext::create(m_evasGL.get()); |
| 70 | + m_evasGLContext = EvasGLContext::create(m_evasGL); |
| 71 | |
| 72 | if (!m_evasGLContext) { |
| 73 | WARN("Failed to create Evas_GL, falling back to software mode."); |
| 74 | @@ -333,6 +335,9 @@ EwkView::~EwkView() |
| 75 | { |
| 76 | ASSERT(wkPageToEvasObjectMap().get(wkPage()) == m_evasObject); |
| 77 | wkPageToEvasObjectMap().remove(wkPage()); |
| 78 | + |
| 79 | + if (m_evasGL) |
| 80 | + evas_gl_free(m_evasGL); |
| 81 | } |
| 82 | |
| 83 | EwkView* EwkView::create(WKViewRef webView, Evas* canvas, Evas_Smart* smart) |
| 84 | @@ -587,7 +592,7 @@ void EwkView::displayTimerFired(Timer<EwkView>*) |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | - evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context()); |
| 89 | + evas_gl_make_current(m_evasGL, m_evasGLSurface->surface(), m_evasGLContext->context()); |
| 90 | |
| 91 | WKViewPaintToCurrentGLContext(wkView()); |
| 92 | |
| 93 | @@ -828,21 +833,24 @@ bool EwkView::createGLSurface() |
| 94 | EVAS_GL_DEPTH_BIT_8, |
| 95 | EVAS_GL_STENCIL_NONE, |
| 96 | EVAS_GL_OPTIONS_NONE, |
| 97 | - EVAS_GL_MULTISAMPLE_NONE |
| 98 | + EVAS_GL_MULTISAMPLE_NONE, |
| 99 | +#if defined(EVAS_GL_API_VERSION) && EVAS_GL_API_VERSION >= 2 |
| 100 | + EVAS_GL_GLES_2_X |
| 101 | +#endif |
| 102 | }; |
| 103 | |
| 104 | // Recreate to current size: Replaces if non-null, and frees existing surface after (OwnPtr). |
| 105 | - m_evasGLSurface = EvasGLSurface::create(m_evasGL.get(), &evasGLConfig, deviceSize()); |
| 106 | + m_evasGLSurface = EvasGLSurface::create(m_evasGL, &evasGLConfig, deviceSize()); |
| 107 | if (!m_evasGLSurface) |
| 108 | return false; |
| 109 | |
| 110 | Evas_Native_Surface nativeSurface; |
| 111 | - evas_gl_native_surface_get(m_evasGL.get(), m_evasGLSurface->surface(), &nativeSurface); |
| 112 | + evas_gl_native_surface_get(m_evasGL, m_evasGLSurface->surface(), &nativeSurface); |
| 113 | evas_object_image_native_surface_set(smartData()->image, &nativeSurface); |
| 114 | |
| 115 | - evas_gl_make_current(m_evasGL.get(), m_evasGLSurface->surface(), m_evasGLContext->context()); |
| 116 | + evas_gl_make_current(m_evasGL, m_evasGLSurface->surface(), m_evasGLContext->context()); |
| 117 | |
| 118 | - Evas_GL_API* gl = evas_gl_api_get(m_evasGL.get()); |
| 119 | + Evas_GL_API* gl = evas_gl_api_get(m_evasGL); |
| 120 | |
| 121 | WKPoint boundsEnd = WKViewUserViewportToScene(wkView(), WKPointMake(deviceSize().width(), deviceSize().height())); |
| 122 | gl->glViewport(0, 0, boundsEnd.x, boundsEnd.y); |
| 123 | diff --git a/Source/WebKit2/UIProcess/API/efl/EwkView.h b/Source/WebKit2/UIProcess/API/efl/EwkView.h |
| 124 | index 1c482cf..68dab87 100644 |
| 125 | --- a/Source/WebKit2/UIProcess/API/efl/EwkView.h |
| 126 | +++ b/Source/WebKit2/UIProcess/API/efl/EwkView.h |
| 127 | @@ -39,6 +39,7 @@ |
| 128 | #endif |
| 129 | |
| 130 | typedef struct _cairo_surface cairo_surface_t; |
| 131 | +typedef struct _Evas_GL Evas_GL; |
| 132 | |
| 133 | namespace WebKit { |
| 134 | class ContextMenuClientEfl; |
| 135 | @@ -241,7 +242,7 @@ private: |
| 136 | Evas_Object* m_evasObject; |
| 137 | RefPtr<EwkContext> m_context; |
| 138 | RefPtr<EwkPageGroup> m_pageGroup; |
| 139 | - EflUniquePtr<Evas_GL> m_evasGL; |
| 140 | + Evas_GL* m_evasGL; |
| 141 | std::unique_ptr<WebCore::EvasGLContext> m_evasGLContext; |
| 142 | std::unique_ptr<WebCore::EvasGLSurface> m_evasGLSurface; |
| 143 | bool m_pendingSurfaceResize; |
| 144 | -- |
| 145 | 2.1.3 |
| 146 | |