[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / gpu / khronos_glcts_support / native / egl_native_windowless.cc
blob1a575a5010468e617b7e797d2bc0bb759a1fd4bb
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Using egl_native from gles2_conform_support
6 // TODO: We may want to phase out the old gles2_conform support in preference
7 // of this implementation. So eventually we'll need to move the egl_native
8 // stuff here or to a shareable location/path.
9 #include "gpu/gles2_conform_support/egl/display.h"
11 #include "third_party/khronos_glcts/framework/egl/tcuEglPlatform.hpp"
13 namespace egl {
14 namespace native {
15 namespace windowless {
17 class Surface : public tcu::egl::WindowSurface {
18 public:
19 Surface(tcu::egl::Display& display,
20 EGLConfig config,
21 const EGLint* attribList,
22 int width,
23 int height)
24 : tcu::egl::WindowSurface(display,
25 config,
26 (EGLNativeWindowType)NULL,
27 attribList),
28 width_(width),
29 height_(height) {}
31 int getWidth() const { return width_; }
33 int getHeight() const { return height_; }
35 private:
36 const int width_;
37 const int height_;
40 class Window : public tcu::NativeWindow {
41 public:
42 Window(tcu::egl::Display& display,
43 EGLConfig config,
44 const EGLint* attribList,
45 int width,
46 int height)
47 : tcu::NativeWindow::NativeWindow(),
48 eglDisplay_(display),
49 surface_(display, config, attribList, width, height) {}
51 virtual ~Window() {}
53 tcu::egl::Display& getEglDisplay() { return eglDisplay_; }
55 tcu::egl::WindowSurface& getEglSurface() { return surface_; }
57 void processEvents() { return; }
59 private:
60 tcu::egl::Display& eglDisplay_;
61 Surface surface_;
64 class Platform : public tcu::EglPlatform {
65 public:
66 Platform() : tcu::EglPlatform::EglPlatform() {}
68 virtual ~Platform() {}
70 tcu::NativeWindow* createWindow(tcu::NativeDisplay& dpy,
71 EGLConfig config,
72 const EGLint* attribList,
73 int width,
74 int height,
75 qpVisibility visibility) {
76 tcu::egl::Display& eglDisplay = dpy.getEglDisplay();
77 egl::Display* display =
78 static_cast<egl::Display*>(eglDisplay.getEGLDisplay());
79 display->SetCreateOffscreen(width, height);
80 return new Window(eglDisplay, config, attribList, width, height);
84 } // namespace windowless
85 } // namespace native
86 } // namespace egl
88 tcu::Platform* createPlatform(void) {
89 return new egl::native::windowless::Platform();