52 texture.dimensions().height() <= 0) {
76 std::string_view label) {
92 label =
"WrappedImage";
101 texture->setReleaseCallback(std::move(releaseHelper));
111 SKGPU_LOG_W(
"Failed SkImage:::WrapTexture because asked to generate mipmaps for "
112 "nonmipmapped texture");
116 SKGPU_LOG_W(
"Failed SkImage::WrapTexture. Could not generate mipmaps.");
121 return sk_make_sp<skgpu::graphite::Image>(view,
info);
132 std::string_view label) {
152 std::string_view label) {
175 std::string_view label) {
178 imageReleaseProc = imageReleaseProc ? imageReleaseProc : [](
void*) {};
195 SKGPU_LOG_W(
"Incompatible SkColorType and TextureInfo");
204 std::move(releaseHelper),
215 return sk_make_sp<Image>(view, colorInfo);
248 std::string_view label) {
261 std::string labelStr(label);
262 if (labelStr.empty()) {
263 labelStr =
"Wrapped_PromiseYUVPlane";
265 labelStr +=
"_PromiseYUVPlane";
269 for (
int i = 0;
i < backendTextureInfo.
numPlanes(); ++
i) {
284 SkSpan(planes), std::move(imageColorSpace));
291 if (!recorder || !img) {
294 auto subsetImg = img->
makeSubset(recorder, subset, props);
305 if (!recorder || !
src || !filter) {
327 "LazySkImagePictureTexture",
373 if (img->
getROPixels(
nullptr, &
bitmap, SkImage_Lazy::CachingHint::kDisallow_CachingHint)) {
380 "LazySkImageBitmapTexture");
390 if (!recorder || !
image) {
400 if (ib->isRasterBacked()) {
403 raster->imageInfo().colorInfo(),
408 "RasterBitmapTexture");
410 if (ib->isLazyGenerated()) {
412 recorder,
static_cast<const SkImage_Lazy*
>(ib), requiredProps);
415 return ib->makeSubset(recorder, ib->bounds(), requiredProps);
421 bool limitToMaxTextureSize,
423 std::string_view label) {
433 if (maxDim > maxTextureSize) {
434 if (!limitToMaxTextureSize) {
437 float scale =
static_cast<float>(maxTextureSize) / maxDim;
446 std::string labelStr(label);
447 if (labelStr.empty()) {
448 labelStr =
"YUVRasterBitmapPlane";
450 labelStr +=
"_YUVBitmapPlane";
455 for (
int i = 0;
i < finalInfo.
yuvaInfo().numPlanes(); ++
i) {
457 if (maxDim > maxTextureSize) {
473 planes[
i] = std::move(view);
476 SkSpan(planes), std::move(imageColorSpace));
484 std::string_view label) {
490 std::string labelStr(label);
491 if (labelStr.empty()) {
492 labelStr =
"Wrapped_YUVPlane";
494 labelStr +=
"_YUVPlane";
498 for (
int i = 0;
i < yuvaTextures.
yuvaInfo().numPlanes(); ++
i) {
502 SKGPU_LOG_W(
"Failed to wrap backend texture for YUVA plane %d",
i);
505 texture->setReleaseCallback(releaseHelper);
510 SkSpan(planes), std::move(imageColorSpace));
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
#define SKGPU_LOG_E(fmt,...)
#define SKGPU_LOG_W(fmt,...)
static SkImageFilter_Base * as_IFB(SkImageFilter *filter)
static bool SkColorInfoIsValid(const SkColorInfo &info)
static bool SkImageInfoIsValid(const SkImageInfo &info)
static SkImage_Base * as_IB(SkImage *image)
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
const SkPixmap & pixmap() const
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
SkColorType colorType() const
sk_sp< SkImage > makeImageWithFilter(sk_sp< skif::Backend > backend, sk_sp< SkImage > src, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset) const
bool getROPixels(GrDirectContext *, SkBitmap *, CachingHint) const override
SkImage_Base::Type type() const override
const SkSurfaceProps * props() const
void replay(SkCanvas *) const
const SkImageInfo & imageInfo() const
SkISize dimensions() const
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
bool scalePixels(const SkPixmap &dst, const SkSamplingOptions &) const
static constexpr int kMaxPlanes
SkYUVAInfo makeDimensions(SkISize) const
int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const
const SkYUVAInfo & yuvaInfo() const
const SkImageInfo & planeInfo(int i) const
DataType dataType() const
const SkYUVAInfo & yuvaInfo() const
SkYUVAPixmapInfo pixmapsInfo() const
const SkPixmap & plane(int i) const
static sk_sp< RefCntedCallback > Make(Callback proc, Context ctx)
const TextureInfo & info() const
skgpu::Swizzle getReadSwizzle(SkColorType, const TextureInfo &) const
bool isTexturable(const TextureInfo &) const
bool areColorTypeAndTextureInfoCompatible(SkColorType, const TextureInfo &) const
int maxTextureSize() const
static sk_sp< Image_YUVA > Make(const Caps *caps, const SkYUVAInfo &yuvaInfo, SkSpan< TextureProxyView > planes, sk_sp< SkColorSpace > imageColorSpace)
static sk_sp< Image_YUVA > WrapImages(const Caps *caps, const SkYUVAInfo &yuvaInfo, SkSpan< const sk_sp< SkImage > > images, sk_sp< SkColorSpace > imageColorSpace)
const Caps * caps() const
ResourceProvider * resourceProvider()
sk_sp< Texture > createWrappedTexture(const BackendTexture &, std::string_view label)
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)
sk_sp< TextureProxy > refProxy() const
TextureProxy * proxy() const
static sk_sp< TextureProxy > Wrap(sk_sp< Texture >)
Mipmapped mipmapped() const
const SkYUVAInfo & yuvaInfo() const
const TextureInfo & planeTextureInfo(int i) const
BackendTexture planeTexture(int i) const
const SkYUVAInfo & yuvaInfo() const
static float max(float r, float g, float b)
static float min(float r, float g, float b)
std::array< MockImage, 3 > images
void * GraphitePromiseTextureFulfillContext
SK_API sk_sp< SkImage > TextureFromYUVAPixmaps(GrRecordingContext *context, const SkYUVAPixmaps &pixmaps, skgpu::Mipmapped buildMips, bool limitToMaxTextureSize, sk_sp< SkColorSpace > imageColorSpace)
SK_API sk_sp< SkImage > PromiseTextureFrom(skgpu::graphite::Recorder *, SkISize dimensions, const skgpu::graphite::TextureInfo &, const SkColorInfo &, skgpu::Origin origin, skgpu::graphite::Volatile, GraphitePromiseTextureFulfillProc, GraphitePromiseImageReleaseProc, GraphitePromiseTextureReleaseProc, GraphitePromiseImageContext, std::string_view label={})
SK_API sk_sp< SkImage > WrapTexture(skgpu::graphite::Recorder *, const skgpu::graphite::BackendTexture &, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, skgpu::Origin origin, GenerateMipmapsFromBase generateMipmapsFromBase, TextureReleaseProc=nullptr, ReleaseContext=nullptr, std::string_view label={})
void(*)(GraphitePromiseImageContext) GraphitePromiseImageReleaseProc
void * GraphitePromiseImageContext
static bool validate_backend_texture(const skgpu::graphite::Caps *caps, const skgpu::graphite::BackendTexture &texture, const SkColorInfo &info)
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
SK_API sk_sp< SkImage > SubsetTextureFrom(GrDirectContext *context, const SkImage *img, const SkIRect &subset)
SK_API sk_sp< SkImage > PromiseTextureFromYUVA(skgpu::graphite::Recorder *, const skgpu::graphite::YUVABackendTextureInfo &, sk_sp< SkColorSpace > imageColorSpace, skgpu::graphite::Volatile, GraphitePromiseTextureFulfillProc, GraphitePromiseImageReleaseProc, GraphitePromiseTextureReleaseProc, GraphitePromiseImageContext imageContext, GraphitePromiseTextureFulfillContext planeContexts[], std::string_view label={})
std::tuple< skgpu::graphite::BackendTexture, GraphitePromiseTextureReleaseContext >(*)(GraphitePromiseTextureFulfillContext) GraphitePromiseTextureFulfillProc
SK_API sk_sp< SkImage > TextureFromYUVATextures(GrRecordingContext *context, const GrYUVABackendTextures &yuvaTextures, sk_sp< SkColorSpace > imageColorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
static sk_sp< SkImage > generate_picture_texture(skgpu::graphite::Recorder *recorder, const SkImage_Picture *img, const SkImageInfo &info, SkImage::RequiredProperties requiredProps)
SK_API sk_sp< SkImage > MakeWithFilter(sk_sp< SkImage > src, const SkImageFilter *filter, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset)
SK_API sk_sp< SkImage > TextureFromYUVAImages(skgpu::graphite::Recorder *recorder, const SkYUVAInfo &yuvaInfo, SkSpan< const sk_sp< SkImage > > images, sk_sp< SkColorSpace > imageColorSpace)
void(*)(GraphitePromiseTextureReleaseContext) GraphitePromiseTextureReleaseProc
static sk_sp< SkImage > make_texture_image_from_lazy(skgpu::graphite::Recorder *recorder, const SkImage_Lazy *img, SkImage::RequiredProperties requiredProps)
void(*)(ReleaseContext) TextureReleaseProc
sk_sp< const SkImage > image
bool GenerateMipmaps(Recorder *recorder, sk_sp< TextureProxy > texture, const SkColorInfo &colorInfo)
sk_sp< TextureProxy > MakePromiseImageLazyProxy(const Caps *caps, SkISize dimensions, TextureInfo textureInfo, Volatile isVolatile, sk_sp< RefCntedCallback > releaseHelper, GraphitePromiseTextureFulfillProc fulfillProc, GraphitePromiseTextureFulfillContext fulfillContext, GraphitePromiseTextureReleaseProc textureReleaseProc, std::string_view label)
sk_sp< SkImage > MakeFromBitmap(Recorder *recorder, const SkColorInfo &colorInfo, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmaps, Budgeted budgeted, SkImage::RequiredProperties requiredProps, std::string_view label)
std::tuple< TextureProxyView, SkColorType > MakeBitmapProxyView(Recorder *recorder, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmapsIn, Mipmapped mipmapped, Budgeted budgeted, std::string_view label)
sk_sp< Backend > MakeGraphiteBackend(skgpu::graphite::Recorder *recorder, const SkSurfaceProps &surfaceProps, SkColorType colorType)
constexpr int64_t area() const
const SkColorInfo & colorInfo() const
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)