Migrate MakeFromAdoptedTexture to GrRecordingContext

This also follows up on the comments Rob left in his zombie review.

Bug: skia:104662
Change-Id: I7031f7b2832eb3f47025e5d269248b854cc912e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307780
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
This commit is contained in:
Adlai Holler 2020-08-04 14:07:40 -04:00 committed by Skia Commit-Bot
parent 813e8cc762
commit f7129fc173
4 changed files with 10 additions and 34 deletions

View File

@ -99,7 +99,7 @@ private:
SkASSERT(content.colorType() == kRGBA_8888_SkColorType);
auto format = GrBackendFormat::MakeGL(GR_GL_RGBA8, GR_GL_TEXTURE_RECTANGLE);
auto bet = dContext->createBackendTexture(content.width(), content.height(), format,
GrMipmapped::kNo, GrRenderable::kNo);
GrMipmapped::kNo, GrRenderable::kNo);
if (!bet.isValid()) {
return nullptr;
}

View File

@ -397,25 +397,19 @@ public:
@param context GPU context
@param backendTexture texture residing on GPU
@param imageOrigin origin of the resulting image
@param colorType color type of the resulting image
@param alphaType alpha type of the resulting image
@param colorSpace range of colors; may be nullptr
@return created SkImage, or nullptr
*/
static sk_sp<SkImage> MakeFromAdoptedTexture(GrDirectContext* context,
static sk_sp<SkImage> MakeFromAdoptedTexture(GrRecordingContext* context,
const GrBackendTexture& backendTexture,
GrSurfaceOrigin surfaceOrigin,
GrSurfaceOrigin imageOrigin,
SkColorType colorType,
SkAlphaType alphaType = kPremul_SkAlphaType,
sk_sp<SkColorSpace> colorSpace = nullptr);
#ifdef SK_IMAGE_MAKE_FROM_ADOPTED_TEXTURE_LEGACY_API
static sk_sp<SkImage> MakeFromAdoptedTexture(GrContext* context,
const GrBackendTexture& backendTexture,
GrSurfaceOrigin surfaceOrigin,
SkColorType colorType,
SkAlphaType alphaType = kPremul_SkAlphaType,
sk_sp<SkColorSpace> colorSpace = nullptr);
#endif
/** Creates an SkImage by flattening the specified YUVA planes into a single, interleaved RGBA
image.

View File

@ -541,22 +541,13 @@ bool SkImage::MakeBackendTextureFromSkImage(GrContext*,
return false;
}
sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrDirectContext*,
sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrRecordingContext*,
const GrBackendTexture&, GrSurfaceOrigin,
SkColorType, SkAlphaType,
sk_sp<SkColorSpace>) {
return nullptr;
}
#ifdef SK_IMAGE_MAKE_FROM_ADOPTED_TEXTURE_LEGACY_API
sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext*,
const GrBackendTexture&, GrSurfaceOrigin,
SkColorType, SkAlphaType,
sk_sp<SkColorSpace>) {
return nullptr;
}
#endif
sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopy(GrRecordingContext*,
SkYUVColorSpace,
const GrBackendTexture[],

View File

@ -251,11 +251,12 @@ sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx,
kBorrow_GrWrapOwnership, std::move(releaseHelper));
}
sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrDirectContext* dContext,
sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrRecordingContext* rContext,
const GrBackendTexture& tex, GrSurfaceOrigin origin,
SkColorType ct, SkAlphaType at,
sk_sp<SkColorSpace> cs) {
if (!dContext || !dContext->priv().resourceProvider()) {
auto dContext = GrAsDirectContext(rContext);
if (!dContext) {
// We have a DDL context and we don't support adopted textures for them.
return nullptr;
}
@ -275,16 +276,6 @@ sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrDirectContext* dContext,
kAdopt_GrWrapOwnership, nullptr);
}
#ifdef SK_IMAGE_MAKE_FROM_ADOPTED_TEXTURE_LEGACY_API
sk_sp<SkImage> SkImage::MakeFromAdoptedTexture(GrContext* ctx,
const GrBackendTexture& tex, GrSurfaceOrigin origin,
SkColorType ct, SkAlphaType at,
sk_sp<SkColorSpace> cs) {
return SkImage::MakeFromAdoptedTexture(GrAsDirectContext(ctx), tex, origin, ct,
at, std::move(cs));
}
#endif
sk_sp<SkImage> SkImage::MakeTextureFromCompressed(GrDirectContext* direct, sk_sp<SkData> data,
int width, int height, CompressionType type,
GrMipmapped mipMapped,