#include "components/viz/service/display_embedder/image_context_impl.h"
#include <utility>
#include "base/check.h"
#include "base/check_op.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_factory.h"
#include "gpu/command_buffer/service/shared_image/shared_image_format_service_utils.h"
#include "gpu/command_buffer/service/skia_utils.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/gpu/GpuTypes.h"
#include "third_party/skia/include/gpu/GrContextThreadSafeProxy.h"
#include "third_party/skia/include/gpu/graphite/Recorder.h"
#include "third_party/skia/include/gpu/graphite/Surface.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
namespace {
SkColor4f GetFallbackColorForPlane(viz::SharedImageFormat format,
int plane_index) { … }
}
namespace viz {
ImageContextImpl::ImageContextImpl(
const gpu::MailboxHolder& mailbox_holder,
const gfx::Size& size,
SharedImageFormat format,
bool maybe_concurrent_reads,
const std::optional<gpu::VulkanYCbCrInfo>& ycbcr_info,
sk_sp<SkColorSpace> color_space,
bool is_for_render_pass,
bool raw_draw_if_possible)
: … { … }
ImageContextImpl::~ImageContextImpl() { … }
void ImageContextImpl::OnContextLost() { … }
void ImageContextImpl::SetPromiseImageTextures(
std::vector<sk_sp<GrPromiseImageTexture>> promise_image_textures) { … }
void ImageContextImpl::DeleteFallbackTextures() { … }
void ImageContextImpl::CreateFallbackImage(
gpu::SharedContextState* context_state) { … }
void ImageContextImpl::BeginAccessIfNecessary(
gpu::SharedContextState* context_state,
gpu::SharedImageRepresentationFactory* representation_factory,
std::vector<GrBackendSemaphore>* begin_semaphores,
std::vector<GrBackendSemaphore>* end_semaphores) { … }
bool ImageContextImpl::BeginRasterAccess(
gpu::SharedImageRepresentationFactory* representation_factory) { … }
bool ImageContextImpl::BeginAccessIfNecessaryInternal(
gpu::SharedContextState* context_state,
gpu::SharedImageRepresentationFactory* representation_factory,
std::vector<GrBackendSemaphore>* begin_semaphores,
std::vector<GrBackendSemaphore>* end_semaphores) { … }
void ImageContextImpl::EndAccessIfNecessary() { … }
}