EGLWindow: remove the unused width and height

EGLWindow does nothing with it per se, but some code was relying on it
to store it. Add width and height to ANGLETest and SampleApplication
instead. Also fix a typo in PerfTestParams, widowWidth -> windowWidth.

BUG=angleproject:1105

Change-Id: I26da607a2e6342864b508a50ee3cf8944608f868
Reviewed-on: https://chromium-review.googlesource.com/287379
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/samples/sample_util/SampleApplication.cpp b/samples/sample_util/SampleApplication.cpp
index 268df64..5a3746a 100644
--- a/samples/sample_util/SampleApplication.cpp
+++ b/samples/sample_util/SampleApplication.cpp
@@ -10,9 +10,11 @@
 SampleApplication::SampleApplication(const std::string& name, size_t width, size_t height,
                                      EGLint glesMajorVersion, EGLint requestedRenderer)
     : mName(name),
+      mWidth(width),
+      mHeight(height),
       mRunning(false)
 {
-    mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, EGLPlatformParameters(requestedRenderer)));
+    mEGLWindow.reset(new EGLWindow(glesMajorVersion, EGLPlatformParameters(requestedRenderer)));
     mTimer.reset(CreateTimer());
     mOSWindow.reset(CreateOSWindow());
 
@@ -80,7 +82,7 @@
 
 int SampleApplication::run()
 {
-    if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight()))
+    if (!mOSWindow->initialize(mName, mWidth, mHeight))
     {
         return -1;
     }
diff --git a/samples/sample_util/SampleApplication.h b/samples/sample_util/SampleApplication.h
index 3acfb59..74a8701 100644
--- a/samples/sample_util/SampleApplication.h
+++ b/samples/sample_util/SampleApplication.h
@@ -48,6 +48,8 @@
 
   private:
     std::string mName;
+    size_t mWidth;
+    size_t mHeight;
     bool mRunning;
 
     std::unique_ptr<Timer> mTimer;
diff --git a/src/tests/gl_tests/PbufferTest.cpp b/src/tests/gl_tests/PbufferTest.cpp
index 7bfde32..35d91c9 100644
--- a/src/tests/gl_tests/PbufferTest.cpp
+++ b/src/tests/gl_tests/PbufferTest.cpp
@@ -130,7 +130,7 @@
     glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
     glClear(GL_COLOR_BUFFER_BIT);
     ASSERT_GL_NO_ERROR();
-    EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 0, 0, 255, 255);
+    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 255, 255);
 
     // Apply the Pbuffer and clear it to purple and verify
     eglMakeCurrent(window->getDisplay(), mPbuffer, mPbuffer, window->getContext());
@@ -145,7 +145,7 @@
     // Rebind the window surface and verify that it is still blue
     eglMakeCurrent(window->getDisplay(), window->getSurface(), window->getSurface(), window->getContext());
     ASSERT_EGL_SUCCESS();
-    EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 0, 0, 255, 255);
+    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 0, 0, 255, 255);
 }
 
 // Bind the Pbuffer to a texture and verify it renders correctly
@@ -190,7 +190,7 @@
     EXPECT_GL_NO_ERROR();
 
     eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER);
-    glViewport(0, 0, window->getWidth(), window->getHeight());
+    glViewport(0, 0, getWindowWidth(), getWindowHeight());
     ASSERT_EGL_SUCCESS();
 
     // Draw a quad and verify that it is purple
@@ -205,7 +205,7 @@
     ASSERT_EGL_SUCCESS();
 
     // Verify that purple was drawn
-    EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 255, 0, 255, 255);
+    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255);
 
     glDeleteTextures(1, &texture);
 }
@@ -308,13 +308,13 @@
     EXPECT_GL_NO_ERROR();
 
     eglBindTexImage(window->getDisplay(), mPbuffer, EGL_BACK_BUFFER);
-    glViewport(0, 0, window->getWidth(), window->getHeight());
+    glViewport(0, 0, getWindowWidth(), getWindowHeight());
     ASSERT_EGL_SUCCESS();
 
     // Redefine the texture
     unsigned int pixelValue = 0xFFFF00FF;
-    std::vector<unsigned int> pixelData(window->getWidth() * window->getHeight(), pixelValue);
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, window->getWidth(), window->getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixelData[0]);
+    std::vector<unsigned int> pixelData(getWindowWidth() * getWindowHeight(), pixelValue);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getWindowWidth(), getWindowHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixelData[0]);
 
     // Draw a quad and verify that it is magenta
     glUseProgram(mTextureProgram);
@@ -324,7 +324,7 @@
     EXPECT_GL_NO_ERROR();
 
     // Verify that magenta was drawn
-    EXPECT_PIXEL_EQ(window->getWidth() / 2, window->getHeight() / 2, 255, 0, 255, 255);
+    EXPECT_PIXEL_EQ(getWindowWidth() / 2, getWindowHeight() / 2, 255, 0, 255, 255);
 
     glDeleteTextures(1, &texture);
 }
diff --git a/src/tests/gl_tests/ProgramBinaryTest.cpp b/src/tests/gl_tests/ProgramBinaryTest.cpp
index 6ad5ba5..6bd63e6 100644
--- a/src/tests/gl_tests/ProgramBinaryTest.cpp
+++ b/src/tests/gl_tests/ProgramBinaryTest.cpp
@@ -200,7 +200,7 @@
 
     EGLWindow *createAndInitEGLWindow(angle::PlatformParameters &param)
     {
-        EGLWindow *eglWindow = new EGLWindow(1, 1, param.majorVersion, param.eglParameters);
+        EGLWindow *eglWindow = new EGLWindow(param.majorVersion, param.eglParameters);
         bool result = eglWindow->initializeGL(mOSWindow);
         if (result == false)
         {
@@ -438,4 +438,4 @@
                        // TODO: ANGLE issue 523
                        // Compiling a program with client version 3, saving the binary, then loading it with client version 2 should not work
                        // PlatformsWithLinkResult(ES3_D3D11(),         ES2_D3D11(),            false       )
-                       );
\ No newline at end of file
+                       );
diff --git a/src/tests/perf_tests/ANGLEPerfTest.cpp b/src/tests/perf_tests/ANGLEPerfTest.cpp
index b38be74..28b0ba0 100644
--- a/src/tests/perf_tests/ANGLEPerfTest.cpp
+++ b/src/tests/perf_tests/ANGLEPerfTest.cpp
@@ -105,13 +105,10 @@
 void ANGLERenderTest::SetUp()
 {
     mOSWindow = CreateOSWindow();
-    mEGLWindow = new EGLWindow(mTestParams.widowWidth,
-                               mTestParams.windowHeight,
-                               mTestParams.majorVersion,
-                               mTestParams.eglParameters);
+    mEGLWindow = new EGLWindow(mTestParams.majorVersion, mTestParams.eglParameters);
     mEGLWindow->setSwapInterval(0);
 
-    if (!mOSWindow->initialize(mName, mEGLWindow->getWidth(), mEGLWindow->getHeight()))
+    if (!mOSWindow->initialize(mName, mTestParams.windowWidth, mTestParams.windowHeight))
     {
         FAIL() << "Failed initializing OSWindow";
         return;
diff --git a/src/tests/perf_tests/ANGLEPerfTest.h b/src/tests/perf_tests/ANGLEPerfTest.h
index a08933e..dc1eff5 100644
--- a/src/tests/perf_tests/ANGLEPerfTest.h
+++ b/src/tests/perf_tests/ANGLEPerfTest.h
@@ -60,7 +60,7 @@
 {
     virtual std::string suffix() const;
 
-    EGLint widowWidth;
+    EGLint windowWidth;
     EGLint windowHeight;
 };
 
diff --git a/src/tests/perf_tests/BufferSubData.cpp b/src/tests/perf_tests/BufferSubData.cpp
index 7dcb91f..c141eda 100644
--- a/src/tests/perf_tests/BufferSubData.cpp
+++ b/src/tests/perf_tests/BufferSubData.cpp
@@ -24,7 +24,7 @@
         // Common default values
         majorVersion = 2;
         minorVersion = 0;
-        widowWidth = 512;
+        windowWidth = 512;
         windowHeight = 512;
         updateSize = 3000;
         bufferSize = 40000000;
diff --git a/src/tests/perf_tests/DrawCallPerf.cpp b/src/tests/perf_tests/DrawCallPerf.cpp
index b7984fe..8e4d954 100644
--- a/src/tests/perf_tests/DrawCallPerf.cpp
+++ b/src/tests/perf_tests/DrawCallPerf.cpp
@@ -24,7 +24,7 @@
     {
         majorVersion = 2;
         minorVersion = 0;
-        widowWidth = 256;
+        windowWidth = 256;
         windowHeight = 256;
         iterations = 50;
         numTris = 1;
diff --git a/src/tests/perf_tests/IndexConversionPerf.cpp b/src/tests/perf_tests/IndexConversionPerf.cpp
index 85ca968..5140374 100644
--- a/src/tests/perf_tests/IndexConversionPerf.cpp
+++ b/src/tests/perf_tests/IndexConversionPerf.cpp
@@ -185,7 +185,7 @@
     params.eglParameters = egl_platform::D3D11_NULL();
     params.majorVersion = 2;
     params.minorVersion = 0;
-    params.widowWidth = 256;
+    params.windowWidth = 256;
     params.windowHeight = 256;
     params.iterations = 15;
     params.numIndexTris = 3000;
diff --git a/src/tests/perf_tests/PointSprites.cpp b/src/tests/perf_tests/PointSprites.cpp
index e69b2b8..1e85f13 100644
--- a/src/tests/perf_tests/PointSprites.cpp
+++ b/src/tests/perf_tests/PointSprites.cpp
@@ -27,7 +27,7 @@
         // Common default params
         majorVersion = 2;
         minorVersion = 0;
-        widowWidth = 1280;
+        windowWidth = 1280;
         windowHeight = 720;
         iterations = 10;
         count = 10;
diff --git a/src/tests/perf_tests/TexSubImage.cpp b/src/tests/perf_tests/TexSubImage.cpp
index 5f595ad..9f43f0a 100644
--- a/src/tests/perf_tests/TexSubImage.cpp
+++ b/src/tests/perf_tests/TexSubImage.cpp
@@ -24,7 +24,7 @@
         // Common default parameters
         majorVersion = 2;
         minorVersion = 0;
-        widowWidth = 512;
+        windowWidth = 512;
         windowHeight = 512;
 
         imageWidth = 1024;
diff --git a/src/tests/test_utils/ANGLETest.cpp b/src/tests/test_utils/ANGLETest.cpp
index 5221a6a..2e6fdbd 100644
--- a/src/tests/test_utils/ANGLETest.cpp
+++ b/src/tests/test_utils/ANGLETest.cpp
@@ -3,9 +3,11 @@
 #include "OSWindow.h"
 
 ANGLETest::ANGLETest()
-    : mEGLWindow(nullptr)
+    : mEGLWindow(nullptr),
+      mWidth(0),
+      mHeight(0)
 {
-    mEGLWindow = new EGLWindow(1280, 720, GetParam().majorVersion, GetParam().eglParameters);
+    mEGLWindow = new EGLWindow(GetParam().majorVersion, GetParam().eglParameters);
 }
 
 ANGLETest::~ANGLETest()
@@ -15,7 +17,7 @@
 
 void ANGLETest::SetUp()
 {
-    if (!ResizeWindow(mEGLWindow->getWidth(), mEGLWindow->getHeight()))
+    if (!ResizeWindow(mWidth, mHeight))
     {
         FAIL() << "Failed to resize ANGLE test window.";
     }
@@ -33,7 +35,7 @@
     // 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
     // in their UIs
-    glViewport(0, 0, mEGLWindow->getWidth(), mEGLWindow->getHeight());
+    glViewport(0, 0, mWidth, mHeight);
 }
 
 void ANGLETest::TearDown()
@@ -144,12 +146,12 @@
 
 void ANGLETest::setWindowWidth(int width)
 {
-    mEGLWindow->setWidth(width);
+    mWidth = width;
 }
 
 void ANGLETest::setWindowHeight(int height)
 {
-    mEGLWindow->setHeight(height);
+    mHeight = height;
 }
 
 void ANGLETest::setConfigRedBits(int bits)
@@ -199,12 +201,12 @@
 
 int ANGLETest::getWindowWidth() const
 {
-    return mEGLWindow->getWidth();
+    return mWidth;
 }
 
 int ANGLETest::getWindowHeight() const
 {
-    return mEGLWindow->getHeight();
+    return mHeight;
 }
 
 bool ANGLETest::isMultisampleEnabled() const
diff --git a/src/tests/test_utils/ANGLETest.h b/src/tests/test_utils/ANGLETest.h
index 5897670..675d556 100644
--- a/src/tests/test_utils/ANGLETest.h
+++ b/src/tests/test_utils/ANGLETest.h
@@ -109,6 +109,8 @@
     bool destroyEGLContext();
 
     EGLWindow *mEGLWindow;
+    size_t mWidth;
+    size_t mHeight;
 
     static OSWindow *mOSWindow;
 };
diff --git a/src/tests/test_utils/angle_test_instantiate.cpp b/src/tests/test_utils/angle_test_instantiate.cpp
index 2809215..3e65375 100644
--- a/src/tests/test_utils/angle_test_instantiate.cpp
+++ b/src/tests/test_utils/angle_test_instantiate.cpp
@@ -63,7 +63,7 @@
 
         if (result)
         {
-            EGLWindow *eglWindow = new EGLWindow(1, 1, param.majorVersion, param.eglParameters);
+            EGLWindow *eglWindow = new EGLWindow(param.majorVersion, param.eglParameters);
             result = eglWindow->initializeGL(osWindow);
 
             eglWindow->destroyGL();
diff --git a/util/EGLWindow.cpp b/util/EGLWindow.cpp
index a7c34a3..278e824 100644
--- a/util/EGLWindow.cpp
+++ b/util/EGLWindow.cpp
@@ -69,14 +69,12 @@
            (a.deviceType == b.deviceType);
 }
 
-EGLWindow::EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform)
+EGLWindow::EGLWindow(EGLint glesMajorVersion, const EGLPlatformParameters &platform)
     : mDisplay(EGL_NO_DISPLAY),
       mSurface(EGL_NO_SURFACE),
       mContext(EGL_NO_CONTEXT),
       mClientVersion(glesMajorVersion),
       mPlatform(platform),
-      mWidth(width),
-      mHeight(height),
       mRedBits(-1),
       mGreenBits(-1),
       mBlueBits(-1),
diff --git a/util/EGLWindow.h b/util/EGLWindow.h
index 5da5993..30d0eca 100644
--- a/util/EGLWindow.h
+++ b/util/EGLWindow.h
@@ -50,13 +50,11 @@
 class EGLWindow : angle::NonCopyable
 {
   public:
-    EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform);
+    EGLWindow(EGLint glesMajorVersion, const EGLPlatformParameters &platform);
 
     ~EGLWindow();
 
     void setClientVersion(EGLint glesMajorVersion) { mClientVersion = glesMajorVersion; }
-    void setWidth(size_t width) { mWidth = width; }
-    void setHeight(size_t height) { mHeight = height; }
     void setConfigRedBits(int bits) { mRedBits = bits; }
     void setConfigGreenBits(int bits) { mGreenBits = bits; }
     void setConfigBlueBits(int bits) { mBlueBits = bits; }
@@ -76,8 +74,6 @@
     EGLDisplay getDisplay() const;
     EGLSurface getSurface() const;
     EGLContext getContext() const;
-    size_t getWidth() const { return mWidth; }
-    size_t getHeight() const { return mHeight; }
     int getConfigRedBits() const { return mRedBits; }
     int getConfigGreenBits() const { return mGreenBits; }
     int getConfigBlueBits() const { return mBlueBits; }
@@ -99,8 +95,6 @@
 
     EGLint mClientVersion;
     EGLPlatformParameters mPlatform;
-    size_t mWidth;
-    size_t mHeight;
     int mRedBits;
     int mGreenBits;
     int mBlueBits;