#include "gpu/command_buffer/service/shared_image/wrapped_sk_image_backing.h"
#include <utility>
#include "base/logging.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/shared_image/shared_image_representation.h"
#include "gpu/command_buffer/service/skia_utils.h"
#include "gpu/ipc/common/gpu_client_ids.h"
#include "third_party/skia/include/core/SkAlphaType.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkColorType.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/core/SkSurfaceProps.h"
#include "third_party/skia/include/core/SkTextureCompressionType.h"
#include "third_party/skia/include/gpu/GpuTypes.h"
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
namespace gpu {
namespace {
std::string GetLabel(const std::string& debug_label) { … }
}
class WrappedSkImageBacking::SkiaImageRepresentationImpl
: public SkiaGaneshImageRepresentation { … };
WrappedSkImageBacking::WrappedSkImageBacking(
base::PassKey<WrappedSkImageBackingFactory>,
const Mailbox& mailbox,
viz::SharedImageFormat format,
const gfx::Size& size,
const gfx::ColorSpace& color_space,
GrSurfaceOrigin surface_origin,
SkAlphaType alpha_type,
gpu::SharedImageUsageSet usage,
std::string debug_label,
scoped_refptr<SharedContextState> context_state,
const bool thread_safe)
: … { … }
WrappedSkImageBacking::~WrappedSkImageBacking() { … }
bool WrappedSkImageBacking::Initialize(const std::string& debug_label) { … }
bool WrappedSkImageBacking::InitializeWithData(
const std::string& debug_label,
base::span<const uint8_t> pixels) { … }
SharedImageBackingType WrappedSkImageBacking::GetType() const { … }
void WrappedSkImageBacking::Update(std::unique_ptr<gfx::GpuFence> in_fence) { … }
bool WrappedSkImageBacking::UploadFromMemory(
const std::vector<SkPixmap>& pixmaps) { … }
std::vector<sk_sp<GrPromiseImageTexture>>
WrappedSkImageBacking::GetPromiseTextures() { … }
SkColorType WrappedSkImageBacking::GetSkColorType(int plane_index) { … }
std::vector<sk_sp<SkSurface>> WrappedSkImageBacking::GetSkSurfaces(
int final_msaa_count,
const SkSurfaceProps& surface_props,
scoped_refptr<SharedContextState> context_state) { … }
std::unique_ptr<SkiaGaneshImageRepresentation>
WrappedSkImageBacking::ProduceSkiaGanesh(
SharedImageManager* manager,
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) { … }
WrappedSkImageBacking::TextureHolder::TextureHolder() = default;
WrappedSkImageBacking::TextureHolder::TextureHolder(TextureHolder&& other) =
default;
WrappedSkImageBacking::TextureHolder&
WrappedSkImageBacking::TextureHolder::operator=(TextureHolder&& other) =
default;
WrappedSkImageBacking::TextureHolder::~TextureHolder() = default;
}