#include "gpu/command_buffer/service/shared_image/ozone_image_gl_textures_holder.h"
#include <memory>
#include "base/check.h"
#include "base/memory/scoped_refptr.h"
#include "gpu/command_buffer/service/gl_utils.h"
#include "gpu/command_buffer/service/shared_image/shared_image_backing.h"
#include "gpu/command_buffer/service/shared_image/shared_image_format_service_utils.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/native_pixmap.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/scoped_binders.h"
#include "ui/ozone/public/gl_ozone.h"
#include "ui/ozone/public/native_pixmap_gl_binding.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_factory_ozone.h"
namespace gpu {
namespace {
gfx::BufferFormat GetBufferFormatForPlane(viz::SharedImageFormat format,
int plane_index) { … }
gfx::BufferPlane GetBufferPlane(viz::SharedImageFormat format,
int plane_index) { … }
std::unique_ptr<ui::NativePixmapGLBinding> GetBinding(
scoped_refptr<gfx::NativePixmap> pixmap,
gfx::BufferFormat buffer_format,
gfx::BufferPlane buffer_plane,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GLuint& gl_texture_service_id,
GLenum& target) { … }
}
scoped_refptr<OzoneImageGLTexturesHolder>
OzoneImageGLTexturesHolder::CreateAndInitTexturesHolder(
SharedImageBacking* backing,
scoped_refptr<gfx::NativePixmap> pixmap) { … }
OzoneImageGLTexturesHolder::OzoneImageGLTexturesHolder() = default;
OzoneImageGLTexturesHolder::~OzoneImageGLTexturesHolder() = default;
void OzoneImageGLTexturesHolder::MarkContextLost() { … }
bool OzoneImageGLTexturesHolder::WasContextLost() { … }
void OzoneImageGLTexturesHolder::OnAddedToCache() { … }
void OzoneImageGLTexturesHolder::OnRemovedFromCache() { … }
size_t OzoneImageGLTexturesHolder::GetCacheCount() const { … }
void OzoneImageGLTexturesHolder::DestroyTextures() { … }
size_t OzoneImageGLTexturesHolder::GetNumberOfTextures() const { … }
bool OzoneImageGLTexturesHolder::Initialize(
SharedImageBacking* backing,
scoped_refptr<gfx::NativePixmap> pixmap) { … }
bool OzoneImageGLTexturesHolder::CreateAndStoreTexture(
SharedImageBacking* backing,
scoped_refptr<gfx::NativePixmap> pixmap,
gfx::BufferFormat buffer_format,
gfx::BufferPlane buffer_plane,
const gfx::Size& size) { … }
}