aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-30 13:27:37 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-30 19:05:36 +0000
commitf200a90f3e58ce20753420cadced850d7d00dca1 (patch)
treed4618a39bdd6f74b070b236283819ae7f4770d33 /src/gpu
parentefe3dedbb3493b738abdb56041b093245e4e8711 (diff)
Rationalize GrContext's Gr*Proxy getter naming
This CL replaces the entry points: asDeferredSurface asDeferredTexture asDeferredRenderTarget with: GrSurfaceProxy* asSurfaceProxy sk_sp<GrSurfaceProxy> asSurfaceProxyRef GrTextureProxy* asTextureProxy sk_sp<GrTextureProxy> asTextureProxyRef GrRenderTargetProxy* asRenderTargetProxy sk_sp<GrRenderTargetProxy> asRenderTargetProxyRef Change-Id: I7c2b1ea3d702023ff23019815ca13c9ff6f3b32d Reviewed-on: https://skia-review.googlesource.com/7741 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBlurUtils.cpp4
-rw-r--r--src/gpu/GrRenderTargetContext.cpp6
-rw-r--r--src/gpu/GrSWMaskHelper.cpp4
-rw-r--r--src/gpu/GrSurfaceProxy.cpp2
-rw-r--r--src/gpu/GrTextureContext.cpp8
-rw-r--r--src/gpu/GrYUVProvider.cpp6
-rw-r--r--src/gpu/SkGpuDevice.cpp6
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp4
-rw-r--r--src/gpu/text/GrAtlasGlyphCache.cpp2
9 files changed, 26 insertions, 16 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index cec9cdc7ad..091d7766ba 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -101,7 +101,7 @@ static bool sw_draw_with_mask_filter(GrContext* context,
}
return draw_mask(context, renderTargetContext, clipData, viewMatrix,
- dstM.fBounds, std::move(paint), sk_ref_sp(sContext->asDeferredTexture()));
+ dstM.fBounds, std::move(paint), sContext->asTextureProxyRef());
}
// Create a mask of 'devPath' and place the result in 'mask'.
@@ -138,7 +138,7 @@ static sk_sp<GrTextureProxy> create_mask_GPU(GrContext* context,
translate.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop));
rtContext->drawPath(clip, std::move(maskPaint), aa, translate, devPath,
GrStyle(fillOrHairline));
- return sk_ref_sp(rtContext->asDeferredTexture());
+ return rtContext->asTextureProxyRef();
}
static void draw_path_with_mask_filter(GrContext* context,
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 13fa56fc3a..c0b25dedcf 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -115,10 +115,14 @@ GrRenderTarget* GrRenderTargetContext::instantiate() {
return fRenderTargetProxy->instantiate(fContext->textureProvider());
}
-GrTextureProxy* GrRenderTargetContext::asDeferredTexture() {
+GrTextureProxy* GrRenderTargetContext::asTextureProxy() {
return fRenderTargetProxy->asTextureProxy();
}
+sk_sp<GrTextureProxy> GrRenderTargetContext::asTextureProxyRef() {
+ return sk_ref_sp(fRenderTargetProxy->asTextureProxy());
+}
+
GrRenderTargetOpList* GrRenderTargetContext::getOpList() {
ASSERT_SINGLE_OWNER
SkDEBUGCODE(this->validate();)
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index d881888edc..073aec4fea 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -107,7 +107,7 @@ sk_sp<GrTextureProxy> GrSWMaskHelper::toTexture(GrContext* context, SkBackingFit
desc,
fit,
SkBudgeted::kYes);
- if (!sContext || !sContext->asDeferredTexture()) {
+ if (!sContext || !sContext->asTextureProxy()) {
return nullptr;
}
@@ -116,7 +116,7 @@ sk_sp<GrTextureProxy> GrSWMaskHelper::toTexture(GrContext* context, SkBackingFit
return nullptr;
}
- return sk_ref_sp(sContext->asDeferredTexture());
+ return sContext->asTextureProxyRef();
}
/**
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b8b1dc7a58..e5cf76910f 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -204,7 +204,7 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::Copy(GrContext* context,
return nullptr;
}
- return sk_ref_sp(dstContext->asDeferredSurface());
+ return dstContext->asSurfaceProxyRef();
}
sk_sp<GrSurfaceContext> GrSurfaceProxy::TestCopy(GrContext* context, const GrSurfaceDesc& dstDesc,
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 0449c08281..7e9069588b 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -44,7 +44,13 @@ GrTextureContext::~GrTextureContext() {
SkSafeUnref(fOpList);
}
-GrRenderTargetProxy* GrTextureContext::asDeferredRenderTarget() {
+GrRenderTargetProxy* GrTextureContext::asRenderTargetProxy() {
+ // If the proxy can return an RTProxy it should've been wrapped in a RTContext
+ SkASSERT(!fTextureProxy->asRenderTargetProxy());
+ return nullptr;
+}
+
+sk_sp<GrRenderTargetProxy> GrTextureContext::asRenderTargetProxyRef() {
// If the proxy can return an RTProxy it should've been wrapped in a RTContext
SkASSERT(!fTextureProxy->asRenderTargetProxy());
return nullptr;
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index ade72a6cce..ee2ad636c5 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -133,9 +133,9 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
GrPaint paint;
sk_sp<GrFragmentProcessor> yuvToRgbProcessor(
GrYUVEffect::MakeYUVToRGB(ctx,
- sk_ref_sp(yuvTextureContexts[0]->asDeferredTexture()),
- sk_ref_sp(yuvTextureContexts[1]->asDeferredTexture()),
- sk_ref_sp(yuvTextureContexts[2]->asDeferredTexture()),
+ yuvTextureContexts[0]->asTextureProxyRef(),
+ yuvTextureContexts[1]->asTextureProxyRef(),
+ yuvTextureContexts[2]->asTextureProxyRef(),
yuvInfo.fSizeInfo.fSizes, yuvInfo.fColorSpace, false));
paint.addColorFragmentProcessor(std::move(yuvToRgbProcessor));
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index b799545b5a..f443a64bb6 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -271,7 +271,7 @@ void SkGpuDevice::replaceRenderTargetContext(bool shouldRetainContent) {
if (fRenderTargetContext->wasAbandoned()) {
return;
}
- newRTC->copy(fRenderTargetContext->asDeferredSurface());
+ newRTC->copy(fRenderTargetContext->asSurfaceProxy());
}
fRenderTargetContext = newRTC;
@@ -1332,13 +1332,13 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkImage* image) {
}
sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
- sk_sp<GrSurfaceProxy> sProxy(sk_ref_sp(this->accessRenderTargetContext()->asDeferredTexture()));
+ sk_sp<GrSurfaceProxy> sProxy(this->accessRenderTargetContext()->asTextureProxyRef());
if (!sProxy) {
// When the device doesn't have a texture, we create a temporary texture.
// TODO: we should actually only copy the portion of the source needed to apply the image
// filter
sProxy = GrSurfaceProxy::Copy(fContext.get(),
- this->accessRenderTargetContext()->asDeferredSurface(),
+ this->accessRenderTargetContext()->asSurfaceProxy(),
SkBudgeted::kYes);
if (!sProxy) {
return nullptr;
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 74cf2ca44f..d9b408a6bb 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -254,10 +254,10 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
context, sk_ref_sp(dataProxy->asTextureProxy()), GrSwizzle::RGBA(),
*pmToUPMRule, SkMatrix::I()));
sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
- context, sk_ref_sp(readRTC->asDeferredTexture()), GrSwizzle::RGBA(),
+ context, readRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
*upmToPMRule, SkMatrix::I()));
sk_sp<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
- context, sk_ref_sp(tempRTC->asDeferredTexture()), GrSwizzle::RGBA(),
+ context, tempRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
*pmToUPMRule, SkMatrix::I()));
paint1.addColorFragmentProcessor(std::move(pmToUPM1));
diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp
index 315b3c00fa..58e78c1d3a 100644
--- a/src/gpu/text/GrAtlasGlyphCache.cpp
+++ b/src/gpu/text/GrAtlasGlyphCache.cpp
@@ -130,7 +130,7 @@ static bool save_pixels(GrContext* context, GrSurfaceProxy* sProxy, const char*
sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeWrappedSurfaceContext(
sk_ref_sp(sProxy),
nullptr));
- if (!sContext || !sContext->asDeferredTexture()) {
+ if (!sContext || !sContext->asTextureProxy()) {
return false;
}