| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/ozone/platform/egltest/ozone_platform_egltest.h" | 5 #include "ui/ozone/platform/egltest/ozone_platform_egltest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone { | 228 class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone { |
| 229 public: | 229 public: |
| 230 SurfaceFactoryEgltest(LibeglplatformShimLoader* eglplatform_shim) | 230 SurfaceFactoryEgltest(LibeglplatformShimLoader* eglplatform_shim) |
| 231 : eglplatform_shim_(eglplatform_shim) {} | 231 : eglplatform_shim_(eglplatform_shim) {} |
| 232 ~SurfaceFactoryEgltest() override {} | 232 ~SurfaceFactoryEgltest() override {} |
| 233 | 233 |
| 234 // SurfaceFactoryOzone: | 234 // SurfaceFactoryOzone: |
| 235 intptr_t GetNativeDisplay() override; | 235 intptr_t GetNativeDisplay() override; |
| 236 scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | 236 scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( |
| 237 gfx::AcceleratedWidget widget) override; | 237 gfx::AcceleratedWidget widget) override; |
| 238 const int32* GetEGLSurfaceProperties(const int32* desired_list) override; | 238 void* /* EGLConfig */ GetEGLSurfaceConfig(const EglConfigInfo& egl, |
| 239 SurfaceOzoneEGL* surface) override; |
| 240 |
| 239 bool LoadEGLGLES2Bindings( | 241 bool LoadEGLGLES2Bindings( |
| 240 AddGLLibraryCallback add_gl_library, | 242 AddGLLibraryCallback add_gl_library, |
| 241 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; | 243 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; |
| 242 | 244 |
| 243 private: | 245 private: |
| 244 LibeglplatformShimLoader* eglplatform_shim_; | 246 LibeglplatformShimLoader* eglplatform_shim_; |
| 245 }; | 247 }; |
| 246 | 248 |
| 247 intptr_t SurfaceFactoryEgltest::GetNativeDisplay() { | 249 intptr_t SurfaceFactoryEgltest::GetNativeDisplay() { |
| 248 return eglplatform_shim_->ShimGetNativeDisplay(); | 250 return eglplatform_shim_->ShimGetNativeDisplay(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 262 eglplatform_shim_->ShimQueryString(SHIM_GLES_LIBRARY); | 264 eglplatform_shim_->ShimQueryString(SHIM_GLES_LIBRARY); |
| 263 if (!egl_soname) | 265 if (!egl_soname) |
| 264 egl_soname = kDefaultEglSoname; | 266 egl_soname = kDefaultEglSoname; |
| 265 if (!gles_soname) | 267 if (!gles_soname) |
| 266 gles_soname = kDefaultGlesSoname; | 268 gles_soname = kDefaultGlesSoname; |
| 267 | 269 |
| 268 return ::ui::LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address, | 270 return ::ui::LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address, |
| 269 egl_soname, gles_soname); | 271 egl_soname, gles_soname); |
| 270 } | 272 } |
| 271 | 273 |
| 272 const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties( | 274 void* SurfaceFactoryEgltest::GetEGLSurfaceConfig(const EglConfigInfo& egl, |
| 273 const int32* desired_list) { | 275 SurfaceOzoneEGL* surface) { |
| 274 static const int32 broken_props[] = { | 276 static const int32 broken_props[] = { |
| 275 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | 277 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
| 276 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, | 278 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
| 277 EGL_NONE, | 279 EGL_NONE, |
| 278 }; | 280 }; |
| 279 return broken_props; | 281 return ChooseEGLConfig(egl, broken_props); |
| 280 } | 282 } |
| 281 | 283 |
| 282 // Test platform for EGL. | 284 // Test platform for EGL. |
| 283 // | 285 // |
| 284 // This is a tiny EGL-based platform. Creation of the native window is | 286 // This is a tiny EGL-based platform. Creation of the native window is |
| 285 // handled by a separate library called eglplatform_shim.so.1 because | 287 // handled by a separate library called eglplatform_shim.so.1 because |
| 286 // this itself is platform specific and we want to test out multiple | 288 // this itself is platform specific and we want to test out multiple |
| 287 // hardware platforms. | 289 // hardware platforms. |
| 288 class OzonePlatformEgltest : public OzonePlatform { | 290 class OzonePlatformEgltest : public OzonePlatform { |
| 289 public: | 291 public: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 383 |
| 382 } // namespace | 384 } // namespace |
| 383 | 385 |
| 384 OzonePlatform* CreateOzonePlatformEgltest() { | 386 OzonePlatform* CreateOzonePlatformEgltest() { |
| 385 OzonePlatformEgltest* platform = new OzonePlatformEgltest; | 387 OzonePlatformEgltest* platform = new OzonePlatformEgltest; |
| 386 platform->Initialize(); | 388 platform->Initialize(); |
| 387 return platform; | 389 return platform; |
| 388 } | 390 } |
| 389 | 391 |
| 390 } // namespace ui | 392 } // namespace ui |
| OLD | NEW |