#include "components/viz/service/display_embedder/skia_render_copy_results.h"
#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.h"
#include "third_party/libyuv/include/libyuv/planar_functions.h"
#include "third_party/skia/include/core/SkPixelRef.h"
namespace viz {
AsyncReadResultHelper::AsyncReadResultHelper(
SkiaOutputSurfaceImplOnGpu* impl_on_gpu,
std::unique_ptr<const SkSurface::AsyncReadResult> result)
: … { … }
AsyncReadResultHelper::~AsyncReadResultHelper() { … }
base::Lock& AsyncReadResultHelper::lock() const { … }
void AsyncReadResultHelper::reset() { … }
const SkSurface::AsyncReadResult* AsyncReadResultHelper::operator->() const { … }
operator bool()
void AsyncReadResultHelper::AssertLockAcquired() const { … }
ReadPixelsContext::ReadPixelsContext(
std::unique_ptr<CopyOutputRequest> request,
const gfx::Rect& result_rect,
const gfx::ColorSpace& color_space,
base::WeakPtr<SkiaOutputSurfaceImplOnGpu> impl_on_gpu)
: … { … }
ReadPixelsContext::~ReadPixelsContext() = default;
CopyOutputResultSkiaRGBA::CopyOutputResultSkiaRGBA(
SkiaOutputSurfaceImplOnGpu* impl,
const gfx::Rect& rect,
std::unique_ptr<const SkSurface::AsyncReadResult> result,
const gfx::ColorSpace& color_space)
: … { … }
CopyOutputResultSkiaRGBA::~CopyOutputResultSkiaRGBA() { … }
void CopyOutputResultSkiaRGBA::OnReadbackDone(
void* c,
std::unique_ptr<const SkSurface::AsyncReadResult> async_result) { … }
const SkBitmap& CopyOutputResultSkiaRGBA::AsSkBitmap() const { … }
bool CopyOutputResultSkiaRGBA::LockSkBitmap() const { … }
void CopyOutputResultSkiaRGBA::UnlockSkBitmap() const { … }
ReadbackContextTexture::ReadbackContextTexture(
base::WeakPtr<SkiaOutputSurfaceImplOnGpu> impl_on_gpu,
std::unique_ptr<CopyOutputRequest> request,
const gfx::Rect& result_rect,
const gpu::Mailbox& mailbox,
const gfx::ColorSpace& color_space)
: … { … }
ReadbackContextTexture::~ReadbackContextTexture() = default;
void ReadbackContextTexture::OnMailboxReady(GrGpuFinishedContext c) { … }
void ReadbackContextTexture::OnMailboxReadyInternal() { … }
CopyOutputResultSkiaYUV::CopyOutputResultSkiaYUV(
SkiaOutputSurfaceImplOnGpu* impl,
const gfx::Rect& rect,
std::unique_ptr<const SkSurface::AsyncReadResult> result)
: … { … }
CopyOutputResultSkiaYUV::~CopyOutputResultSkiaYUV() = default;
void CopyOutputResultSkiaYUV::OnReadbackDone(
void* c,
std::unique_ptr<const SkSurface::AsyncReadResult> async_result) { … }
bool CopyOutputResultSkiaYUV::ReadI420Planes(uint8_t* y_out,
int y_out_stride,
uint8_t* u_out,
int u_out_stride,
uint8_t* v_out,
int v_out_stride) const { … }
NV12PlanesReadbackContext::NV12PlanesReadbackContext(
base::WeakPtr<SkiaOutputSurfaceImplOnGpu> impl_on_gpu,
std::unique_ptr<CopyOutputRequest> request,
const gfx::Rect& result_rect)
: … { … }
NV12PlanesReadbackContext::~NV12PlanesReadbackContext() = default;
void NV12PlanesReadbackContext::PlaneReadbackDone(
int plane_index,
std::unique_ptr<const SkSurface::AsyncReadResult> async_result) { … }
NV12PlanePixelReadContext::NV12PlanePixelReadContext(
scoped_refptr<NV12PlanesReadbackContext> nv12_planes_readback,
int plane_index)
: … { … }
NV12PlanePixelReadContext::~NV12PlanePixelReadContext() = default;
CopyOutputResultSkiaNV12::CopyOutputResultSkiaNV12(
SkiaOutputSurfaceImplOnGpu* impl,
const gfx::Rect& rect,
std::array<std::unique_ptr<const SkImage::AsyncReadResult>, 2>
async_read_results)
: … { … }
CopyOutputResultSkiaNV12::~CopyOutputResultSkiaNV12() = default;
bool CopyOutputResultSkiaNV12::ReadNV12Planes(uint8_t* y_out,
int y_out_stride,
uint8_t* uv_out,
int uv_out_stride) const { … }
void CopyOutputResultSkiaNV12::OnNV12PlaneReadbackDone(
void* c,
std::unique_ptr<const SkSurface::AsyncReadResult> async_result) { … }
}