31 , fImageView(
Image::WrapDevice(fDevice)) {}
37 fDevice->setImmutable();
41 return fDevice->imageInfo();
47 return fDevice->readSurfaceView();
53 return fDevice->makeSurface(ii, this->
props());
57 return this->
makeImageCopy(subset, fDevice->target()->mipmapped());
62 SKGPU_LOG_W(
"Intermingling makeImageSnapshot and asImage calls may produce "
63 "unexpected results. Please use either the old _or_ new API.");
70 SKGPU_LOG_W(
"Intermingling makeImageSnapshot and asImage calls may produce "
71 "unexpected results. Please use either the old _or_ new API.");
80 fDevice->writePixels(pixmap,
x,
y);
109 return fDevice->recorder()->priv().caps()->capabilities();
116 std::string_view label,
122 bool registerWithRecorder) {
131 registerWithRecorder);
138 return sk_make_sp<Surface>(std::move(
device));
150 if (!sb->isGraphiteBacked()) {
154 gs->fDevice->flushPendingWorkToRecorder();
167 texture.dimensions().width() <= 0 ||
168 texture.dimensions().height() <= 0) {
191 if (!sb->isGraphiteBacked()) {
205 if (!sb->isGraphiteBacked()) {
216 std::string_view label) {
218 label =
"SkSurfaceRenderTarget";
232 std::string_view label) {
244 SKGPU_LOG_E(
"validate_backend_texture failed: backendTex.info = %s; colorType = %d",
251 label =
"SkSurfaceWrappedTexture";
259 texture->setReleaseCallback(std::move(releaseHelper));
262 SkISize deviceSize = proxy->dimensions();
270 return device ? sk_make_sp<Surface>(std::move(
device)) :
nullptr;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SKGPU_LOG_E(fmt,...)
#define SKGPU_LOG_W(fmt,...)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
static bool SkColorInfoIsValid(const SkColorInfo &info)
static SkSurfaceProps SkSurfacePropsCopyOrDefault(const SkSurfaceProps *props)
static const SkSurface_Base * asConstSB(const SkSurface *surface)
static SkSurface_Base * asSB(SkSurface *surface)
static bool validate_backend_texture(const GrCaps *caps, const GrBackendTexture &tex, int sampleCnt, GrColorType grCT, bool texturable)
const char * c_str() const
bool hasCachedImage() const
void(ReadPixelsContext, std::unique_ptr< const AsyncReadResult >) ReadPixelsCallback
const SkSurfaceProps & props() const
skgpu::graphite::Recorder * recorder() const
static sk_sp< RefCntedCallback > Make(Callback proc, Context ctx)
const TextureInfo & info() const
virtual bool isRenderable(const TextureInfo &) const =0
bool areColorTypeAndTextureInfoCompatible(SkColorType, const TextureInfo &) const
static sk_sp< Device > Make(Recorder *recorder, sk_sp< TextureProxy >, SkISize deviceSize, const SkColorInfo &, const SkSurfaceProps &, LoadOp initialLoadOp, bool registerWithRecorder=true)
const Caps * caps() const
ResourceProvider * resourceProvider()
sk_sp< Texture > createWrappedTexture(const BackendTexture &, std::string_view label)
void onAsyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace, bool readAlpha, sk_sp< SkColorSpace > dstColorSpace, SkIRect srcRect, SkISize dstSize, RescaleGamma rescaleGamma, RescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) override
static sk_sp< Surface > Make(Recorder *recorder, const SkImageInfo &info, std::string_view label, Budgeted budgeted, Mipmapped mipmapped=Mipmapped::kNo, SkBackingFit backingFit=SkBackingFit::kExact, const SkSurfaceProps *props=nullptr)
void onAsyncRescaleAndReadPixels(const SkImageInfo &info, SkIRect srcRect, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context) override
SkCanvas * onNewCanvas() override
sk_sp< Image > makeImageCopy(const SkIRect *subset, Mipmapped) const
sk_sp< SkSurface > onNewSurface(const SkImageInfo &) override
sk_sp< Image > asImage() const
Recorder * onGetRecorder() const override
sk_sp< SkImage > onNewImageSnapshot(const SkIRect *subset) override
bool onCopyOnWrite(ContentChangeMode) override
void onWritePixels(const SkPixmap &, int x, int y) override
SkImageInfo imageInfo() const override
TextureProxyView readSurfaceView() const
sk_sp< const SkCapabilities > onCapabilities() override
TextureProxy * backingTextureProxy() const
SkString toString() const
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
SK_API sk_sp< SkImage > AsImage(sk_sp< const SkSurface >)
SK_API sk_sp< SkSurface > WrapBackendTexture(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp< SkColorSpace > colorSpace, const SkSurfaceProps *surfaceProps, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
void(*)(ReleaseContext) TextureReleaseProc
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
SK_API sk_sp< SkImage > AsImageCopy(sk_sp< const SkSurface >, const SkIRect *subset=nullptr, skgpu::Mipmapped=skgpu::Mipmapped::kNo)
void Flush(sk_sp< SkSurface > surface)
static constexpr SkIRect MakeSize(const SkISize &size)
GrSamplerState::WrapMode Wrap