Make GrSurface::MakeDeferred return sk_sp<GrTextureProxy>
authorRobert Phillips <robertphillips@google.com>
Thu, 2 Mar 2017 23:18:38 +0000 (18:18 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 3 Mar 2017 12:35:27 +0000 (12:35 +0000)
This should make upcoming changes less tedious

Change-Id: I313ae9df724f109a64cf5708a974e8bfeb963025
Reviewed-on: https://skia-review.googlesource.com/9183
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

18 files changed:
gm/etc1.cpp
gm/texdata.cpp
gm/texturedomaineffect.cpp
gm/yuvtorgbeffect.cpp
include/private/GrSurfaceProxy.h
src/gpu/GrContext.cpp
src/gpu/GrSurfaceProxy.cpp
src/gpu/effects/GrConfigConversionEffect.cpp
tests/CopySurfaceTest.cpp
tests/ImageFilterCacheTest.cpp
tests/IntTextureTest.cpp
tests/ProcessorTest.cpp
tests/ProxyConversionTest.cpp
tests/ProxyTest.cpp
tests/ReadWriteAlphaTest.cpp
tests/SRGBMipMapTest.cpp
tests/SpecialImageTest.cpp
tests/TestUtils.cpp

index 09ef7d8..b22a27f 100644 (file)
@@ -79,20 +79,19 @@ protected:
         desc.fWidth = kTexWidth;
         desc.fHeight = kTexHeight;
 
-        sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
+        sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                    context->textureProvider(),
                                                                    desc, SkBudgeted::kYes,
                                                                    fETC1Data.get(), 0);
-        if (!proxy || !proxy->asTextureProxy()) {
+        if (!proxy) {
             return;
         }
 
         const SkMatrix trans = SkMatrix::MakeTrans(-kPad, -kPad);
 
-        sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(
-                                                                context,
-                                                                sk_ref_sp(proxy->asTextureProxy()),
-                                                                nullptr, trans);
+        sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(context,
+                                                                    std::move(proxy),
+                                                                    nullptr, trans);
 
         GrPaint grPaint;
         grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
index 2921afd..106b87e 100644 (file)
@@ -91,7 +91,7 @@ DEF_SIMPLE_GM_BG(texdata, canvas, 2 * S, 2 * S, SK_ColorBLACK) {
         desc.fHeight    = 2 * S;
         desc.fConfig    = SkImageInfo2GrPixelConfig(ii, *context->caps());
 
-        sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
+        sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                    context->textureProvider(),
                                                                    desc, SkBudgeted::kNo,
                                                                    gTextureData.get(), 0);
index d5d98d5..8be917d 100644 (file)
@@ -90,12 +90,12 @@ protected:
         desc.fHeight = fBmp.height();
         desc.fConfig = SkImageInfo2GrPixelConfig(fBmp.info(), *context->caps());
 
-        sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
+        sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                  context->textureProvider(),
                                                                  desc, SkBudgeted::kYes,
                                                                  fBmp.getPixels(),
                                                                  fBmp.rowBytes()));
-        if (!proxy || !proxy->asTextureProxy()) {
+        if (!proxy) {
             return;
         }
 
@@ -124,7 +124,7 @@ protected:
                     grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
                     sk_sp<GrFragmentProcessor> fp(
                         GrTextureDomainEffect::Make(
-                                   context, sk_ref_sp(proxy->asTextureProxy()),
+                                   context, proxy,
                                    nullptr, textureMatrices[tm],
                                    GrTextureDomain::MakeTexelDomainForMode(texelDomains[d], mode),
                                    mode, GrSamplerParams::kNone_FilterMode));
index 1835fe3..03d103a 100644 (file)
@@ -81,7 +81,7 @@ protected:
             return;
         }
 
-        sk_sp<GrSurfaceProxy> proxy[3];
+        sk_sp<GrTextureProxy> proxy[3];
 
         {
             GrSurfaceDesc desc;
@@ -121,9 +121,9 @@ protected:
             for (int i = 0; i < 6; ++i) {
                 sk_sp<GrFragmentProcessor> fp(
                         GrYUVEffect::MakeYUVToRGB(context,
-                                                  sk_ref_sp(proxy[indices[i][0]]->asTextureProxy()),
-                                                  sk_ref_sp(proxy[indices[i][1]]->asTextureProxy()),
-                                                  sk_ref_sp(proxy[indices[i][2]]->asTextureProxy()),
+                                                  proxy[indices[i][0]],
+                                                  proxy[indices[i][1]],
+                                                  proxy[indices[i][2]],
                                                   sizes,
                                                   static_cast<SkYUVColorSpace>(space),
                                                   false));
@@ -212,7 +212,7 @@ protected:
             return;
         }
 
-        sk_sp<GrSurfaceProxy> proxy[3];
+        sk_sp<GrTextureProxy> proxy[3];
 
         {
             GrSurfaceDesc desc;
@@ -252,10 +252,7 @@ protected:
             GrPaint grPaint;
             grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
             sk_sp<GrFragmentProcessor> fp(
-                GrYUVEffect::MakeYUVToRGB(context,
-                                          sk_ref_sp(proxy[0]->asTextureProxy()),
-                                          sk_ref_sp(proxy[1]->asTextureProxy()),
-                                          sk_ref_sp(proxy[2]->asTextureProxy()),
+                GrYUVEffect::MakeYUVToRGB(context, proxy[0], proxy[1], proxy[2],
                                           sizes, static_cast<SkYUVColorSpace>(space), true));
             if (fp) {
                 SkMatrix viewMatrix;
index aedb364..91a4c3c 100644 (file)
@@ -172,13 +172,13 @@ public:
     static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>);
     static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>);
 
-    static sk_sp<GrSurfaceProxy> MakeDeferred(GrTextureProvider*, const GrCaps&,
+    static sk_sp<GrTextureProxy> MakeDeferred(GrTextureProvider*, const GrCaps&,
                                               const GrSurfaceDesc&, SkBackingFit,
                                               SkBudgeted, uint32_t flags = 0);
 
     // TODO: need to refine ownership semantics of 'srcData' if we're in completely
     // deferred mode
-    static sk_sp<GrSurfaceProxy> MakeDeferred(const GrCaps&, GrTextureProvider*,
+    static sk_sp<GrTextureProxy> MakeDeferred(const GrCaps&, GrTextureProvider*,
                                               const GrSurfaceDesc&, SkBudgeted,
                                               const void* srcData, size_t rowBytes);
 
index 7dfee00..a4c1852 100644 (file)
@@ -294,46 +294,43 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, SkColorSpace* dstColorSpa
         this->flush();
     }
 
-    sk_sp<GrTextureProxy> tempTextureProxy;
+    sk_sp<GrTextureProxy> tempProxy;
     if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
-        sk_sp<GrSurfaceProxy> temp = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
-                                                                  *this->caps(),
-                                                                  tempDrawInfo.fTempSurfaceDesc,
-                                                                  SkBackingFit::kApprox,
-                                                                  SkBudgeted::kYes);
-        if (temp) {
-            tempTextureProxy = sk_ref_sp(temp->asTextureProxy());
-        }
-        if (!tempTextureProxy && GrGpu::kRequireDraw_DrawPreference == drawPreference) {
+        tempProxy = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
+                                                 *this->caps(),
+                                                 tempDrawInfo.fTempSurfaceDesc,
+                                                 SkBackingFit::kApprox,
+                                                 SkBudgeted::kYes);
+        if (!tempProxy && GrGpu::kRequireDraw_DrawPreference == drawPreference) {
             return false;
         }
     }
 
     // temp buffer for doing sw premul conversion, if needed.
     SkAutoSTMalloc<128 * 128, uint32_t> tmpPixels(0);
-    if (tempTextureProxy) {
+    if (tempProxy) {
         sk_sp<GrFragmentProcessor> fp;
         if (applyPremulToSrc) {
-            fp = this->createUPMToPMEffect(tempTextureProxy, tempDrawInfo.fSwizzle, SkMatrix::I());
+            fp = this->createUPMToPMEffect(tempProxy, tempDrawInfo.fSwizzle, SkMatrix::I());
             // If premultiplying was the only reason for the draw, fall back to a straight write.
             if (!fp) {
                 if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference) {
-                    tempTextureProxy.reset(nullptr);
+                    tempProxy.reset(nullptr);
                 }
             } else {
                 applyPremulToSrc = false;
             }
         }
-        if (tempTextureProxy) {
+        if (tempProxy) {
             if (!fp) {
-                fp = GrConfigConversionEffect::Make(this, tempTextureProxy, tempDrawInfo.fSwizzle,
+                fp = GrConfigConversionEffect::Make(this, tempProxy, tempDrawInfo.fSwizzle,
                                                     GrConfigConversionEffect::kNone_PMConversion,
                                                     SkMatrix::I());
                 if (!fp) {
                     return false;
                 }
             }
-            GrTexture* texture = tempTextureProxy->instantiate(this->textureProvider());
+            GrTexture* texture = tempProxy->instantiate(this->textureProvider());
             if (!texture) {
                 return false;
             }
@@ -382,7 +379,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, SkColorSpace* dstColorSpa
             }
         }
     }
-    if (!tempTextureProxy) {
+    if (!tempProxy) {
         if (applyPremulToSrc) {
             size_t tmpRowBytes = 4 * width;
             tmpPixels.reset(width * height);
@@ -625,7 +622,7 @@ sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext(const GrSurfac
                                                                   SkBackingFit fit,
                                                                   SkBudgeted isDstBudgeted) {
 
-    sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(fContext->textureProvider(),
+    sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(fContext->textureProvider(),
                                                                *fContext->caps(), dstDesc,
                                                                fit, isDstBudgeted);
     if (!proxy) {
@@ -825,7 +822,7 @@ sk_sp<GrRenderTargetContext> GrContext::makeDeferredRenderTargetContext(
     desc.fConfig = config;
     desc.fSampleCnt = sampleCnt;
 
-    sk_sp<GrSurfaceProxy> rtp = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
+    sk_sp<GrTextureProxy> rtp = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
                                                              *this->caps(), desc, fit, budgeted);
     if (!rtp) {
         return nullptr;
index a66daa4..b8fc56d 100644 (file)
@@ -146,7 +146,7 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex) {
 
 #include "GrResourceProvider.h"
 
-sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(GrTextureProvider* texProvider,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrTextureProvider* texProvider,
                                                    const GrCaps& caps,
                                                    const GrSurfaceDesc& desc,
                                                    SkBackingFit fit,
@@ -196,32 +196,32 @@ sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(GrTextureProvider* texProvide
     copyDesc.fSampleCnt = SkTMin(desc.fSampleCnt, caps.maxSampleCount());
 
 #ifdef SK_DISABLE_DEFERRED_PROXIES
-    sk_sp<GrSurface> surf;
+    sk_sp<GrTexture> tex;
 
     if (SkBackingFit::kApprox == fit) {
-        surf.reset(texProvider->createApproxTexture(copyDesc));
+        tex.reset(texProvider->createApproxTexture(copyDesc));
     } else {
-        surf.reset(texProvider->createTexture(copyDesc, budgeted));
+        tex.reset(texProvider->createTexture(copyDesc, budgeted));
     }
 
-    if (!surf) {
+    if (!tex) {
         return nullptr;
     }
 
-    return GrSurfaceProxy::MakeWrapped(std::move(surf));
+    return GrSurfaceProxy::MakeWrapped(std::move(tex));
 #else
     if (willBeRT) {
         // We know anything we instantiate later from this deferred path will be
         // both texturable and renderable
-        return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(caps, copyDesc, fit,
+        return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(caps, copyDesc, fit,
                                                                     budgeted, flags));
     }
 
-    return sk_sp<GrSurfaceProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags));
+    return sk_sp<GrTextureProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags));
 #endif
 }
 
-sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
                                                    GrTextureProvider* texProvider,
                                                    const GrSurfaceDesc& desc,
                                                    SkBudgeted budgeted,
index ba089fa..6a4cca5 100644 (file)
@@ -218,10 +218,10 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
     desc.fHeight = kSize;
     desc.fConfig = kConfig;
 
-    sk_sp<GrSurfaceProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
+    sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                    context->textureProvider(),
                                                                    desc, SkBudgeted::kYes, data, 0);
-    if (!dataProxy || !dataProxy->asTextureProxy()) {
+    if (!dataProxy) {
         return;
     }
 
@@ -249,7 +249,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
         GrPaint paint2;
         GrPaint paint3;
         sk_sp<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
-                context, sk_ref_sp(dataProxy->asTextureProxy()), GrSwizzle::RGBA(),
+                context, dataProxy, GrSwizzle::RGBA(),
                 *pmToUPMRule, SkMatrix::I()));
         sk_sp<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
                 context, readRTC->asTextureProxyRef(), GrSwizzle::RGBA(),
index 19037d9..e1765d5 100644 (file)
@@ -73,14 +73,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(CopySurface, reporter, ctxInfo) {
                             dstDesc.fOrigin = dOrigin;
                             dstDesc.fFlags = dFlags;
 
-                            sk_sp<GrSurfaceProxy> src(GrSurfaceProxy::MakeDeferred(
+                            sk_sp<GrTextureProxy> src(GrSurfaceProxy::MakeDeferred(
                                                                     *context->caps(),
                                                                     context->textureProvider(),
                                                                     srcDesc, SkBudgeted::kNo,
                                                                     srcPixels.get(),
                                                                     kRowBytes));
 
-                            sk_sp<GrSurfaceProxy> dst(GrSurfaceProxy::MakeDeferred(
+                            sk_sp<GrTextureProxy> dst(GrSurfaceProxy::MakeDeferred(
                                                                     *context->caps(),
                                                                     context->textureProvider(),
                                                                     dstDesc, SkBudgeted::kNo,
index a337208..9e63c03 100644 (file)
@@ -202,12 +202,11 @@ static sk_sp<GrTextureProxy> create_proxy(GrContext* context) {
     desc.fWidth  = kFullSize;
     desc.fHeight = kFullSize;
 
-    sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
-                                                               context->textureProvider(),
-                                                               desc, SkBudgeted::kYes,
-                                                               srcBM.getPixels(),
-                                                               srcBM.rowBytes());
-    return sk_ref_sp(proxy->asTextureProxy());
+    return GrSurfaceProxy::MakeDeferred(*context->caps(),
+                                        context->textureProvider(),
+                                        desc, SkBudgeted::kYes,
+                                        srcBM.getPixels(),
+                                        srcBM.rowBytes());
 }
 
 
index 4642e31..518e195 100644 (file)
@@ -70,17 +70,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
     }
 
     // Test that we can create an integer texture.
-    sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
-                                                                context->textureProvider(),
-                                                                desc, SkBudgeted::kYes,
-                                                                testData.get(),
-                                                                kRowBytes);
+    sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
+                                                               context->textureProvider(),
+                                                               desc, SkBudgeted::kYes,
+                                                               testData.get(),
+                                                               kRowBytes);
     REPORTER_ASSERT(reporter, proxy);
-    if (!proxy || !proxy->asTextureProxy()) {
+    if (!proxy) {
         return;
     }
 
-    GrTexture* texture = proxy->asTextureProxy()->instantiate(context->textureProvider());
+    GrTexture* texture = proxy->instantiate(context->textureProvider());
     REPORTER_ASSERT(reporter, texture);
     if (!texture) {
         return;
index 9d73805..05be7bb 100644 (file)
@@ -118,7 +118,7 @@ inline void testingOnly_getIORefCnts(const T* resource, int* refCnt, int* readCn
     *writeCnt = resource->fPendingWrites;
 }
 
-void testingOnly_getIORefCnts(GrSurfaceProxy* proxy, int* refCnt, int* readCnt, int* writeCnt) {
+void testingOnly_getIORefCnts(GrTextureProxy* proxy, int* refCnt, int* readCnt, int* writeCnt) {
     *refCnt = proxy->getBackingRefCnt_TestOnly();
     *readCnt = proxy->getPendingReadCnt_TestOnly();
     *writeCnt = proxy->getPendingWriteCnt_TestOnly();
@@ -138,7 +138,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
         {
             bool texelBufferSupport = context->caps()->shaderCaps()->texelBufferSupport();
             bool imageLoadStoreSupport = context->caps()->shaderCaps()->imageLoadStoreSupport();
-            sk_sp<GrSurfaceProxy> proxy1(GrSurfaceProxy::MakeDeferred(context->textureProvider(),
+            sk_sp<GrTextureProxy> proxy1(GrSurfaceProxy::MakeDeferred(context->textureProvider(),
                                                                       *context->caps(), desc,
                                                                       SkBackingFit::kExact,
                                                                       SkBudgeted::kYes));
@@ -157,7 +157,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
                 SkTArray<sk_sp<GrTextureProxy>> proxies;
                 SkTArray<sk_sp<GrBuffer>> buffers;
                 SkTArray<TestFP::Image> images;
-                proxies.push_back(sk_ref_sp(proxy1->asTextureProxy()));
+                proxies.push_back(proxy1);
                 if (texelBufferSupport) {
                     buffers.push_back(buffer);
                 }
@@ -312,7 +312,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
     }
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
-    sk_sp<GrSurfaceProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
+    sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                    context->textureProvider(),
                                                                    desc, SkBudgeted::kYes,
                                                                    rgbaData.get(),
@@ -335,7 +335,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
                 !fp->compatibleWithCoverageAsAlpha()) {
                 continue;
             }
-            test_draw_op(context, rtc.get(), fp, sk_ref_sp(dataProxy->asTextureProxy()));
+            test_draw_op(context, rtc.get(), fp, dataProxy);
             memset(rgbaData.get(), 0x0, sizeof(GrColor) * 256 * 256);
             rtc->readPixels(
                     SkImageInfo::Make(256, 256, kRGBA_8888_SkColorType, kPremul_SkAlphaType),
index 4504a65..468ddd9 100644 (file)
@@ -128,12 +128,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
     desc.fConfig = kRGBA_8888_GrPixelConfig;
 
     {
-        sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
-                                                                  SkBackingFit::kApprox,
-                                                                  SkBudgeted::kYes));
+        sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
+                                                                 SkBackingFit::kApprox,
+                                                                 SkBudgeted::kYes));
 
         // Both RenderTarget and Texture
-        GrRenderTargetProxy* rtProxy = sProxy->asRenderTargetProxy();
+        GrRenderTargetProxy* rtProxy = proxy->asRenderTargetProxy();
         REPORTER_ASSERT(reporter, rtProxy);
         GrTextureProxy* tProxy = rtProxy->asTextureProxy();
         REPORTER_ASSERT(reporter, tProxy);
@@ -142,12 +142,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
     }
     
     {
-        sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
-                                                                  SkBackingFit::kApprox,
-                                                                  SkBudgeted::kYes));
+        sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
+                                                                 SkBackingFit::kApprox,
+                                                                 SkBudgeted::kYes));
 
         // Both RenderTarget and Texture - but via GrTextureProxy
-        GrTextureProxy* tProxy = sProxy->asTextureProxy();
+        GrTextureProxy* tProxy = proxy->asTextureProxy();
         REPORTER_ASSERT(reporter, tProxy);
         GrRenderTargetProxy* rtProxy = tProxy->asRenderTargetProxy();
         REPORTER_ASSERT(reporter, rtProxy);
@@ -158,12 +158,12 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DefferredProxyConversionTest, reporter, ctxIn
     {
         desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
 
-        sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
-                                                                  SkBackingFit::kApprox,
-                                                                  SkBudgeted::kYes));
+        sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(texProvider, caps, desc,
+                                                                 SkBackingFit::kApprox,
+                                                                 SkBudgeted::kYes));
 
         // Texture-only
-        GrTextureProxy* tProxy = sProxy->asTextureProxy();
+        GrTextureProxy* tProxy = proxy->asTextureProxy();
         REPORTER_ASSERT(reporter, tProxy);
         REPORTER_ASSERT(reporter, tProxy->asTextureProxy() == tProxy);
         REPORTER_ASSERT(reporter, !tProxy->asRenderTargetProxy());
index ac32752..367ec0c 100644 (file)
@@ -140,25 +140,25 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
                                     tex.reset(provider->createTexture(desc, budgeted));
                                 }
 
-                                sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(
+                                sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(
                                                                                 provider,
                                                                                 caps, desc,
                                                                                 fit, budgeted));
-                                REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(sProxy));
-                                if (sProxy) {
-                                    REPORTER_ASSERT(reporter, sProxy->asRenderTargetProxy());
+                                REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
+                                if (proxy) {
+                                    REPORTER_ASSERT(reporter, proxy->asRenderTargetProxy());
                                     // This forces the proxy to compute and cache its
                                     // pre-instantiation size guess. Later, when it is actually
                                     // instantiated, it checks that the instantiated size is <= to
                                     // the pre-computation. If the proxy never computed its
                                     // pre-instantiation size then the check is skipped.
-                                    sProxy->gpuMemorySize();
+                                    proxy->gpuMemorySize();
 
-                                    check_surface(reporter, sProxy.get(), origin,
+                                    check_surface(reporter, proxy.get(), origin,
                                                   widthHeight, widthHeight, config,
                                                   kInvalidResourceID, budgeted);
                                     check_rendertarget(reporter, caps, provider,
-                                                       sProxy->asRenderTargetProxy(),
+                                                       proxy->asRenderTargetProxy(),
                                                        SkTMin(numSamples, caps.maxSampleCount()),
                                                        fit, caps.maxWindowRectangles(), false);
                                 }
@@ -174,24 +174,24 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
                                     tex.reset(provider->createTexture(desc, budgeted));
                                 }
 
-                                sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(provider,
+                                sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(provider,
                                                                                           caps,
                                                                                           desc,
                                                                                           fit,
                                                                                           budgeted));
-                                REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(sProxy));
-                                if (sProxy) {
+                                REPORTER_ASSERT(reporter, SkToBool(tex) == SkToBool(proxy));
+                                if (proxy) {
                                     // This forces the proxy to compute and cache its pre-instantiation
                                     // size guess. Later, when it is actually instantiated, it checks
                                     // that the instantiated size is <= to the pre-computation.
                                     // If the proxy never computed its pre-instantiation size then the
                                     // check is skipped.
-                                    sProxy->gpuMemorySize();
+                                    proxy->gpuMemorySize();
 
-                                    check_surface(reporter, sProxy.get(), origin,
+                                    check_surface(reporter, proxy.get(), origin,
                                                   widthHeight, widthHeight, config,
                                                   kInvalidResourceID, budgeted);
-                                    check_texture(reporter, provider, sProxy->asTextureProxy(),
+                                    check_texture(reporter, provider, proxy->asTextureProxy(),
                                                   fit, false);
                                 }
                             }
index 613f45f..bfef33f 100644 (file)
@@ -56,17 +56,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
         // We are initializing the texture with zeros here
         memset(alphaData, 0, X_SIZE * Y_SIZE);
 
-        sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
-                                                                  context->textureProvider(),
-                                                                  desc,
-                                                                  SkBudgeted::kNo,
-                                                                  alphaData, 0));
-        if (!sProxy) {
+        sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
+                                                                 context->textureProvider(),
+                                                                 desc,
+                                                                 SkBudgeted::kNo,
+                                                                 alphaData, 0));
+        if (!proxy) {
             ERRORF(reporter, "Could not create alpha texture.");
             return;
         }
         sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeWrappedSurfaceContext(
-                                                                  sProxy, nullptr));
+                                                                  std::move(proxy), nullptr));
 
         const SkImageInfo ii = SkImageInfo::MakeA8(X_SIZE, Y_SIZE);
         sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, ii));
index dd87f19..7865690 100644 (file)
@@ -119,7 +119,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
     desc.fHeight = texS;
 
     GrTextureProvider* texProvider = context->textureProvider();
-    sk_sp<GrSurfaceProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(), texProvider,
+    sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(*context->caps(), texProvider,
                                                                desc, SkBudgeted::kNo,
                                                                texData, 0);
 
@@ -135,7 +135,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
     GrPaint paint;
     paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
     GrSamplerParams mipMapParams(SkShader::kRepeat_TileMode, GrSamplerParams::kMipMap_FilterMode);
-    paint.addColorTextureProcessor(context, sk_ref_sp(proxy->asTextureProxy()),
+    paint.addColorTextureProcessor(context, std::move(proxy),
                                    nullptr, SkMatrix::MakeScale(rtS), mipMapParams);
 
     // 1) Draw texture to S32 surface (should generate/use sRGB mips)
index 77015c4..82dd019 100644 (file)
@@ -233,21 +233,19 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo)
         // gpu
         const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
 
-        sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
+        sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                  context->textureProvider(),
                                                                  desc, SkBudgeted::kNo,
                                                                  bm.getPixels(), bm.rowBytes()));
-        if (!proxy || !proxy->asTextureProxy()) {
+        if (!proxy) {
             return;
         }
 
         sk_sp<SkSpecialImage> gpuImage(SkSpecialImage::MakeDeferredFromGpu(
-                                                                context,
-                                                                SkIRect::MakeWH(kFullSize,
-                                                                                kFullSize),
-                                                                kNeedNewImageUniqueID_SpecialImage,
-                                                                sk_ref_sp(proxy->asTextureProxy()),
-                                                                nullptr));
+                                                            context,
+                                                            SkIRect::MakeWH(kFullSize, kFullSize),
+                                                            kNeedNewImageUniqueID_SpecialImage,
+                                                            std::move(proxy), nullptr));
 
         {
             sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context));
@@ -269,11 +267,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
 
     const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps());
 
-    sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
+    sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                              context->textureProvider(),
                                                              desc, SkBudgeted::kNo,
                                                              bm.getPixels(), bm.rowBytes()));
-    if (!proxy || !proxy->asTextureProxy()) {
+    if (!proxy) {
         return;
     }
 
@@ -281,18 +279,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
                                                             context,
                                                             SkIRect::MakeWH(kFullSize, kFullSize),
                                                             kNeedNewImageUniqueID_SpecialImage,
-                                                            sk_ref_sp(proxy->asTextureProxy()),
-                                                            nullptr));
+                                                            proxy, nullptr));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
     {
         sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeDeferredFromGpu(
-                                                               context,
-                                                               subset,
+                                                               context, subset,
                                                                kNeedNewImageUniqueID_SpecialImage,
-                                                               sk_ref_sp(proxy->asTextureProxy()),
-                                                               nullptr));
+                                                               std::move(proxy), nullptr));
         test_image(subSImg1, reporter, context, true, kPad, kFullSize);
     }
 
@@ -312,7 +307,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_DeferredGpu, reporter, ctxInfo)
     desc.fWidth  = kFullSize;
     desc.fHeight = kFullSize;
 
-    sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
+    sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                              context->textureProvider(),
                                                              desc, SkBudgeted::kNo,
                                                              bm.getPixels(), 0));
@@ -324,18 +319,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_DeferredGpu, reporter, ctxInfo)
                                                             context,
                                                             SkIRect::MakeWH(kFullSize, kFullSize),
                                                             kNeedNewImageUniqueID_SpecialImage,
-                                                            sk_ref_sp(proxy->asTextureProxy()),
-                                                            nullptr));
+                                                            proxy, nullptr));
 
     const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
 
     {
         sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeDeferredFromGpu(
-                                                               context,
-                                                               subset,
+                                                               context, subset,
                                                                kNeedNewImageUniqueID_SpecialImage,
-                                                               sk_ref_sp(proxy->asTextureProxy()),
-                                                               nullptr));
+                                                               std::move(proxy), nullptr));
         test_image(subSImg1, reporter, context, true, kPad, kFullSize);
     }
 
index b809a67..0e6e7b0 100644 (file)
@@ -106,7 +106,7 @@ void test_copy_to_surface(skiatest::Reporter* reporter, GrContext* context,
     for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) {
         copySrcDesc.fFlags = flags;
 
-        sk_sp<GrSurfaceProxy> src(GrSurfaceProxy::MakeDeferred(*context->caps(),
+        sk_sp<GrTextureProxy> src(GrSurfaceProxy::MakeDeferred(*context->caps(),
                                                                context->textureProvider(),
                                                                copySrcDesc,
                                                                SkBudgeted::kYes, pixels.get(), 0));