Make SkImage_Base::asTextureProxyRef take a GrRecordingContext parameter
In future Ganesh the SkImage's will only have GrImageContexts. asTextureProxyRef, however, may need to perform some rendering thus requires an external GrRecordingContext.
Change-Id: I893573e9f3462b4c4cf5e29a7f8ee74027a2ce6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197134
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index ed3cbfa..ac34a3e 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -119,7 +119,7 @@
if (!image) {
return nullptr;
}
- sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef(ctx);
SkASSERT(!willNeedMipMaps || GrMipMapped::kYes == proxy->mipMapped());
return proxy;
}
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 92bb57a..0081815 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -193,7 +193,7 @@
SkASSERT(rect_fits(subset, image->width(), image->height()));
#if SK_SUPPORT_GPU
- if (sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef()) {
+ if (sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef(context)) {
if (!as_IB(image)->context()->priv().matches(context)) {
return nullptr;
}
diff --git a/src/gpu/GrImageTextureMaker.cpp b/src/gpu/GrImageTextureMaker.cpp
index b412cf0..c1f7a20 100644
--- a/src/gpu/GrImageTextureMaker.cpp
+++ b/src/gpu/GrImageTextureMaker.cpp
@@ -61,9 +61,9 @@
}
if (willBeMipped) {
- return fImage->asMippedTextureProxyRef();
+ return fImage->asMippedTextureProxyRef(this->context());
} else {
- return fImage->asTextureProxyRef();
+ return fImage->asTextureProxyRef(this->context());
}
}
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 16c5cf8..1dc594b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1192,7 +1192,7 @@
sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkImage* image) {
SkPixmap pm;
if (image->isTextureBacked()) {
- sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxy = as_IB(image)->asTextureProxyRef(this->context());
return SkSpecialImage::MakeDeferredFromGpu(fContext.get(),
SkIRect::MakeWH(image->width(), image->height()),
@@ -1316,7 +1316,8 @@
ASSERT_SINGLE_OWNER
uint32_t pinnedUniqueID;
auto iter = skstd::make_unique<SkLatticeIter>(image->width(), image->height(), center, dst);
- if (sk_sp<GrTextureProxy> proxy = as_IB(image)->refPinnedTextureProxy(&pinnedUniqueID)) {
+ if (sk_sp<GrTextureProxy> proxy = as_IB(image)->refPinnedTextureProxy(this->context(),
+ &pinnedUniqueID)) {
GrTextureAdjuster adjuster(this->context(), std::move(proxy),
image->alphaType(), pinnedUniqueID,
as_IB(image)->onImageInfo().colorSpace());
@@ -1376,7 +1377,8 @@
ASSERT_SINGLE_OWNER
uint32_t pinnedUniqueID;
auto iter = skstd::make_unique<SkLatticeIter>(lattice, dst);
- if (sk_sp<GrTextureProxy> proxy = as_IB(image)->refPinnedTextureProxy(&pinnedUniqueID)) {
+ if (sk_sp<GrTextureProxy> proxy = as_IB(image)->refPinnedTextureProxy(this->context(),
+ &pinnedUniqueID)) {
GrTextureAdjuster adjuster(this->context(), std::move(proxy),
image->alphaType(), pinnedUniqueID,
as_IB(image)->onImageInfo().colorSpace());
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index da2c887..5b50506 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -389,7 +389,8 @@
// Pinned texture proxies can be rendered directly as textures, or with relatively simple
// adjustments applied to the image content (scaling, mipmaps, color space, etc.)
uint32_t pinnedUniqueID;
- if (sk_sp<GrTextureProxy> proxy = as_IB(image)->refPinnedTextureProxy(&pinnedUniqueID)) {
+ if (sk_sp<GrTextureProxy> proxy = as_IB(image)->refPinnedTextureProxy(this->context(),
+ &pinnedUniqueID)) {
SK_HISTOGRAM_BOOLEAN("DrawTiled", false);
LogDrawScaleFactor(this->ctm(), srcToDst, paint.getFilterQuality());
@@ -509,7 +510,8 @@
}
uint32_t uniqueID;
- textures[i].fProxy = as_IB(set[i].fImage.get())->refPinnedTextureProxy(&uniqueID);
+ textures[i].fProxy = as_IB(set[i].fImage.get())->refPinnedTextureProxy(this->context(),
+ &uniqueID);
if (!textures[i].fProxy) {
// FIXME(michaelludwig) - If asTextureProxyRef fails, does going through drawImageQuad
// make sense? Does that catch the lazy-image cases then?
diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp
index c906483..509b6f8 100644
--- a/src/image/SkImage.cpp
+++ b/src/image/SkImage.cpp
@@ -141,7 +141,13 @@
if (bounds == subset) {
return sk_ref_sp(const_cast<SkImage*>(this));
}
- return as_IB(this)->onMakeSubset(subset);
+
+ // CONTEXT TODO: propagate the context parameter to the top-level API
+#if SK_SUPPORT_GPU
+ return as_IB(this)->onMakeSubset(as_IB(this)->context(), subset);
+#else
+ return as_IB(this)->onMakeSubset(nullptr, subset);
+#endif
}
#if SK_SUPPORT_GPU
@@ -321,7 +327,13 @@
return sk_ref_sp(const_cast<SkImage*>(this));
}
- return as_IB(this)->onMakeColorTypeAndColorSpace(this->colorType(), std::move(target));
+ // CONTEXT TODO: propagate the context parameter to the top-level API
+#if SK_SUPPORT_GPU
+ return as_IB(this)->onMakeColorTypeAndColorSpace(as_IB(this)->context(),
+#else
+ return as_IB(this)->onMakeColorTypeAndColorSpace(nullptr,
+#endif
+ this->colorType(), std::move(target));
}
sk_sp<SkImage> SkImage::makeColorTypeAndColorSpace(SkColorType targetColorType,
@@ -340,7 +352,13 @@
return sk_ref_sp(const_cast<SkImage*>(this));
}
- return as_IB(this)->onMakeColorTypeAndColorSpace(targetColorType, std::move(targetColorSpace));
+ // CONTEXT TODO: propagate the context parameter to the top-level API
+#if SK_SUPPORT_GPU
+ return as_IB(this)->onMakeColorTypeAndColorSpace(as_IB(this)->context(),
+#else
+ return as_IB(this)->onMakeColorTypeAndColorSpace(nullptr,
+#endif
+ targetColorType, std::move(targetColorSpace));
}
sk_sp<SkImage> SkImage::makeNonTextureImage() const {
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 170a0b1..bb1a981 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -57,10 +57,11 @@
// will return nullptr unless the YUVA planes have been converted to RGBA in which case
// that single backing proxy will be returned.
virtual GrTextureProxy* peekProxy() const { return nullptr; }
- virtual sk_sp<GrTextureProxy> asTextureProxyRef() const { return nullptr; }
+ virtual sk_sp<GrTextureProxy> asTextureProxyRef(GrRecordingContext*) const { return nullptr; }
virtual sk_sp<GrTextureProxy> asTextureProxyRef(GrRecordingContext*, const GrSamplerState&,
SkScalar scaleAdjust[2]) const = 0;
- virtual sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const {
+ virtual sk_sp<GrTextureProxy> refPinnedTextureProxy(GrRecordingContext*,
+ uint32_t* uniqueID) const {
return nullptr;
}
virtual bool isYUVA() const { return false; }
@@ -75,7 +76,7 @@
// but only inspect them (or encode them).
virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const = 0;
- virtual sk_sp<SkImage> onMakeSubset(const SkIRect&) const = 0;
+ virtual sk_sp<SkImage> onMakeSubset(GrRecordingContext*, const SkIRect&) const = 0;
virtual sk_sp<SkCachedData> getPlanes(SkYUVASizeInfo*, SkYUVAIndex[4],
SkYUVColorSpace*, const void* planes[4]);
@@ -100,7 +101,8 @@
virtual bool onPinAsTexture(GrContext*) const { return false; }
virtual void onUnpinAsTexture(GrContext*) const {}
- virtual sk_sp<SkImage> onMakeColorTypeAndColorSpace(SkColorType, sk_sp<SkColorSpace>) const = 0;
+ virtual sk_sp<SkImage> onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType, sk_sp<SkColorSpace>) const = 0;
protected:
SkImage_Base(int width, int height, uint32_t uniqueID);
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index cbe83dd..33f77cf 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -23,6 +23,8 @@
#include "GrGpu.h"
#include "GrImageTextureMaker.h"
#include "GrProxyProvider.h"
+#include "GrRecordingContext.h"
+#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrResourceProvider.h"
#include "GrResourceProviderPriv.h"
@@ -63,13 +65,18 @@
return SkImageInfo::Make(fProxy->width(), fProxy->height(), colorType, fAlphaType, fColorSpace);
}
-sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(SkColorType targetCT,
+sk_sp<SkImage> SkImage_Gpu::onMakeColorTypeAndColorSpace(GrRecordingContext* context,
+ SkColorType targetCT,
sk_sp<SkColorSpace> targetCS) const {
+ if (!context || !fContext->priv().matches(context)) {
+ return nullptr;
+ }
+
auto xform = GrColorSpaceXformEffect::Make(fColorSpace.get(), fAlphaType,
targetCS.get(), fAlphaType);
SkASSERT(xform || targetCT != this->colorType());
- sk_sp<GrTextureProxy> proxy = this->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxy = this->asTextureProxyRef(context);
GrBackendFormat format = proxy->backendFormat().makeTexture2D();
if (!format.isValid()) {
@@ -77,7 +84,7 @@
}
sk_sp<GrRenderTargetContext> renderTargetContext(
- fContext->priv().makeDeferredRenderTargetContextWithFallback(
+ context->priv().makeDeferredRenderTargetContextWithFallback(
format, SkBackingFit::kExact, this->width(), this->height(),
SkColorType2GrPixelConfig(targetCT), nullptr));
if (!renderTargetContext) {
@@ -359,7 +366,7 @@
return nullptr;
}
- sk_sp<GrTextureProxy> proxy = as_IB(this)->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxy = as_IB(this)->asTextureProxyRef(context);
SkASSERT(proxy);
if (GrMipMapped::kNo == mipMapped || proxy->mipMapped() == mipMapped) {
return sk_ref_sp(const_cast<SkImage*>(this));
@@ -706,7 +713,7 @@
if (!image->unique() || !texture->surfacePriv().hasUniqueRef() ||
texture->resourcePriv().refsWrappedObjects()) {
// onMakeSubset will always copy the image.
- image = as_IB(image)->onMakeSubset(image->bounds());
+ image = as_IB(image)->onMakeSubset(ctx, image->bounds());
if (!image) {
return false;
}
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 5a61162..e05ec6c 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -31,13 +31,14 @@
GrTextureProxy* peekProxy() const override {
return fProxy.get();
}
- sk_sp<GrTextureProxy> asTextureProxyRef() const override {
+ sk_sp<GrTextureProxy> asTextureProxyRef(GrRecordingContext*) const override {
return fProxy;
}
bool onIsTextureBacked() const override { return SkToBool(fProxy.get()); }
- sk_sp<SkImage> onMakeColorTypeAndColorSpace(SkColorType, sk_sp<SkColorSpace>) const final;
+ sk_sp<SkImage> onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType, sk_sp<SkColorSpace>) const final;
/**
* This is the implementation of SkDeferredDisplayListRecorder::makePromiseImage.
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 0c42f8f..2618dd4 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -10,6 +10,8 @@
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
+#include "GrRecordingContext.h"
+#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrTexture.h"
#include "GrTextureAdjuster.h"
@@ -88,8 +90,7 @@
}
sk_sp<GrSurfaceContext> sContext = direct->priv().makeWrappedSurfaceContext(
- this->asTextureProxyRef(),
- fColorSpace);
+ this->asTextureProxyRef(direct), fColorSpace);
if (!sContext) {
return false;
}
@@ -105,8 +106,13 @@
return true;
}
-sk_sp<SkImage> SkImage_GpuBase::onMakeSubset(const SkIRect& subset) const {
- sk_sp<GrSurfaceProxy> proxy = this->asTextureProxyRef();
+sk_sp<SkImage> SkImage_GpuBase::onMakeSubset(GrRecordingContext* context,
+ const SkIRect& subset) const {
+ if (!context || !fContext->priv().matches(context)) {
+ return nullptr;
+ }
+
+ sk_sp<GrSurfaceProxy> proxy = this->asTextureProxyRef(context);
GrSurfaceDesc desc;
desc.fWidth = subset.width();
@@ -119,7 +125,7 @@
}
// TODO: Should this inherit our proxy's budgeted status?
- sk_sp<GrSurfaceContext> sContext(fContext->priv().makeDeferredSurfaceContext(
+ sk_sp<GrSurfaceContext> sContext(context->priv().makeDeferredSurfaceContext(
format, desc, proxy->origin(), GrMipMapped::kNo, SkBackingFit::kExact,
proxy->isBudgeted()));
if (!sContext) {
@@ -183,7 +189,7 @@
}
sk_sp<GrSurfaceContext> sContext = direct->priv().makeWrappedSurfaceContext(
- this->asTextureProxyRef(), this->refColorSpace());
+ this->asTextureProxyRef(direct), this->refColorSpace());
if (!sContext) {
return false;
}
@@ -209,12 +215,12 @@
sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrRecordingContext* context,
const GrSamplerState& params,
SkScalar scaleAdjust[2]) const {
- if (!fContext->priv().matches(context)) {
+ if (!context || !fContext->priv().matches(context)) {
SkASSERT(0);
return nullptr;
}
- GrTextureAdjuster adjuster(fContext.get(), this->asTextureProxyRef(), fAlphaType,
+ GrTextureAdjuster adjuster(fContext.get(), this->asTextureProxyRef(context), fAlphaType,
this->uniqueID(), fColorSpace.get());
return adjuster.refTextureProxyForParams(params, scaleAdjust);
}
@@ -224,10 +230,10 @@
auto direct = fContext->priv().asDirectContext();
if (!direct) {
// This image was created with a DDL context and cannot be instantiated.
- return GrBackendTexture();
+ return GrBackendTexture(); // invalid
}
- sk_sp<GrTextureProxy> proxy = this->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxy = this->asTextureProxyRef(direct);
SkASSERT(proxy);
if (!proxy->isInstantiated()) {
@@ -239,7 +245,6 @@
}
GrTexture* texture = proxy->peekTexture();
-
if (texture) {
if (flushPendingGrContextIO) {
direct->priv().prepareSurfaceForExternalIO(proxy.get());
@@ -264,7 +269,7 @@
return nullptr;
}
- sk_sp<GrTextureProxy> proxyRef = this->asTextureProxyRef();
+ sk_sp<GrTextureProxy> proxyRef = this->asTextureProxyRef(direct);
SkASSERT(proxyRef && !proxyRef->isInstantiated());
if (!proxyRef->instantiate(direct->priv().resourceProvider())) {
diff --git a/src/image/SkImage_GpuBase.h b/src/image/SkImage_GpuBase.h
index 86b4b2e..0058711 100644
--- a/src/image/SkImage_GpuBase.h
+++ b/src/image/SkImage_GpuBase.h
@@ -27,22 +27,23 @@
GrContext* context() const final { return fContext.get(); }
bool getROPixels(SkBitmap*, CachingHint) const final;
- sk_sp<SkImage> onMakeSubset(const SkIRect& subset) const final;
+ sk_sp<SkImage> onMakeSubset(GrRecordingContext*, const SkIRect& subset) const final;
bool onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB,
int srcX, int srcY, CachingHint) const override;
- sk_sp<GrTextureProxy> asTextureProxyRef() const override {
+ sk_sp<GrTextureProxy> asTextureProxyRef(GrRecordingContext* context) const override {
// we shouldn't end up calling this
SkASSERT(false);
- return this->INHERITED::asTextureProxyRef();
+ return this->INHERITED::asTextureProxyRef(context);
}
sk_sp<GrTextureProxy> asTextureProxyRef(GrRecordingContext*, const GrSamplerState&,
SkScalar scaleAdjust[2]) const final;
- sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const final {
+ sk_sp<GrTextureProxy> refPinnedTextureProxy(GrRecordingContext* context,
+ uint32_t* uniqueID) const final {
*uniqueID = this->uniqueID();
- return this->asTextureProxyRef();
+ return this->asTextureProxyRef(context);
}
GrBackendTexture onGetBackendTexture(bool flushPendingGrContextIO,
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 528373b..a0b29eb 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -13,6 +13,8 @@
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrGpu.h"
+#include "GrRecordingContext.h"
+#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrTexture.h"
#include "GrTextureProducer.h"
@@ -102,37 +104,46 @@
return fRGBProxy.get();
}
-sk_sp<GrTextureProxy> SkImage_GpuYUVA::asTextureProxyRef() const {
- if (!fRGBProxy) {
- const GrBackendFormat format =
- fContext->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
-
- // Needs to create a render target in order to draw to it for the yuv->rgb conversion.
- sk_sp<GrRenderTargetContext> renderTargetContext(
- fContext->priv().makeDeferredRenderTargetContext(
- format, SkBackingFit::kExact, this->width(), this->height(),
- kRGBA_8888_GrPixelConfig, fColorSpace, 1, GrMipMapped::kNo, fOrigin));
- if (!renderTargetContext) {
- return nullptr;
- }
-
- auto colorSpaceXform = GrColorSpaceXform::Make(fColorSpace.get(), fAlphaType,
- fTargetColorSpace.get(), fAlphaType);
- const SkRect rect = SkRect::MakeIWH(this->width(), this->height());
- if (!RenderYUVAToRGBA(fContext.get(), renderTargetContext.get(), rect, fYUVColorSpace,
- std::move(colorSpaceXform), fProxies, fYUVAIndices)) {
- return nullptr;
- }
-
- fRGBProxy = renderTargetContext->asTextureProxyRef();
+sk_sp<GrTextureProxy> SkImage_GpuYUVA::asTextureProxyRef(GrRecordingContext* context) const {
+ if (fRGBProxy) {
+ return fRGBProxy;
}
+ if (!context || !fContext->priv().matches(context)) {
+ return nullptr;
+ }
+
+ const GrBackendFormat format =
+ fContext->priv().caps()->getBackendFormatFromColorType(kRGBA_8888_SkColorType);
+
+ // Needs to create a render target in order to draw to it for the yuv->rgb conversion.
+ sk_sp<GrRenderTargetContext> renderTargetContext(
+ context->priv().makeDeferredRenderTargetContext(
+ format, SkBackingFit::kExact, this->width(), this->height(),
+ kRGBA_8888_GrPixelConfig, fColorSpace, 1, GrMipMapped::kNo, fOrigin));
+ if (!renderTargetContext) {
+ return nullptr;
+ }
+
+ auto colorSpaceXform = GrColorSpaceXform::Make(fColorSpace.get(), fAlphaType,
+ fTargetColorSpace.get(), fAlphaType);
+ const SkRect rect = SkRect::MakeIWH(this->width(), this->height());
+ if (!RenderYUVAToRGBA(fContext.get(), renderTargetContext.get(), rect, fYUVColorSpace,
+ std::move(colorSpaceXform), fProxies, fYUVAIndices)) {
+ return nullptr;
+ }
+
+ fRGBProxy = renderTargetContext->asTextureProxyRef();
return fRGBProxy;
}
-sk_sp<GrTextureProxy> SkImage_GpuYUVA::asMippedTextureProxyRef() const {
+sk_sp<GrTextureProxy> SkImage_GpuYUVA::asMippedTextureProxyRef(GrRecordingContext* context) const {
+ if (!context || !fContext->priv().matches(context)) {
+ return nullptr;
+ }
+
// if invalid or already has miplevels
- auto proxy = this->asTextureProxyRef();
+ auto proxy = this->asTextureProxyRef(context);
if (!proxy || GrMipMapped::kYes == fRGBProxy->mipMapped()) {
return proxy;
}
@@ -149,7 +160,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
-sk_sp<SkImage> SkImage_GpuYUVA::onMakeColorTypeAndColorSpace(SkColorType,
+sk_sp<SkImage> SkImage_GpuYUVA::onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType,
sk_sp<SkColorSpace> targetCS) const {
// We explicitly ignore color type changes, for now.
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index 8a9aac4..ef09c90 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -34,11 +34,12 @@
// This returns the single backing proxy if the YUV channels have already been flattened but
// nullptr if they have not.
GrTextureProxy* peekProxy() const override;
- sk_sp<GrTextureProxy> asTextureProxyRef() const override;
+ sk_sp<GrTextureProxy> asTextureProxyRef(GrRecordingContext*) const override;
virtual bool onIsTextureBacked() const override { return SkToBool(fProxies[0].get()); }
- sk_sp<SkImage> onMakeColorTypeAndColorSpace(SkColorType, sk_sp<SkColorSpace>) const final;
+ sk_sp<SkImage> onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType, sk_sp<SkColorSpace>) const final;
virtual bool isYUVA() const override { return true; }
virtual bool asYUVATextureProxiesRef(sk_sp<GrTextureProxy> proxies[4],
@@ -55,7 +56,7 @@
bool setupMipmapsForPlanes() const;
// Returns a ref-ed texture proxy with miplevels
- sk_sp<GrTextureProxy> asMippedTextureProxyRef() const;
+ sk_sp<GrTextureProxy> asMippedTextureProxyRef(GrRecordingContext*) const;
/**
* This is the implementation of SkDeferredDisplayListRecorder::makeYUVAPromiseTexture.
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index db85e95..ad69750 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -250,7 +250,8 @@
}
#endif
-sk_sp<SkImage> SkImage_Lazy::onMakeSubset(const SkIRect& subset) const {
+sk_sp<SkImage> SkImage_Lazy::onMakeSubset(GrRecordingContext* context,
+ const SkIRect& subset) const {
SkASSERT(fInfo.bounds().contains(subset));
SkASSERT(fInfo.bounds() != subset);
@@ -260,7 +261,8 @@
return validator ? sk_sp<SkImage>(new SkImage_Lazy(&validator)) : nullptr;
}
-sk_sp<SkImage> SkImage_Lazy::onMakeColorTypeAndColorSpace(SkColorType targetCT,
+sk_sp<SkImage> SkImage_Lazy::onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType targetCT,
sk_sp<SkColorSpace> targetCS) const {
SkAutoExclusive autoAquire(fOnMakeColorTypeAndSpaceMutex);
if (fOnMakeColorTypeAndSpaceResult &&
diff --git a/src/image/SkImage_Lazy.h b/src/image/SkImage_Lazy.h
index e1407e9..8578558 100644
--- a/src/image/SkImage_Lazy.h
+++ b/src/image/SkImage_Lazy.h
@@ -53,10 +53,11 @@
SkYUVColorSpace*, const void* planes[4]) override;
#endif
sk_sp<SkData> onRefEncoded() const override;
- sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
+ sk_sp<SkImage> onMakeSubset(GrRecordingContext*, const SkIRect&) const override;
bool getROPixels(SkBitmap*, CachingHint) const override;
bool onIsLazyGenerated() const override { return true; }
- sk_sp<SkImage> onMakeColorTypeAndColorSpace(SkColorType, sk_sp<SkColorSpace>) const override;
+ sk_sp<SkImage> onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType, sk_sp<SkColorSpace>) const override;
bool onIsValid(GrContext*) const override;
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index b1e5e08..296f34a 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -86,7 +86,7 @@
#endif
bool getROPixels(SkBitmap*, CachingHint) const override;
- sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
+ sk_sp<SkImage> onMakeSubset(GrRecordingContext*, const SkIRect&) const override;
SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); }
@@ -101,7 +101,8 @@
SkASSERT(bitmapMayBeMutable || fBitmap.isImmutable());
}
- sk_sp<SkImage> onMakeColorTypeAndColorSpace(SkColorType, sk_sp<SkColorSpace>) const override;
+ sk_sp<SkImage> onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType, sk_sp<SkColorSpace>) const override;
bool onIsValid(GrContext* context) const override { return true; }
void notifyAddedToRasterCache() const override {
@@ -113,7 +114,8 @@
}
#if SK_SUPPORT_GPU
- sk_sp<GrTextureProxy> refPinnedTextureProxy(uint32_t* uniqueID) const override;
+ sk_sp<GrTextureProxy> refPinnedTextureProxy(GrRecordingContext*,
+ uint32_t* uniqueID) const override;
bool onPinAsTexture(GrContext*) const override;
void onUnpinAsTexture(GrContext*) const override;
#endif
@@ -177,7 +179,7 @@
}
uint32_t uniqueID;
- sk_sp<GrTextureProxy> tex = this->refPinnedTextureProxy(&uniqueID);
+ sk_sp<GrTextureProxy> tex = this->refPinnedTextureProxy(context, &uniqueID);
if (tex) {
GrTextureAdjuster adjuster(context, fPinnedProxy, fBitmap.alphaType(), fPinnedUniqueID,
fBitmap.colorSpace());
@@ -190,7 +192,8 @@
#if SK_SUPPORT_GPU
-sk_sp<GrTextureProxy> SkImage_Raster::refPinnedTextureProxy(uint32_t* uniqueID) const {
+sk_sp<GrTextureProxy> SkImage_Raster::refPinnedTextureProxy(GrRecordingContext*,
+ uint32_t* uniqueID) const {
if (fPinnedProxy) {
SkASSERT(fPinnedCount > 0);
SkASSERT(fPinnedUniqueID != 0);
@@ -231,7 +234,7 @@
}
#endif
-sk_sp<SkImage> SkImage_Raster::onMakeSubset(const SkIRect& subset) const {
+sk_sp<SkImage> SkImage_Raster::onMakeSubset(GrRecordingContext*, const SkIRect& subset) const {
SkImageInfo info = fBitmap.info().makeWH(subset.width(), subset.height());
SkBitmap bitmap;
if (!bitmap.tryAllocPixels(info)) {
@@ -337,7 +340,8 @@
///////////////////////////////////////////////////////////////////////////////
-sk_sp<SkImage> SkImage_Raster::onMakeColorTypeAndColorSpace(SkColorType targetCT,
+sk_sp<SkImage> SkImage_Raster::onMakeColorTypeAndColorSpace(GrRecordingContext*,
+ SkColorType targetCT,
sk_sp<SkColorSpace> targetCS) const {
SkPixmap src;
SkAssertResult(fBitmap.peekPixels(&src));