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/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?