Commit 1a506957 by Geoff Lang

Rename SurfaceWGL to WindowSurfaceWGL.

BUG=angleproject:890 Change-Id: I72f28583e3903b273578abb6ed487c0a8d696746 Reviewed-on: https://chromium-review.googlesource.com/261359Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 1aca922a
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#include "libANGLE/AttributeMap.h" #include "libANGLE/AttributeMap.h"
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/SurfaceGL.h"
#include <EGL/eglext.h> #include <EGL/eglext.h>
...@@ -49,4 +51,15 @@ egl::Error DisplayGL::createContext(const egl::Config *config, const gl::Context ...@@ -49,4 +51,15 @@ egl::Error DisplayGL::createContext(const egl::Config *config, const gl::Context
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
{
if (!drawSurface)
{
return egl::Error(EGL_SUCCESS);
}
SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface);
return glDrawSurface->makeCurrent();
}
} }
...@@ -29,6 +29,8 @@ class DisplayGL : public DisplayImpl ...@@ -29,6 +29,8 @@ class DisplayGL : public DisplayImpl
egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &attribs, egl::Error createContext(const egl::Config *config, const gl::Context *shareContext, const egl::AttributeMap &attribs,
gl::Context **outContext) override; gl::Context **outContext) override;
egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override;
private: private:
virtual const FunctionsGL *getFunctionsGL() const = 0; virtual const FunctionsGL *getFunctionsGL() const = 0;
......
...@@ -19,6 +19,8 @@ class SurfaceGL : public SurfaceImpl ...@@ -19,6 +19,8 @@ class SurfaceGL : public SurfaceImpl
public: public:
SurfaceGL(); SurfaceGL();
~SurfaceGL() override; ~SurfaceGL() override;
virtual egl::Error makeCurrent() = 0;
}; };
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "libANGLE/Display.h" #include "libANGLE/Display.h"
#include "libANGLE/Surface.h" #include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h" #include "libANGLE/renderer/gl/wgl/FunctionsWGL.h"
#include "libANGLE/renderer/gl/wgl/SurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h"
#include "libANGLE/renderer/gl/wgl/wgl_utils.h" #include "libANGLE/renderer/gl/wgl/wgl_utils.h"
#include <EGL/eglext.h> #include <EGL/eglext.h>
...@@ -337,7 +337,7 @@ void DisplayWGL::terminate() ...@@ -337,7 +337,7 @@ void DisplayWGL::terminate()
egl::Error DisplayWGL::createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window, egl::Error DisplayWGL::createWindowSurface(const egl::Config *configuration, EGLNativeWindowType window,
const egl::AttributeMap &attribs, SurfaceImpl **outSurface) const egl::AttributeMap &attribs, SurfaceImpl **outSurface)
{ {
SurfaceWGL *surface = new SurfaceWGL(window, mWindowClass, mPixelFormat, mWGLContext, mFunctionsWGL); WindowSurfaceWGL *surface = new WindowSurfaceWGL(window, mWindowClass, mPixelFormat, mWGLContext, mFunctionsWGL);
egl::Error error = surface->initialize(); egl::Error error = surface->initialize();
if (error.isError()) if (error.isError())
{ {
...@@ -370,17 +370,6 @@ egl::Error DisplayWGL::createPixmapSurface(const egl::Config *configuration, Nat ...@@ -370,17 +370,6 @@ egl::Error DisplayWGL::createPixmapSurface(const egl::Config *configuration, Nat
return egl::Error(EGL_BAD_DISPLAY); return egl::Error(EGL_BAD_DISPLAY);
} }
egl::Error DisplayWGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
{
if (!drawSurface)
{
return egl::Error(EGL_SUCCESS);
}
SurfaceWGL *wglDrawSurface = SurfaceWGL::makeSurfaceWGL(drawSurface->getImplementation());
return wglDrawSurface->makeCurrent();
}
egl::ConfigSet DisplayWGL::generateConfigs() const egl::ConfigSet DisplayWGL::generateConfigs() const
{ {
egl::ConfigSet configs; egl::ConfigSet configs;
......
...@@ -36,8 +36,6 @@ class DisplayWGL : public DisplayGL ...@@ -36,8 +36,6 @@ class DisplayWGL : public DisplayGL
egl::Error createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap, egl::Error createPixmapSurface(const egl::Config *configuration, NativePixmapType nativePixmap,
const egl::AttributeMap &attribs, SurfaceImpl **outSurface) override; const egl::AttributeMap &attribs, SurfaceImpl **outSurface) override;
egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) override;
egl::ConfigSet generateConfigs() const override; egl::ConfigSet generateConfigs() const override;
bool isDeviceLost() const override; bool isDeviceLost() const override;
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// SurfaceWGL.cpp: WGL implementation of egl::Surface // WindowSurfaceWGL.cpp: WGL implementation of egl::Surface for windows
#include "libANGLE/renderer/gl/wgl/SurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h" #include "libANGLE/renderer/gl/wgl/FunctionsWGL.h"
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
namespace rx namespace rx
{ {
SurfaceWGL::SurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions) WindowSurfaceWGL::WindowSurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions)
: SurfaceGL(), : SurfaceGL(),
mWindowClass(windowClass), mWindowClass(windowClass),
mPixelFormat(pixelFormat), mPixelFormat(pixelFormat),
...@@ -27,7 +27,7 @@ SurfaceWGL::SurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFo ...@@ -27,7 +27,7 @@ SurfaceWGL::SurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFo
{ {
} }
SurfaceWGL::~SurfaceWGL() WindowSurfaceWGL::~WindowSurfaceWGL()
{ {
mWindowClass = 0; mWindowClass = 0;
mPixelFormat = 0; mPixelFormat = 0;
...@@ -41,13 +41,7 @@ SurfaceWGL::~SurfaceWGL() ...@@ -41,13 +41,7 @@ SurfaceWGL::~SurfaceWGL()
mChildWindow = nullptr; mChildWindow = nullptr;
} }
SurfaceWGL *SurfaceWGL::makeSurfaceWGL(SurfaceImpl *impl) egl::Error WindowSurfaceWGL::initialize()
{
ASSERT(HAS_DYNAMIC_TYPE(SurfaceWGL*, impl));
return static_cast<SurfaceWGL*>(impl);
}
egl::Error SurfaceWGL::initialize()
{ {
// Create a child window of the supplied window to draw to. // Create a child window of the supplied window to draw to.
RECT rect; RECT rect;
...@@ -89,7 +83,7 @@ egl::Error SurfaceWGL::initialize() ...@@ -89,7 +83,7 @@ egl::Error SurfaceWGL::initialize()
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error SurfaceWGL::makeCurrent() egl::Error WindowSurfaceWGL::makeCurrent()
{ {
if (!mFunctionsWGL->makeCurrent(mChildDeviceContext, mShareWGLContext)) if (!mFunctionsWGL->makeCurrent(mChildDeviceContext, mShareWGLContext))
{ {
...@@ -100,7 +94,7 @@ egl::Error SurfaceWGL::makeCurrent() ...@@ -100,7 +94,7 @@ egl::Error SurfaceWGL::makeCurrent()
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error SurfaceWGL::swap() egl::Error WindowSurfaceWGL::swap()
{ {
// Resize the child window to the interior of the parent window. // Resize the child window to the interior of the parent window.
RECT rect; RECT rect;
...@@ -125,31 +119,31 @@ egl::Error SurfaceWGL::swap() ...@@ -125,31 +119,31 @@ egl::Error SurfaceWGL::swap()
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error SurfaceWGL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) egl::Error WindowSurfaceWGL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error SurfaceWGL::querySurfacePointerANGLE(EGLint attribute, void **value) egl::Error WindowSurfaceWGL::querySurfacePointerANGLE(EGLint attribute, void **value)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error SurfaceWGL::bindTexImage(EGLint buffer) egl::Error WindowSurfaceWGL::bindTexImage(EGLint buffer)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
egl::Error SurfaceWGL::releaseTexImage(EGLint buffer) egl::Error WindowSurfaceWGL::releaseTexImage(EGLint buffer)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
return egl::Error(EGL_SUCCESS); return egl::Error(EGL_SUCCESS);
} }
void SurfaceWGL::setSwapInterval(EGLint interval) void WindowSurfaceWGL::setSwapInterval(EGLint interval)
{ {
if (mFunctionsWGL->swapIntervalEXT) if (mFunctionsWGL->swapIntervalEXT)
{ {
...@@ -157,7 +151,7 @@ void SurfaceWGL::setSwapInterval(EGLint interval) ...@@ -157,7 +151,7 @@ void SurfaceWGL::setSwapInterval(EGLint interval)
} }
} }
EGLint SurfaceWGL::getWidth() const EGLint WindowSurfaceWGL::getWidth() const
{ {
RECT rect; RECT rect;
if (!GetClientRect(mParentWindow, &rect)) if (!GetClientRect(mParentWindow, &rect))
...@@ -167,7 +161,7 @@ EGLint SurfaceWGL::getWidth() const ...@@ -167,7 +161,7 @@ EGLint SurfaceWGL::getWidth() const
return rect.right - rect.left; return rect.right - rect.left;
} }
EGLint SurfaceWGL::getHeight() const EGLint WindowSurfaceWGL::getHeight() const
{ {
RECT rect; RECT rect;
if (!GetClientRect(mParentWindow, &rect)) if (!GetClientRect(mParentWindow, &rect))
...@@ -177,7 +171,7 @@ EGLint SurfaceWGL::getHeight() const ...@@ -177,7 +171,7 @@ EGLint SurfaceWGL::getHeight() const
return rect.bottom - rect.top; return rect.bottom - rect.top;
} }
EGLint SurfaceWGL::isPostSubBufferSupported() const EGLint WindowSurfaceWGL::isPostSubBufferSupported() const
{ {
// PostSubBuffer extension not exposed on WGL. // PostSubBuffer extension not exposed on WGL.
UNIMPLEMENTED(); UNIMPLEMENTED();
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
// found in the LICENSE file. // found in the LICENSE file.
// //
// SurfaceWGL.h: WGL implementation of egl::Surface // WindowSurfaceWGL.h: WGL implementation of egl::Surface for windows
#ifndef LIBANGLE_RENDERER_GL_WGL_SURFACEWGL_H_ #ifndef LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
#define LIBANGLE_RENDERER_GL_WGL_SURFACEWGL_H_ #define LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
#include "libANGLE/renderer/gl/SurfaceGL.h" #include "libANGLE/renderer/gl/SurfaceGL.h"
...@@ -18,16 +18,14 @@ namespace rx ...@@ -18,16 +18,14 @@ namespace rx
class FunctionsWGL; class FunctionsWGL;
class SurfaceWGL : public SurfaceGL class WindowSurfaceWGL : public SurfaceGL
{ {
public: public:
SurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions); WindowSurfaceWGL(EGLNativeWindowType window, ATOM windowClass, int pixelFormat, HGLRC wglContext, const FunctionsWGL *functions);
~SurfaceWGL() override; ~WindowSurfaceWGL() override;
static SurfaceWGL *makeSurfaceWGL(SurfaceImpl *impl);
egl::Error initialize(); egl::Error initialize();
egl::Error makeCurrent(); egl::Error makeCurrent() override;
egl::Error swap() override; egl::Error swap() override;
egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override; egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override;
...@@ -56,4 +54,4 @@ class SurfaceWGL : public SurfaceGL ...@@ -56,4 +54,4 @@ class SurfaceWGL : public SurfaceGL
} }
#endif // LIBANGLE_RENDERER_GL_WGL_SURFACEWGL_H_ #endif // LIBANGLE_RENDERER_GL_WGL_WINDOWSURFACEWGL_H_
...@@ -418,8 +418,8 @@ ...@@ -418,8 +418,8 @@
'libANGLE/renderer/gl/wgl/DisplayWGL.h', 'libANGLE/renderer/gl/wgl/DisplayWGL.h',
'libANGLE/renderer/gl/wgl/FunctionsWGL.cpp', 'libANGLE/renderer/gl/wgl/FunctionsWGL.cpp',
'libANGLE/renderer/gl/wgl/FunctionsWGL.h', 'libANGLE/renderer/gl/wgl/FunctionsWGL.h',
'libANGLE/renderer/gl/wgl/SurfaceWGL.cpp', 'libANGLE/renderer/gl/wgl/WindowSurfaceWGL.cpp',
'libANGLE/renderer/gl/wgl/SurfaceWGL.h', 'libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h',
'libANGLE/renderer/gl/wgl/functionswgl_typedefs.h', 'libANGLE/renderer/gl/wgl/functionswgl_typedefs.h',
'libANGLE/renderer/gl/wgl/wgl_utils.cpp', 'libANGLE/renderer/gl/wgl/wgl_utils.cpp',
'libANGLE/renderer/gl/wgl/wgl_utils.h', 'libANGLE/renderer/gl/wgl/wgl_utils.h',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment