#include "gpu/command_buffer/service/shared_image/raw_draw_image_backing.h"
#include "base/logging.h"
#include "base/types/optional_util.h"
#include "cc/paint/paint_op_buffer.h"
#include "components/viz/common/resources/resource_sizes.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 "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/gpu/GpuTypes.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/ganesh/SkSurfaceGanesh.h"
#include "third_party/skia/include/private/chromium/GrPromiseImageTexture.h"
namespace gpu {
class RawDrawImageBacking::RasterRawDrawImageRepresentation
: public RasterImageRepresentation { … };
class RawDrawImageBacking::SkiaRawDrawImageRepresentation
: public SkiaGaneshImageRepresentation { … };
RawDrawImageBacking::RawDrawImageBacking(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)
: … { … }
RawDrawImageBacking::~RawDrawImageBacking() { … }
SharedImageBackingType RawDrawImageBacking::GetType() const { … }
void RawDrawImageBacking::Update(std::unique_ptr<gfx::GpuFence> in_fence) { … }
std::unique_ptr<RasterImageRepresentation> RawDrawImageBacking::ProduceRaster(
SharedImageManager* manager,
MemoryTypeTracker* tracker) { … }
std::unique_ptr<SkiaGaneshImageRepresentation>
RawDrawImageBacking::ProduceSkiaGanesh(
SharedImageManager* manager,
MemoryTypeTracker* tracker,
scoped_refptr<SharedContextState> context_state) { … }
void RawDrawImageBacking::ResetPaintOpBuffer() { … }
bool RawDrawImageBacking::CreateBackendTextureAndFlushPaintOps(bool flush) { … }
void RawDrawImageBacking::DestroyBackendTexture() { … }
cc::PaintOpBuffer* RawDrawImageBacking::BeginRasterWriteAccess(
scoped_refptr<SharedContextState> context_state,
int final_msaa_count,
const SkSurfaceProps& surface_props,
const std::optional<SkColor4f>& clear_color,
bool visible) { … }
void RawDrawImageBacking::EndRasterWriteAccess(base::OnceClosure callback) { … }
cc::PaintOpBuffer* RawDrawImageBacking::BeginRasterReadAccess(
std::optional<SkColor4f>& clear_color) { … }
sk_sp<GrPromiseImageTexture> RawDrawImageBacking::BeginSkiaReadAccess() { … }
void RawDrawImageBacking::EndReadAccess() { … }
}