From 2f49314227053dd5acc011e04681faee05c5e0ff Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Thu, 2 Mar 2017 18:18:38 -0500 Subject: Make GrSurface::MakeDeferred return sk_sp This should make upcoming changes less tedious Change-Id: I313ae9df724f109a64cf5708a974e8bfeb963025 Reviewed-on: https://skia-review.googlesource.com/9183 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- tests/SpecialImageTest.cpp | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) (limited to 'tests/SpecialImageTest.cpp') diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp index 77015c4aa2..82dd019dea 100644 --- a/tests/SpecialImageTest.cpp +++ b/tests/SpecialImageTest.cpp @@ -233,21 +233,19 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) // gpu const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info(), *context->caps()); - sk_sp proxy(GrSurfaceProxy::MakeDeferred(*context->caps(), + sk_sp proxy(GrSurfaceProxy::MakeDeferred(*context->caps(), context->textureProvider(), desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes())); - if (!proxy || !proxy->asTextureProxy()) { + if (!proxy) { return; } sk_sp 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 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 proxy(GrSurfaceProxy::MakeDeferred(*context->caps(), + sk_sp 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 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 proxy(GrSurfaceProxy::MakeDeferred(*context->caps(), + sk_sp 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 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); } -- cgit v1.2.3