gl_image.cc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // Copyright 2016 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 "ui/gl/gl_image.h"
  5. #include "base/notreached.h"
  6. #include "build/build_config.h"
  7. #include "ui/gl/gl_bindings.h"
  8. #if BUILDFLAG(IS_ANDROID)
  9. #include "base/android/scoped_hardware_buffer_fence_sync.h"
  10. #endif
  11. namespace gl {
  12. gfx::Size GLImage::GetSize() {
  13. NOTREACHED();
  14. return gfx::Size();
  15. }
  16. unsigned GLImage::GetInternalFormat() {
  17. NOTREACHED();
  18. return GL_NONE;
  19. }
  20. unsigned GLImage::GetDataFormat() {
  21. // GetInternalFormat() mostly returns unsized format and can be used both
  22. // as internal format and data format. However, GL_EXT_texture_norm16
  23. // follows ES3 semantics and only exposes a sized internalformat.
  24. unsigned internalformat = GetInternalFormat();
  25. switch (internalformat) {
  26. case GL_R16_EXT:
  27. return GL_RED_EXT;
  28. case GL_RG16_EXT:
  29. return GL_RG_EXT;
  30. case GL_RGB10_A2_EXT:
  31. return GL_RGBA;
  32. case GL_RGB_YCRCB_420_CHROMIUM:
  33. case GL_RGB_YCBCR_420V_CHROMIUM:
  34. case GL_RGB_YCBCR_P010_CHROMIUM:
  35. return GL_RGB;
  36. case GL_RED:
  37. case GL_RG:
  38. case GL_RGB:
  39. case GL_RGBA:
  40. case GL_BGRA_EXT:
  41. return internalformat;
  42. default:
  43. NOTREACHED();
  44. return GL_NONE;
  45. }
  46. }
  47. unsigned GLImage::GetDataType() {
  48. NOTREACHED();
  49. return GL_NONE;
  50. }
  51. GLImage::BindOrCopy GLImage::ShouldBindOrCopy() {
  52. NOTREACHED();
  53. return BIND;
  54. }
  55. bool GLImage::BindTexImage(unsigned target) {
  56. NOTREACHED();
  57. return false;
  58. }
  59. bool GLImage::BindTexImageWithInternalformat(unsigned target,
  60. unsigned internalformat) {
  61. NOTREACHED();
  62. return false;
  63. }
  64. void GLImage::ReleaseTexImage(unsigned target) {
  65. NOTREACHED();
  66. }
  67. bool GLImage::CopyTexImage(unsigned target) {
  68. NOTREACHED();
  69. return false;
  70. }
  71. bool GLImage::CopyTexSubImage(unsigned target,
  72. const gfx::Point& offset,
  73. const gfx::Rect& rect) {
  74. NOTREACHED();
  75. return false;
  76. }
  77. void GLImage::SetColorSpace(const gfx::ColorSpace& color_space) {
  78. color_space_ = color_space;
  79. }
  80. void GLImage::Flush() {
  81. NOTREACHED();
  82. }
  83. void GLImage::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
  84. uint64_t process_tracing_id,
  85. const std::string& dump_name) {
  86. NOTREACHED();
  87. }
  88. bool GLImage::EmulatingRGB() const {
  89. return false;
  90. }
  91. bool GLImage::IsInUseByWindowServer() const {
  92. return false;
  93. }
  94. void GLImage::DisableInUseByWindowServer() {
  95. NOTIMPLEMENTED();
  96. }
  97. GLImage::Type GLImage::GetType() const {
  98. return Type::NONE;
  99. }
  100. #if BUILDFLAG(IS_ANDROID)
  101. std::unique_ptr<base::android::ScopedHardwareBufferFenceSync>
  102. GLImage::GetAHardwareBuffer() {
  103. return nullptr;
  104. }
  105. #endif
  106. bool GLImage::HasMutableState() const {
  107. return true;
  108. }
  109. scoped_refptr<gfx::NativePixmap> GLImage::GetNativePixmap() {
  110. return nullptr;
  111. }
  112. void* GLImage::GetEGLImage() const {
  113. return nullptr;
  114. }
  115. } // namespace gl