Change setScissor() to take in Vulkan coordinate convention.
* Cache dimensions in GLSurface and GLFramebuffer so that we don't have
to query properties through gl.
* Change argument to const Rect&
Bug: 114439058
Change-Id: Ia5ba9405af92819152e26e13508e0b57bc73f233
Test: SurfaceFlinger_Test, go/wm-smoke
diff --git a/services/surfaceflinger/RenderEngine/gl/GLSurface.cpp b/services/surfaceflinger/RenderEngine/gl/GLSurface.cpp
index ff9a252..104af56 100644
--- a/services/surfaceflinger/RenderEngine/gl/GLSurface.cpp
+++ b/services/surfaceflinger/RenderEngine/gl/GLSurface.cpp
@@ -16,6 +16,7 @@
#include "GLSurface.h"
+#include <android/native_window.h>
#include <log/log.h>
#include <ui/PixelFormat.h>
#include "GLES20RenderEngine.h"
@@ -41,11 +42,15 @@
if (mEGLSurface != EGL_NO_SURFACE) {
eglDestroySurface(mEGLDisplay, mEGLSurface);
mEGLSurface = EGL_NO_SURFACE;
+ mSurfaceWidth = 0;
+ mSurfaceHeight = 0;
}
mWindow = window;
if (mWindow) {
mEGLSurface = eglCreateWindowSurface(mEGLDisplay, mEGLConfig, mWindow, nullptr);
+ mSurfaceWidth = ANativeWindow_getWidth(window);
+ mSurfaceHeight = ANativeWindow_getHeight(window);
}
}
@@ -71,15 +76,6 @@
return value;
}
-EGLint GLSurface::querySurface(EGLint attrib) const {
- EGLint value;
- if (!eglQuerySurface(mEGLDisplay, mEGLSurface, attrib, &value)) {
- value = 0;
- }
-
- return value;
-}
-
int32_t GLSurface::queryRedSize() const {
return queryConfig(EGL_RED_SIZE);
}
@@ -96,12 +92,12 @@
return queryConfig(EGL_ALPHA_SIZE);
}
-int32_t GLSurface::queryWidth() const {
- return querySurface(EGL_WIDTH);
+int32_t GLSurface::getWidth() const {
+ return mSurfaceWidth;
}
-int32_t GLSurface::queryHeight() const {
- return querySurface(EGL_HEIGHT);
+int32_t GLSurface::getHeight() const {
+ return mSurfaceHeight;
}
} // namespace gl