Commit 45b4e74a by Geoff Lang

Move surface size information out of SurfaceImpl.

Some implementations need to query size information directly from their native window instead of listening for size events and storing the result. Also move mSwapInterval to SurfaceD3D since it doesn't need to be stored in all cases and there is no query for it. It no longer requires that the SurfaceImpl's derivation remembers to set mSwapInterval in setSwapInterval too. BUG=angle:658 Change-Id: I499c1b8b842254636fc25ff5f2a90107af8fe327 Reviewed-on: https://chromium-review.googlesource.com/242039Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarBrandon Jones <bajones@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent f6bf23fd
......@@ -13,15 +13,12 @@
namespace rx
{
SurfaceImpl::SurfaceImpl(egl::Display *display, const egl::Config *config, EGLint width, EGLint height,
SurfaceImpl::SurfaceImpl(egl::Display *display, const egl::Config *config,
EGLint fixedSize, EGLint postSubBufferSupported, EGLenum textureFormat,
EGLenum textureType, EGLClientBuffer shareHandle)
: mDisplay(display),
mConfig(config),
mWidth(width),
mHeight(height),
mFixedSize(fixedSize),
mSwapInterval(1),
mPostSubBufferSupported(postSubBufferSupported),
mTextureFormat(textureFormat),
mTextureTarget(textureType),
......
......@@ -24,7 +24,7 @@ namespace rx
class SurfaceImpl
{
public:
SurfaceImpl(egl::Display *display, const egl::Config *config, EGLint width, EGLint height,
SurfaceImpl(egl::Display *display, const egl::Config *config,
EGLint fixedSize, EGLint postSubBufferSupported, EGLenum textureFormat,
EGLenum textureType, EGLClientBuffer shareHandle);
virtual ~SurfaceImpl();
......@@ -41,8 +41,8 @@ class SurfaceImpl
virtual EGLNativeWindowType getWindowHandle() const = 0;
// width and height can change with client window resizing
EGLint getWidth() const { return mWidth; }
EGLint getHeight() const { return mHeight; }
virtual EGLint getWidth() const = 0;
virtual EGLint getHeight() const = 0;
const egl::Config *getConfig() const { return mConfig; }
EGLint isFixedSize() const { return mFixedSize; }
......@@ -56,8 +56,6 @@ class SurfaceImpl
SurfaceImpl()
: mDisplay(nullptr),
mConfig(nullptr),
mWidth(0),
mHeight(0),
mFixedSize(0),
mPostSubBufferSupported(0),
mTextureFormat(EGL_NONE),
......@@ -68,10 +66,7 @@ class SurfaceImpl
egl::Display *const mDisplay;
const egl::Config *mConfig; // EGL config surface was created with
EGLint mWidth;
EGLint mHeight;
EGLint mFixedSize;
EGLint mSwapInterval;
EGLint mPostSubBufferSupported;
// EGLint horizontalResolution; // Horizontal dot pitch
// EGLint verticalResolution; // Vertical dot pitch
......
......@@ -37,12 +37,15 @@ SurfaceD3D *SurfaceD3D::createFromWindow(RendererD3D *renderer, egl::Display *di
SurfaceD3D::SurfaceD3D(RendererD3D *renderer, egl::Display *display, const egl::Config *config, EGLint width, EGLint height,
EGLint fixedSize, EGLint postSubBufferSupported, EGLenum textureFormat,
EGLenum textureType, EGLClientBuffer shareHandle, EGLNativeWindowType window)
: SurfaceImpl(display, config, width, height, fixedSize, postSubBufferSupported, textureFormat, textureType, shareHandle),
: SurfaceImpl(display, config, fixedSize, postSubBufferSupported, textureFormat, textureType, shareHandle),
mRenderer(renderer),
mSwapChain(NULL),
mSwapIntervalDirty(true),
mWindowSubclassed(false),
mNativeWindow(window)
mNativeWindow(window),
mWidth(width),
mHeight(height),
mSwapInterval(1)
{
subclassWindow();
}
......@@ -372,6 +375,16 @@ void SurfaceD3D::setSwapInterval(EGLint interval)
mSwapIntervalDirty = true;
}
EGLint SurfaceD3D::getWidth() const
{
return mWidth;
}
EGLint SurfaceD3D::getHeight() const
{
return mHeight;
}
egl::Error SurfaceD3D::querySurfacePointerANGLE(EGLint attribute, void **value)
{
ASSERT(attribute == EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE);
......
......@@ -43,6 +43,9 @@ class SurfaceD3D : public SurfaceImpl
egl::Error releaseTexImage(EGLint buffer) override;
void setSwapInterval(EGLint interval) override;
EGLint getWidth() const override;
EGLint getHeight() const override;
// D3D implementations (some virtual to hack across DLL boundaries)
virtual SwapChainD3D *getSwapChain() const;
......@@ -73,6 +76,10 @@ class SurfaceD3D : public SurfaceImpl
bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking
NativeWindow mNativeWindow; // Handler for the Window that the surface is created for.
EGLint mWidth;
EGLint mHeight;
EGLint mSwapInterval;
};
......
......@@ -24,6 +24,8 @@ class MockSurfaceImpl : public rx::SurfaceImpl
MOCK_METHOD1(bindTexImage, egl::Error(EGLint));
MOCK_METHOD1(releaseTexImage, egl::Error(EGLint));
MOCK_METHOD1(setSwapInterval, void(EGLint));
MOCK_CONST_METHOD0(getWidth, EGLint());
MOCK_CONST_METHOD0(getHeight, EGLint());
MOCK_CONST_METHOD0(getWindowHandle, EGLNativeWindowType());
MOCK_METHOD0(destroy, void());
......
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