From f440cecbfdf1910104f36aedd0e963da2ae8b6a8 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Fri, 19 Jan 2018 11:51:20 -0500 Subject: Move more internal methods from GrContext to GrContextPriv TBR=bsalomon@google.com Change-Id: Ia8cf0e0d30451c69bc7a08215aafa6abe6e0ddbe Reviewed-on: https://skia-review.googlesource.com/97080 Commit-Queue: Robert Phillips Reviewed-by: Greg Daniel --- tests/GrMipMappedTest.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'tests/GrMipMappedTest.cpp') diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp index df1e8ee901..006fd00a28 100644 --- a/tests/GrMipMappedTest.cpp +++ b/tests/GrMipMappedTest.cpp @@ -37,12 +37,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { if (!context->caps()->mipMapSupport()) { return; } + GrGpu* gpu = context->contextPriv().getGpu(); + for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) { for (auto isRT : {false, true}) { // CreateTestingOnlyBackendTexture currently doesn't support uploading data to mip maps // so we don't send any. However, we pretend there is data for the checks below which is // fine since we are never actually using these textures for any work on the gpu. - GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture( + GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig, isRT, mipMapped); sk_sp proxy; @@ -69,7 +71,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { } REPORTER_ASSERT(reporter, proxy); if (!proxy) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -78,7 +80,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { GrTexture* texture = proxy->priv().peekTexture(); REPORTER_ASSERT(reporter, texture); if (!texture) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -92,7 +94,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrWrappedMipMappedTest, reporter, ctxInfo) { } else { REPORTER_ASSERT(reporter, GrMipMapped::kNo == texture->texturePriv().mipMapped()); } - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); } } } @@ -104,9 +106,11 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, if (!context->caps()->mipMapSupport()) { return; } + GrGpu* gpu = context->contextPriv().getGpu(); + for (auto mipMapped : {GrMipMapped::kNo, GrMipMapped::kYes}) { for (auto willUseMips : {false, true}) { - GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture( + GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig, false, mipMapped); sk_sp image = SkImage::MakeFromTexture(context, backendTex, @@ -118,7 +122,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, GrTextureProxy* proxy = as_IB(image)->peekProxy(); REPORTER_ASSERT(reporter, proxy); if (!proxy) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -127,7 +131,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, sk_sp texture = sk_ref_sp(proxy->priv().peekTexture()); REPORTER_ASSERT(reporter, texture); if (!texture) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -135,7 +139,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, texture, kTopLeft_GrSurfaceOrigin, nullptr, kPremul_SkAlphaType, nullptr); REPORTER_ASSERT(reporter, imageGen); if (!imageGen) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -151,7 +155,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, REPORTER_ASSERT(reporter, genProxy); if (!genProxy) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -164,7 +168,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, GrTexture* genTexture = genProxy->priv().peekTexture(); REPORTER_ASSERT(reporter, genTexture); if (!genTexture) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); return; } @@ -202,7 +206,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter, bitmap.allocPixels(imageInfo); surfContext->readPixels(imageInfo, bitmap.getPixels(), 0, 0, 0, 0); - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); } } } @@ -216,12 +220,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn } auto resourceProvider = context->contextPriv().resourceProvider(); + GrGpu* gpu = context->contextPriv().getGpu(); for (auto willUseMips : {false, true}) { for (auto isWrapped : {false, true}) { GrMipMapped mipMapped = willUseMips ? GrMipMapped::kYes : GrMipMapped::kNo; sk_sp surface; - GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture( + GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture( nullptr, kSize, kSize, kRGBA_8888_GrPixelConfig, true, mipMapped); if (isWrapped) { surface = SkSurface::MakeFromBackendTexture(context, @@ -240,7 +245,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn } REPORTER_ASSERT(reporter, surface); if (!surface) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); } SkGpuDevice* device = ((SkSurface_Gpu*)surface.get())->getDevice(); GrTextureProxy* texProxy = device->accessRenderTargetContext()->asTextureProxy(); @@ -253,7 +258,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn sk_sp image = surface->makeImageSnapshot(); REPORTER_ASSERT(reporter, image); if (!image) { - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); } texProxy = as_IB(image)->peekProxy(); REPORTER_ASSERT(reporter, mipMapped == texProxy->mipMapped()); @@ -265,7 +270,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrImageSnapshotMipMappedTest, reporter, ctxIn // Must flush the context to make sure all the cmds (copies, etc.) from above are sent // to the gpu before we delete the backendHandle. context->flush(); - context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex); + gpu->deleteTestingOnlyBackendTexture(&backendTex); } } } -- cgit v1.2.3