gl_surface_overlay.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2015 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_GL_SURFACE_OVERLAY_H_
  5. #define UI_GL_GL_SURFACE_OVERLAY_H_
  6. #include "base/memory/ref_counted.h"
  7. #include "ui/gfx/gpu_fence.h"
  8. #include "ui/gfx/native_widget_types.h"
  9. #include "ui/gfx/overlay_plane_data.h"
  10. #include "ui/gl/gl_export.h"
  11. #include "ui/gl/gl_image.h"
  12. namespace gfx {
  13. class GpuFence;
  14. } // namespace gfx
  15. namespace gl {
  16. // For saving the properties of a GLImage overlay plane and scheduling it later.
  17. class GL_EXPORT GLSurfaceOverlay {
  18. public:
  19. GLSurfaceOverlay(GLImage* image,
  20. std::unique_ptr<gfx::GpuFence> gpu_fence,
  21. const gfx::OverlayPlaneData& overlay_plane_data);
  22. GLSurfaceOverlay(GLSurfaceOverlay&& other);
  23. ~GLSurfaceOverlay();
  24. // Schedule the image as an overlay plane to be shown at swap time for
  25. // |widget|.
  26. //
  27. // This should be called at most once.
  28. bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget);
  29. void Flush() const;
  30. gfx::GpuFence* gpu_fence() const { return gpu_fence_.get(); }
  31. int z_order() const { return overlay_plane_data_.z_order; }
  32. private:
  33. scoped_refptr<GLImage> image_;
  34. std::unique_ptr<gfx::GpuFence> gpu_fence_;
  35. gfx::OverlayPlaneData overlay_plane_data_;
  36. };
  37. } // namespace gl
  38. #endif // UI_GL_GL_SURFACE_OVERLAY_H_