#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkPoint.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/ganesh/GrRecordingContext.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrGpuResourcePriv.h"
#include "src/gpu/ganesh/GrImageInfo.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrRenderTargetProxy.h"
#include "src/gpu/ganesh/GrRenderTask.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrSurface.h"
#include "src/gpu/ganesh/GrSurfaceProxyPriv.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/GrTexture.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/SurfaceContext.h"
#include "src/gpu/ganesh/SurfaceFillContext.h"
#include <memory>
#ifdef SK_DEBUG
#include "include/gpu/ganesh/GrDirectContext.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
static bool is_valid_lazy(const SkISize& dimensions, SkBackingFit fit) { … }
static bool is_valid_non_lazy(SkISize dimensions) { … }
#endif
GrSurfaceProxy::LazyCallbackResult::LazyCallbackResult(sk_sp<GrSurface> surf,
bool releaseCallback,
LazyInstantiationKeyMode mode)
: … { … }
GrSurfaceProxy::LazyCallbackResult::LazyCallbackResult(sk_sp<GrTexture> tex)
: … { … }
GrSurfaceProxy::GrSurfaceProxy(const GrBackendFormat& format,
SkISize dimensions,
SkBackingFit fit,
skgpu::Budgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator,
std::string_view label)
: … { … }
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
SkISize dimensions,
SkBackingFit fit,
skgpu::Budgeted budgeted,
GrProtected isProtected,
GrInternalSurfaceFlags surfaceFlags,
UseAllocator useAllocator,
std::string_view label)
: … { … }
GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface,
SkBackingFit fit,
UseAllocator useAllocator)
: … { … }
GrSurfaceProxy::~GrSurfaceProxy() { … }
sk_sp<GrSurface> GrSurfaceProxy::createSurfaceImpl(GrResourceProvider* resourceProvider,
int sampleCnt,
GrRenderable renderable,
skgpu::Mipmapped mipmapped) const { … }
bool GrSurfaceProxy::canSkipResourceAllocator() const { … }
void GrSurfaceProxy::assign(sk_sp<GrSurface> surface) { … }
bool GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider,
int sampleCnt,
GrRenderable renderable,
skgpu::Mipmapped mipmapped,
const skgpu::UniqueKey* uniqueKey) { … }
void GrSurfaceProxy::deinstantiate() { … }
void GrSurfaceProxy::computeScratchKey(const GrCaps& caps, skgpu::ScratchKey* key) const { … }
SkISize GrSurfaceProxy::backingStoreDimensions() const { … }
bool GrSurfaceProxy::isFunctionallyExact() const { … }
bool GrSurfaceProxy::isFormatCompressed(const GrCaps* caps) const { … }
#ifdef SK_DEBUG
void GrSurfaceProxy::validate(GrContext_Base* context) const { … }
#endif
sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* rContext,
sk_sp<GrSurfaceProxy> src,
GrSurfaceOrigin origin,
skgpu::Mipmapped mipmapped,
SkIRect srcRect,
SkBackingFit fit,
skgpu::Budgeted budgeted,
std::string_view label,
RectsMustMatch rectsMustMatch,
sk_sp<GrRenderTask>* outTask) { … }
sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrRecordingContext* context,
sk_sp<GrSurfaceProxy> src,
GrSurfaceOrigin origin,
skgpu::Mipmapped mipmapped,
SkBackingFit fit,
skgpu::Budgeted budgeted,
std::string_view label,
sk_sp<GrRenderTask>* outTask) { … }
#if defined(GPU_TEST_UTILS)
int32_t GrSurfaceProxy::testingOnly_getBackingRefCnt() const {
if (fTarget) {
return fTarget->testingOnly_getRefCnt();
}
return -1;
}
GrInternalSurfaceFlags GrSurfaceProxy::testingOnly_getFlags() const {
return fSurfaceFlags;
}
SkString GrSurfaceProxy::dump() const {
SkString tmp;
tmp.appendf("proxyID: %u - surfaceID: %u",
this->uniqueID().asUInt(),
this->peekSurface() ? this->peekSurface()->uniqueID().asUInt()
: -1);
return tmp;
}
#endif
void GrSurfaceProxyPriv::exactify() { … }
bool GrSurfaceProxyPriv::doLazyInstantiation(GrResourceProvider* resourceProvider) { … }
#ifdef SK_DEBUG
void GrSurfaceProxy::validateSurface(const GrSurface* surface) { … }
#endif