Move more internal methods from GrContext to GrContextPriv (take 3)
Change-Id: Ied630e61cf95780bf85032867e6ce663e1ef9c2f
Reviewed-on: https://skia-review.googlesource.com/98000
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index df1e8ee..006fd00 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -37,12 +37,14 @@
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<GrTextureProxy> proxy;
@@ -69,7 +71,7 @@
}
REPORTER_ASSERT(reporter, proxy);
if (!proxy) {
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
return;
}
@@ -78,7 +80,7 @@
GrTexture* texture = proxy->priv().peekTexture();
REPORTER_ASSERT(reporter, texture);
if (!texture) {
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
return;
}
@@ -92,7 +94,7 @@
} else {
REPORTER_ASSERT(reporter, GrMipMapped::kNo == texture->texturePriv().mipMapped());
}
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
}
}
@@ -104,9 +106,11 @@
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<SkImage> image = SkImage::MakeFromTexture(context, backendTex,
@@ -118,7 +122,7 @@
GrTextureProxy* proxy = as_IB(image)->peekProxy();
REPORTER_ASSERT(reporter, proxy);
if (!proxy) {
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
return;
}
@@ -127,7 +131,7 @@
sk_sp<GrTexture> 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 @@
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 @@
REPORTER_ASSERT(reporter, genProxy);
if (!genProxy) {
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
return;
}
@@ -164,7 +168,7 @@
GrTexture* genTexture = genProxy->priv().peekTexture();
REPORTER_ASSERT(reporter, genTexture);
if (!genTexture) {
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
return;
}
@@ -202,7 +206,7 @@
bitmap.allocPixels(imageInfo);
surfContext->readPixels(imageInfo, bitmap.getPixels(), 0, 0, 0, 0);
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
}
}
@@ -216,12 +220,13 @@
}
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<SkSurface> 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 @@
}
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 @@
sk_sp<SkImage> 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 @@
// 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);
}
}
}