From 6738c702423226619ee0172c12a3a007c5f68e57 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Wed, 27 Jul 2016 12:13:51 -0700 Subject: [PATCH] Rename GrContext's newDrawContext & drawContext to makeDrawContext These both return sk_sp. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2186073002 Review-Url: https://codereview.chromium.org/2186073002 --- include/gpu/GrContext.h | 20 ++++---- src/core/SkImageFilter.cpp | 8 ++-- src/core/SkSpecialSurface.cpp | 6 +-- src/effects/SkAlphaThresholdFilter.cpp | 6 +-- src/effects/SkDisplacementMapEffect.cpp | 4 +- src/effects/SkGpuBlurUtils.cpp | 12 ++--- src/effects/SkLightingImageFilter.cpp | 10 ++-- src/effects/SkMorphologyImageFilter.cpp | 16 +++---- src/effects/SkXfermodeImageFilter.cpp | 8 ++-- src/gpu/GrBlurUtils.cpp | 12 ++--- src/gpu/GrClipMaskManager.cpp | 8 ++-- src/gpu/GrContext.cpp | 30 ++++++------ src/gpu/GrRenderTarget.cpp | 2 +- src/gpu/GrTextureParamsAdjuster.cpp | 4 +- src/gpu/GrTextureToYUVPlanes.cpp | 30 ++++++------ src/gpu/GrYUVProvider.cpp | 8 ++-- src/gpu/SkGpuDevice.cpp | 26 +++++------ src/gpu/effects/GrConfigConversionEffect.cpp | 8 ++-- src/gpu/text/GrAtlasTextContext.cpp | 4 +- src/image/SkImage_Gpu.cpp | 12 ++--- tests/ClearTest.cpp | 2 +- tests/DFPathRendererTest.cpp | 18 ++++---- tests/GLProgramsTest.cpp | 24 +++++----- tests/PrimitiveProcessorTest.cpp | 6 +-- tests/RectangleTextureTest.cpp | 4 +- tests/SRGBMipMapTest.cpp | 12 ++--- tests/TessellatingPathRendererTests.cpp | 48 ++++++++++---------- 27 files changed, 174 insertions(+), 174 deletions(-) diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h index b156ba6173..deddb462d6 100644 --- a/include/gpu/GrContext.h +++ b/include/gpu/GrContext.h @@ -189,22 +189,22 @@ public: * * @return a draw context */ - sk_sp drawContext(sk_sp rt, sk_sp colorSpace, - const SkSurfaceProps* = nullptr); + sk_sp makeDrawContext(sk_sp rt, sk_sp colorSpace, + const SkSurfaceProps* = nullptr); /** * Create both a GrRenderTarget and a matching GrDrawContext to wrap it. * We guarantee that "asTexture" will succeed for drawContexts created * via this entry point. */ - sk_sp newDrawContext(SkBackingFit fit, - int width, int height, - GrPixelConfig config, - sk_sp colorSpace, - int sampleCnt = 0, - GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin, - const SkSurfaceProps* surfaceProps = nullptr, - SkBudgeted = SkBudgeted::kYes); + sk_sp makeDrawContext(SkBackingFit fit, + int width, int height, + GrPixelConfig config, + sk_sp colorSpace, + int sampleCnt = 0, + GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin, + const SkSurfaceProps* surfaceProps = nullptr, + SkBudgeted = SkBudgeted::kYes); /////////////////////////////////////////////////////////////////////////// // Misc. diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 49278254c2..bf6fa96540 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -281,10 +281,10 @@ sk_sp SkImageFilter::DrawWithFP(GrContext* context, paint.addColorFragmentProcessor(std::move(fp)); paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - bounds.width(), bounds.height(), - kRGBA_8888_GrPixelConfig, - std::move(colorSpace))); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + bounds.width(), bounds.height(), + kRGBA_8888_GrPixelConfig, + std::move(colorSpace))); if (!drawContext) { return nullptr; } diff --git a/src/core/SkSpecialSurface.cpp b/src/core/SkSpecialSurface.cpp index 02f54d8eac..4c482dfffb 100644 --- a/src/core/SkSpecialSurface.cpp +++ b/src/core/SkSpecialSurface.cpp @@ -161,9 +161,9 @@ sk_sp SkSpecialSurface::MakeRenderTarget(GrContext* context, return nullptr; } - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - width, height, config, - std::move(colorSpace))); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + width, height, config, + std::move(colorSpace))); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index f2b74300db..0871d2bc6e 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -102,9 +102,9 @@ sk_sp SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex config = kRGBA_8888_GrPixelConfig; } - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - bounds.width(), bounds.height(), - config, nullptr)); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + bounds.width(), bounds.height(), + config, nullptr)); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 9370a9fc93..df4103cf06 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -336,8 +336,8 @@ sk_sp SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y())); sk_sp drawContext( - context->newDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(), - kSkia8888_GrPixelConfig, sk_ref_sp(source->getColorSpace()))); + context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(), + kSkia8888_GrPixelConfig, sk_ref_sp(source->getColorSpace()))); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp index aad1c3f24a..869cd76c5b 100644 --- a/src/effects/SkGpuBlurUtils.cpp +++ b/src/effects/SkGpuBlurUtils.cpp @@ -226,9 +226,9 @@ sk_sp GaussianBlur(GrContext* context, const int height = dstBounds.height(); const GrPixelConfig config = srcTexture->config(); - sk_sp dstDrawContext(context->newDrawContext(SkBackingFit::kApprox, - width, height, config, colorSpace, - 0, kDefault_GrSurfaceOrigin)); + sk_sp dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox, + width, height, config, colorSpace, + 0, kDefault_GrSurfaceOrigin)); if (!dstDrawContext) { return nullptr; } @@ -246,9 +246,9 @@ sk_sp GaussianBlur(GrContext* context, return dstDrawContext; } - sk_sp tmpDrawContext(context->newDrawContext(SkBackingFit::kApprox, - width, height, config, colorSpace, - 0, kDefault_GrSurfaceOrigin)); + sk_sp tmpDrawContext(context->makeDrawContext(SkBackingFit::kApprox, + width, height, config, colorSpace, + 0, kDefault_GrSurfaceOrigin)); if (!tmpDrawContext) { return nullptr; } diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index ebe80b0c2c..a9e833539c 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -408,11 +408,11 @@ sk_sp SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma sk_sp inputTexture(input->asTextureRef(context)); SkASSERT(inputTexture); - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - offsetBounds.width(), - offsetBounds.height(), - kRGBA_8888_GrPixelConfig, - sk_ref_sp(source->getColorSpace()))); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + offsetBounds.width(), + offsetBounds.height(), + kRGBA_8888_GrPixelConfig, + sk_ref_sp(source->getColorSpace()))); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 7e27249a13..d5c3a2d190 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -485,10 +485,10 @@ static sk_sp apply_morphology(GrContext* context, SkASSERT(radius.width() > 0 || radius.height() > 0); if (radius.fWidth > 0) { - sk_sp dstDrawContext(context->newDrawContext(SkBackingFit::kApprox, - rect.width(), rect.height(), - kSkia8888_GrPixelConfig, - colorSpace)); + sk_sp dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox, + rect.width(), rect.height(), + kSkia8888_GrPixelConfig, + colorSpace)); if (!dstDrawContext) { return nullptr; } @@ -507,10 +507,10 @@ static sk_sp apply_morphology(GrContext* context, srcRect = dstRect; } if (radius.fHeight > 0) { - sk_sp dstDrawContext(context->newDrawContext(SkBackingFit::kApprox, - rect.width(), rect.height(), - kSkia8888_GrPixelConfig, - colorSpace)); + sk_sp dstDrawContext(context->makeDrawContext(SkBackingFit::kApprox, + rect.width(), rect.height(), + kSkia8888_GrPixelConfig, + colorSpace)); if (!dstDrawContext) { return nullptr; } diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index 6c3298d31c..c939a4a5e9 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -241,10 +241,10 @@ sk_sp SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - bounds.width(), bounds.height(), - kSkia8888_GrPixelConfig, - sk_ref_sp(source->getColorSpace()))); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + bounds.width(), bounds.height(), + kSkia8888_GrPixelConfig, + sk_ref_sp(source->getColorSpace()))); if (!drawContext) { return nullptr; } diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 48aa28be70..441e56631c 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -109,12 +109,12 @@ static sk_sp create_mask_GPU(GrContext* context, config = kAlpha_8_GrPixelConfig; } - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - maskRect.width(), - maskRect.height(), - config, - nullptr, - sampleCnt)); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + maskRect.width(), + maskRect.height(), + config, + nullptr, + sampleCnt)); if (!drawContext) { return nullptr; } diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index 67c6f6eac3..b2b3603b94 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -462,10 +462,10 @@ sk_sp GrClipMaskManager::CreateAlphaClipMask(GrContext* context, config = kAlpha_8_GrPixelConfig; } - sk_sp dc(context->newDrawContext(SkBackingFit::kApprox, - clipSpaceIBounds.width(), - clipSpaceIBounds.height(), - config, nullptr)); + sk_sp dc(context->makeDrawContext(SkBackingFit::kApprox, + clipSpaceIBounds.width(), + clipSpaceIBounds.height(), + config, nullptr)); if (!dc) { return nullptr; } diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 457e33b99a..cbee2874ed 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -360,7 +360,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface, // TODO: Need to decide the semantics of this function for color spaces. Do we support // conversion from a passed-in color space? For now, specifying nullptr means that this // path will do no conversion, so it will match the behavior of the non-draw path. - sk_sp drawContext(this->drawContext(sk_ref_sp(renderTarget), nullptr)); + sk_sp drawContext(this->makeDrawContext(sk_ref_sp(renderTarget), nullptr)); if (!drawContext) { return false; } @@ -450,7 +450,7 @@ bool GrContext::readSurfacePixels(GrSurface* src, // TODO: Need to decide the semantics of this function for color spaces. Do we support // conversion to a passed-in color space? For now, specifying nullptr means that this // path will do no conversion, so it will match the behavior of the non-draw path. - sk_sp tempDC = this->newDrawContext(tempDrawInfo.fTempSurfaceFit, + sk_sp tempDC = this->makeDrawContext(tempDrawInfo.fTempSurfaceFit, tempDrawInfo.fTempSurfaceDesc.fWidth, tempDrawInfo.fTempSurfaceDesc.fHeight, tempDrawInfo.fTempSurfaceDesc.fConfig, @@ -540,7 +540,7 @@ bool GrContext::applyGamma(GrRenderTarget* dst, GrTexture* src, SkScalar gamma){ } // TODO: Supply color space? - sk_sp drawContext(this->drawContext(sk_ref_sp(dst), nullptr)); + sk_sp drawContext(this->makeDrawContext(sk_ref_sp(dst), nullptr)); if (!drawContext) { return false; } @@ -602,7 +602,7 @@ bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe src->flushWrites(); return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint); } - sk_sp drawContext(this->drawContext(sk_ref_sp(dst->asRenderTarget()), nullptr)); + sk_sp drawContext(this->makeDrawContext(sk_ref_sp(dst->asRenderTarget()), nullptr)); if (!drawContext) { return false; } @@ -641,21 +641,21 @@ int GrContext::getRecommendedSampleCount(GrPixelConfig config, } -sk_sp GrContext::drawContext(sk_sp rt, +sk_sp GrContext::makeDrawContext(sk_sp rt, sk_sp colorSpace, const SkSurfaceProps* surfaceProps) { ASSERT_SINGLE_OWNER return fDrawingManager->drawContext(std::move(rt), std::move(colorSpace), surfaceProps); } -sk_sp GrContext::newDrawContext(SkBackingFit fit, - int width, int height, - GrPixelConfig config, - sk_sp colorSpace, - int sampleCnt, - GrSurfaceOrigin origin, - const SkSurfaceProps* surfaceProps, - SkBudgeted budgeted) { +sk_sp GrContext::makeDrawContext(SkBackingFit fit, + int width, int height, + GrPixelConfig config, + sk_sp colorSpace, + int sampleCnt, + GrSurfaceOrigin origin, + const SkSurfaceProps* surfaceProps, + SkBudgeted budgeted) { GrSurfaceDesc desc; desc.fFlags = kRenderTarget_GrSurfaceFlag; desc.fOrigin = origin; @@ -674,8 +674,8 @@ sk_sp GrContext::newDrawContext(SkBackingFit fit, return nullptr; } - sk_sp drawContext(this->drawContext(sk_ref_sp(tex->asRenderTarget()), - std::move(colorSpace), surfaceProps)); + sk_sp drawContext(this->makeDrawContext(sk_ref_sp(tex->asRenderTarget()), + std::move(colorSpace), surfaceProps)); if (!drawContext) { return nullptr; } diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp index 9eba1806c0..cccf9534f6 100644 --- a/src/gpu/GrRenderTarget.cpp +++ b/src/gpu/GrRenderTarget.cpp @@ -29,7 +29,7 @@ void GrRenderTarget::discard() { return; } - sk_sp drawContext(context->drawContext(sk_ref_sp(this), nullptr)); + sk_sp drawContext(context->makeDrawContext(sk_ref_sp(this), nullptr)); if (!drawContext) { return; } diff --git a/src/gpu/GrTextureParamsAdjuster.cpp b/src/gpu/GrTextureParamsAdjuster.cpp index c2f220c582..4456980e85 100644 --- a/src/gpu/GrTextureParamsAdjuster.cpp +++ b/src/gpu/GrTextureParamsAdjuster.cpp @@ -60,8 +60,8 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset, } } - sk_sp copyDC = context->newDrawContext(SkBackingFit::kExact, copyParams.fWidth, - copyParams.fHeight, config, nullptr); + sk_sp copyDC = context->makeDrawContext(SkBackingFit::kExact, copyParams.fWidth, + copyParams.fHeight, config, nullptr); if (!copyDC) { return nullptr; } diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp index 25a79e42f3..7a8647a867 100644 --- a/src/gpu/GrTextureToYUVPlanes.cpp +++ b/src/gpu/GrTextureToYUVPlanes.cpp @@ -69,34 +69,34 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons // sizes however we optimize for two other cases - all planes are the same (1 draw to YUV), // and U and V are the same but Y differs (2 draws, one for Y, one for UV). if (sizes[0] == sizes[1] && sizes[1] == sizes[2]) { - yuvDrawContext = context->newDrawContext(SkBackingFit::kApprox, - sizes[0].fWidth, sizes[0].fHeight, - kRGBA_8888_GrPixelConfig, nullptr); + yuvDrawContext = context->makeDrawContext(SkBackingFit::kApprox, + sizes[0].fWidth, sizes[0].fHeight, + kRGBA_8888_GrPixelConfig, nullptr); if (!yuvDrawContext) { return false; } } else { - yDrawContext = context->newDrawContext(SkBackingFit::kApprox, - sizes[0].fWidth, sizes[0].fHeight, - singleChannelPixelConfig, nullptr); + yDrawContext = context->makeDrawContext(SkBackingFit::kApprox, + sizes[0].fWidth, sizes[0].fHeight, + singleChannelPixelConfig, nullptr); if (!yDrawContext) { return false; } if (sizes[1] == sizes[2]) { // TODO: Add support for GL_RG when available. - uvDrawContext = context->newDrawContext(SkBackingFit::kApprox, - sizes[1].fWidth, sizes[1].fHeight, - kRGBA_8888_GrPixelConfig, nullptr); + uvDrawContext = context->makeDrawContext(SkBackingFit::kApprox, + sizes[1].fWidth, sizes[1].fHeight, + kRGBA_8888_GrPixelConfig, nullptr); if (!uvDrawContext) { return false; } } else { - uDrawContext = context->newDrawContext(SkBackingFit::kApprox, - sizes[1].fWidth, sizes[1].fHeight, - singleChannelPixelConfig, nullptr); - vDrawContext = context->newDrawContext(SkBackingFit::kApprox, - sizes[2].fWidth, sizes[2].fHeight, - singleChannelPixelConfig, nullptr); + uDrawContext = context->makeDrawContext(SkBackingFit::kApprox, + sizes[1].fWidth, sizes[1].fHeight, + singleChannelPixelConfig, nullptr); + vDrawContext = context->makeDrawContext(SkBackingFit::kApprox, + sizes[2].fWidth, sizes[2].fHeight, + singleChannelPixelConfig, nullptr); if (!uDrawContext || !vDrawContext) { return false; } diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp index e9b2ef5bf6..b187ec3888 100644 --- a/src/gpu/GrYUVProvider.cpp +++ b/src/gpu/GrYUVProvider.cpp @@ -114,10 +114,10 @@ sk_sp GrYUVProvider::refAsTexture(GrContext* ctx, } // We never want to perform color-space conversion during the decode - sk_sp drawContext(ctx->newDrawContext(SkBackingFit::kExact, - desc.fWidth, desc.fHeight, - desc.fConfig, nullptr, - desc.fSampleCnt)); + sk_sp drawContext(ctx->makeDrawContext(SkBackingFit::kExact, + desc.fWidth, desc.fHeight, + desc.fConfig, nullptr, + desc.fSampleCnt)); if (!drawContext) { return nullptr; } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index b81a94a194..de814ab883 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -104,8 +104,8 @@ sk_sp SkGpuDevice::Make(sk_sp rt, sk_spgetContext(); - sk_sp drawContext(context->drawContext(std::move(rt), std::move(colorSpace), - props)); + sk_sp drawContext(context->makeDrawContext(std::move(rt), std::move(colorSpace), + props)); return sk_sp(new SkGpuDevice(std::move(drawContext), width, height, flags)); } @@ -187,10 +187,10 @@ sk_sp SkGpuDevice::MakeDrawContext(GrContext* context, GrPixelConfig config = SkImageInfo2GrPixelConfig(ct, at, cs, *context->caps()); - return context->newDrawContext(SkBackingFit::kExact, // Why exact? - origInfo.width(), origInfo.height(), - config, sk_ref_sp(cs), sampleCount, - origin, surfaceProps, budgeted); + return context->makeDrawContext(SkBackingFit::kExact, // Why exact? + origInfo.width(), origInfo.height(), + config, sk_ref_sp(cs), sampleCount, + origin, surfaceProps, budgeted); } sk_sp SkGpuDevice::filterTexture(const SkDraw& draw, @@ -1745,13 +1745,13 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint SkBackingFit fit = kNever_TileUsage == cinfo.fTileUsage ? SkBackingFit::kApprox : SkBackingFit::kExact; - sk_sp dc(fContext->newDrawContext(fit, - cinfo.fInfo.width(), cinfo.fInfo.height(), - fDrawContext->config(), - sk_ref_sp(fDrawContext->getColorSpace()), - fDrawContext->desc().fSampleCnt, - kDefault_GrSurfaceOrigin, - &props)); + sk_sp dc(fContext->makeDrawContext(fit, + cinfo.fInfo.width(), cinfo.fInfo.height(), + fDrawContext->config(), + sk_ref_sp(fDrawContext->getColorSpace()), + fDrawContext->desc().fSampleCnt, + kDefault_GrSurfaceOrigin, + &props)); if (!dc) { SkErrorInternals::SetError( kInternalError_SkError, "---- failed to create gpu device texture [%d %d]\n", diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index f41e154556..2808af638f 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -173,10 +173,10 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context } } - sk_sp readDC(context->newDrawContext(SkBackingFit::kExact, kSize, kSize, - kConfig, nullptr)); - sk_sp tempDC(context->newDrawContext(SkBackingFit::kExact, kSize, kSize, - kConfig, nullptr)); + sk_sp readDC(context->makeDrawContext(SkBackingFit::kExact, kSize, kSize, + kConfig, nullptr)); + sk_sp tempDC(context->makeDrawContext(SkBackingFit::kExact, kSize, kSize, + kConfig, nullptr)); if (!readDC || !tempDC) { return; } diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index b46963cf51..285aea4d2a 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -389,8 +389,8 @@ DRAW_BATCH_TEST_DEFINE(TextBlobBatch) { } // Setup dummy SkPaint / GrPaint / GrDrawContext - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, 1024, 1024, - kSkia8888_GrPixelConfig, nullptr)); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, 1024, 1024, + kSkia8888_GrPixelConfig, nullptr)); GrColor color = GrRandomColor(random); SkMatrix viewMatrix = GrTest::TestMatrixInvertible(random); diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index c331a295ce..740963a824 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -250,12 +250,12 @@ static sk_sp make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac const int height = yuvSizes[0].fHeight; // Needs to be a render target in order to draw to it for the yuv->rgb conversion. - sk_sp drawContext(ctx->newDrawContext(SkBackingFit::kExact, - width, height, - kRGBA_8888_GrPixelConfig, - std::move(imageColorSpace), - 0, - origin)); + sk_sp drawContext(ctx->makeDrawContext(SkBackingFit::kExact, + width, height, + kRGBA_8888_GrPixelConfig, + std::move(imageColorSpace), + 0, + origin)); if (!drawContext) { return nullptr; } diff --git a/tests/ClearTest.cpp b/tests/ClearTest.cpp index 4afbabaa56..4dba4bbb95 100644 --- a/tests/ClearTest.cpp +++ b/tests/ClearTest.cpp @@ -45,7 +45,7 @@ static bool reset_dc(sk_sp* dc, GrContext* context, int w, int h) } context->freeGpuResources(); - *dc = context->newDrawContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig, nullptr); + *dc = context->makeDrawContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig, nullptr); SkASSERT((*dc)->accessRenderTarget()->getUniqueID() != oldID); diff --git a/tests/DFPathRendererTest.cpp b/tests/DFPathRendererTest.cpp index e1af6acd93..d36c16845e 100644 --- a/tests/DFPathRendererTest.cpp +++ b/tests/DFPathRendererTest.cpp @@ -63,22 +63,22 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(AADistanceFieldPathRenderer, reporter, ctxInfo) if (!ctxInfo.grContext()->caps()->shaderCaps()->shaderDerivativeSupport()) { return; } - sk_sp drawContext(ctxInfo.grContext()->newDrawContext(SkBackingFit::kApprox, - 800, 800, - kSkia8888_GrPixelConfig, - nullptr, - 0, - kTopLeft_GrSurfaceOrigin)); - if (!drawContext) { + sk_sp dc(ctxInfo.grContext()->makeDrawContext(SkBackingFit::kApprox, + 800, 800, + kSkia8888_GrPixelConfig, + nullptr, + 0, + kTopLeft_GrSurfaceOrigin)); + if (!dc) { return; } GrAADistanceFieldPathRenderer dfpr; GrTestTarget tt; - ctxInfo.grContext()->getTestTarget(&tt, drawContext); + ctxInfo.grContext()->getTestTarget(&tt, dc); GrResourceProvider* rp = tt.resourceProvider(); - test_far_from_origin(drawContext.get(), &dfpr, rp); + test_far_from_origin(dc.get(), &dfpr, rp); ctxInfo.grContext()->flush(); } #endif diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 393de53b74..2d62a5b3c3 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -154,13 +154,13 @@ static sk_sp random_draw_context(GrContext* context, : kBottomLeft_GrSurfaceOrigin; int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0; - sk_sp drawContext(context->newDrawContext(SkBackingFit::kExact, - kRenderTargetWidth, - kRenderTargetHeight, - kRGBA_8888_GrPixelConfig, - nullptr, - sampleCnt, - origin)); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kExact, + kRenderTargetWidth, + kRenderTargetHeight, + kRGBA_8888_GrPixelConfig, + nullptr, + sampleCnt, + origin)); return drawContext; } @@ -343,11 +343,11 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { drawingManager->flush(); // Validate that GrFPs work correctly without an input. - sk_sp drawContext(context->newDrawContext(SkBackingFit::kExact, - kRenderTargetWidth, - kRenderTargetHeight, - kRGBA_8888_GrPixelConfig, - nullptr)); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kExact, + kRenderTargetWidth, + kRenderTargetHeight, + kRGBA_8888_GrPixelConfig, + nullptr)); if (!drawContext) { SkDebugf("Could not allocate a drawContext"); return false; diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index acaf9e98af..7a080c57ac 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -104,9 +104,9 @@ private: DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { GrContext* context = ctxInfo.grContext(); - sk_sp drawContext(context->newDrawContext(SkBackingFit::kApprox, - 1, 1, kRGBA_8888_GrPixelConfig, - nullptr)); + sk_sp drawContext(context->makeDrawContext(SkBackingFit::kApprox, + 1, 1, kRGBA_8888_GrPixelConfig, + nullptr)); if (!drawContext) { ERRORF(reporter, "Could not create draw context."); return; diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index b42b3bac6c..2dbb888425 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -90,8 +90,8 @@ static void test_clear(skiatest::Reporter* reporter, GrContext* context, GrTexture* rectangleTexture) { if (rectangleTexture->asRenderTarget()) { sk_sp dc( - context->drawContext(sk_ref_sp(rectangleTexture->asRenderTarget()), - nullptr)); + context->makeDrawContext(sk_ref_sp(rectangleTexture->asRenderTarget()), + nullptr)); if (!dc) { ERRORF(reporter, "Could not get GrDrawContext for rectangle texture."); return; diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp index 12f23adbbf..6eb4b2114a 100644 --- a/tests/SRGBMipMapTest.cpp +++ b/tests/SRGBMipMapTest.cpp @@ -121,12 +121,12 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) { // Create two draw contexts (L32 and S32) sk_sp srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); - sk_sp l32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS, - kSkia8888_GrPixelConfig, - nullptr); - sk_sp s32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS, - kSkiaGamma8888_GrPixelConfig, - std::move(srgbColorSpace)); + sk_sp l32DrawContext = context->makeDrawContext(SkBackingFit::kExact, rtS, rtS, + kSkia8888_GrPixelConfig, + nullptr); + sk_sp s32DrawContext = context->makeDrawContext(SkBackingFit::kExact, rtS, rtS, + kSkiaGamma8888_GrPixelConfig, + std::move(srgbColorSpace)); SkRect rect = SkRect::MakeWH(SkIntToScalar(rtS), SkIntToScalar(rtS)); GrNoClip noClip; diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp index 5e8d952f32..d9afcc4d3d 100644 --- a/tests/TessellatingPathRendererTests.cpp +++ b/tests/TessellatingPathRendererTests.cpp @@ -254,35 +254,35 @@ static void test_path(GrDrawContext* drawContext, GrResourceProvider* rp, const } DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) { - sk_sp drawContext(ctxInfo.grContext()->newDrawContext(SkBackingFit::kApprox, - 800, 800, - kSkia8888_GrPixelConfig, - nullptr, - 0, - kTopLeft_GrSurfaceOrigin)); - if (!drawContext) { + sk_sp dc(ctxInfo.grContext()->makeDrawContext(SkBackingFit::kApprox, + 800, 800, + kSkia8888_GrPixelConfig, + nullptr, + 0, + kTopLeft_GrSurfaceOrigin)); + if (!dc) { return; } GrTestTarget tt; - ctxInfo.grContext()->getTestTarget(&tt, drawContext); + ctxInfo.grContext()->getTestTarget(&tt, dc); GrResourceProvider* rp = tt.resourceProvider(); - test_path(drawContext.get(), rp, create_path_0()); - test_path(drawContext.get(), rp, create_path_1()); - test_path(drawContext.get(), rp, create_path_2()); - test_path(drawContext.get(), rp, create_path_3()); - test_path(drawContext.get(), rp, create_path_4()); - test_path(drawContext.get(), rp, create_path_5()); - test_path(drawContext.get(), rp, create_path_6()); - test_path(drawContext.get(), rp, create_path_7()); - test_path(drawContext.get(), rp, create_path_8()); - test_path(drawContext.get(), rp, create_path_9()); - test_path(drawContext.get(), rp, create_path_10()); - test_path(drawContext.get(), rp, create_path_11()); - test_path(drawContext.get(), rp, create_path_12()); - test_path(drawContext.get(), rp, create_path_13()); - test_path(drawContext.get(), rp, create_path_14()); - test_path(drawContext.get(), rp, create_path_15()); + test_path(dc.get(), rp, create_path_0()); + test_path(dc.get(), rp, create_path_1()); + test_path(dc.get(), rp, create_path_2()); + test_path(dc.get(), rp, create_path_3()); + test_path(dc.get(), rp, create_path_4()); + test_path(dc.get(), rp, create_path_5()); + test_path(dc.get(), rp, create_path_6()); + test_path(dc.get(), rp, create_path_7()); + test_path(dc.get(), rp, create_path_8()); + test_path(dc.get(), rp, create_path_9()); + test_path(dc.get(), rp, create_path_10()); + test_path(dc.get(), rp, create_path_11()); + test_path(dc.get(), rp, create_path_12()); + test_path(dc.get(), rp, create_path_13()); + test_path(dc.get(), rp, create_path_14()); + test_path(dc.get(), rp, create_path_15()); } #endif