summaryrefslogtreecommitdiff
path: root/cmds/flatland/GLHelper.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2020-09-09 20:21:16 -0700
committer Xin Li <delphij@google.com> 2020-09-09 20:21:16 -0700
commitac07d0f5ab16bb9e8bbbabb589d1c7d36817baa9 (patch)
treef7110d50445c67a337105034b1f2db3946a88fef /cmds/flatland/GLHelper.cpp
parent171cac1b603e4bb83412eb596d05a500af5d7a76 (diff)
parentc83049d93712f12279dbeabfa1857c1921804979 (diff)
Merge Android R
Bug: 168057903 Merged-In: I1428ead11c6c2d6fd107a014df0082fdbfa9ba8a Change-Id: I7e084a4c5a3fd06152ea6f1bfe17c53f95faba79
Diffstat (limited to 'cmds/flatland/GLHelper.cpp')
-rw-r--r--cmds/flatland/GLHelper.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp
index d398559ee8..3a3df08534 100644
--- a/cmds/flatland/GLHelper.cpp
+++ b/cmds/flatland/GLHelper.cpp
@@ -14,15 +14,14 @@
* limitations under the License.
*/
+#include "GLHelper.h"
+
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-
-#include <ui/DisplayInfo.h>
#include <gui/SurfaceComposerClient.h>
+#include <ui/DisplayConfig.h>
-#include "GLHelper.h"
-
- namespace android {
+namespace android {
GLHelper::GLHelper() :
mDisplay(EGL_NO_DISPLAY),
@@ -228,15 +227,15 @@ bool GLHelper::computeWindowScale(uint32_t w, uint32_t h, float* scale) {
return false;
}
- DisplayInfo info;
- status_t err = mSurfaceComposerClient->getDisplayInfo(dpy, &info);
+ DisplayConfig config;
+ status_t err = mSurfaceComposerClient->getActiveDisplayConfig(dpy, &config);
if (err != NO_ERROR) {
- fprintf(stderr, "SurfaceComposer::getDisplayInfo failed: %#x\n", err);
+ fprintf(stderr, "SurfaceComposer::getActiveDisplayConfig failed: %#x\n", err);
return false;
}
- float scaleX = float(info.w) / float(w);
- float scaleY = float(info.h) / float(h);
+ float scaleX = static_cast<float>(config.resolution.getWidth()) / w;
+ float scaleY = static_cast<float>(config.resolution.getHeight()) / h;
*scale = scaleX < scaleY ? scaleX : scaleY;
return true;