surface.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright (c) 2011 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.
  4. #include "gpu/gles2_conform_support/egl/surface.h"
  5. #include "ui/gl/gl_surface.h"
  6. namespace gles2_conform_support {
  7. namespace egl {
  8. Surface::Surface(gl::GLSurface* gl_surface, const Config* config)
  9. : is_current_in_some_thread_(false),
  10. gl_surface_(gl_surface),
  11. config_(config) {}
  12. Surface::~Surface() = default;
  13. gl::GLSurface* Surface::gl_surface() const {
  14. return gl_surface_.get();
  15. }
  16. const Config* Surface::config() const {
  17. return config_;
  18. }
  19. bool Surface::ValidatePbufferAttributeList(const EGLint* attrib_list) {
  20. if (attrib_list) {
  21. for (int i = 0; attrib_list[i] != EGL_NONE; i += 2) {
  22. switch (attrib_list[i]) {
  23. case EGL_WIDTH:
  24. case EGL_HEIGHT:
  25. break;
  26. default:
  27. return false;
  28. }
  29. }
  30. }
  31. return true;
  32. }
  33. bool Surface::ValidateWindowAttributeList(const EGLint* attrib_list) {
  34. if (attrib_list) {
  35. if (attrib_list[0] != EGL_NONE)
  36. return false;
  37. }
  38. return true;
  39. }
  40. } // namespace egl
  41. } // namespace gles2_conform_support