yuv_to_rgb_converter.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #ifndef UI_GL_YUV_TO_RGB_CONVERTER_H_
  5. #define UI_GL_YUV_TO_RGB_CONVERTER_H_
  6. #include "ui/gfx/geometry/size.h"
  7. namespace gfx {
  8. class ColorSpace;
  9. } // namespace gfx
  10. namespace gl {
  11. struct GLVersionInfo;
  12. class YUVToRGBConverter {
  13. public:
  14. explicit YUVToRGBConverter(const GLVersionInfo& gl_version_info,
  15. const gfx::ColorSpace& color_space);
  16. ~YUVToRGBConverter();
  17. // The input Y and UV textures should be bound to these texture objects
  18. // prior to calling CopyYUV420ToRGB.
  19. unsigned y_texture() const { return y_texture_; }
  20. unsigned uv_texture() const { return uv_texture_; }
  21. void CopyYUV420ToRGB(unsigned target,
  22. const gfx::Size& size,
  23. unsigned rgb_texture,
  24. unsigned rgb_texture_type);
  25. private:
  26. unsigned framebuffer_ = 0;
  27. unsigned vertex_shader_ = 0;
  28. unsigned fragment_shader_ = 0;
  29. unsigned program_ = 0;
  30. int size_location_ = -1;
  31. unsigned vertex_buffer_ = 0;
  32. unsigned y_texture_ = 0;
  33. unsigned uv_texture_ = 0;
  34. unsigned vertex_array_object_ = 0;
  35. unsigned source_texture_target_ = 0;
  36. bool has_get_tex_level_parameter_ = false;
  37. bool has_robust_resource_init_ = false;
  38. bool has_sampler_objects_ = false;
  39. };
  40. } // namespace gl
  41. #endif // UI_GL_YUV_TO_RGB_CONVERTER_H_