Commit b44440d8 by Corentin Wallez

ANGLETest::SetUp: resize the window only if needed.

This avoids a flickering of the window at the start of every test. Reland with a speculative fix for ViewportTest BUG=angleproject:1105 Change-Id: I83e89881de5b6f58cfb3e14cbe324fd9547f2836 Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/288533Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent b4191c3e
...@@ -17,20 +17,30 @@ ANGLETest::~ANGLETest() ...@@ -17,20 +17,30 @@ ANGLETest::~ANGLETest()
void ANGLETest::SetUp() void ANGLETest::SetUp()
{ {
if (!ResizeWindow(mWidth, mHeight)) // Resize the window before creating the context so that the first make current
// sets the viewport and scissor box to the right size.
bool needSwap = false;
if (mOSWindow->getWidth() != mWidth || mOSWindow->getHeight() != mHeight)
{
if (!mOSWindow->resize(mWidth, mHeight))
{ {
FAIL() << "Failed to resize ANGLE test window."; FAIL() << "Failed to resize ANGLE test window.";
} }
needSwap = true;
}
if (!createEGLContext()) if (!createEGLContext())
{ {
FAIL() << "egl context creation failed."; FAIL() << "egl context creation failed.";
} }
if (needSwap)
{
// Swap the buffers so that the default framebuffer picks up the resize // Swap the buffers so that the default framebuffer picks up the resize
// which will allow follow-up test code to assume the framebuffer covers // which will allow follow-up test code to assume the framebuffer covers
// the whole window. // the whole window.
swapBuffers(); swapBuffers();
}
// This Viewport command is not strictly necessary but we add it so that programs // This Viewport command is not strictly necessary but we add it so that programs
// taking OpenGL traces can guess the size of the default framebuffer and show it // taking OpenGL traces can guess the size of the default framebuffer and show it
...@@ -250,11 +260,6 @@ bool ANGLETest::DestroyTestWindow() ...@@ -250,11 +260,6 @@ bool ANGLETest::DestroyTestWindow()
return true; return true;
} }
bool ANGLETest::ResizeWindow(int width, int height)
{
return mOSWindow->resize(width, height);
}
void ANGLETest::SetWindowVisible(bool isVisible) void ANGLETest::SetWindowVisible(bool isVisible)
{ {
mOSWindow->setVisible(isVisible); mOSWindow->setVisible(isVisible);
......
...@@ -67,7 +67,6 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters> ...@@ -67,7 +67,6 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
public: public:
static bool InitTestWindow(); static bool InitTestWindow();
static bool DestroyTestWindow(); static bool DestroyTestWindow();
static bool ResizeWindow(int width, int height);
static void SetWindowVisible(bool isVisible); static void SetWindowVisible(bool isVisible);
protected: protected:
......
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