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/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 7f0d997..c06ba24 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -584,15 +584,17 @@
#if SK_SUPPORT_GPU
static sk_sp<SkSurface> create_gpu_surface_backend_texture(
GrContext* context, int sampleCnt, uint32_t color, GrBackendTexture* outTexture) {
+ GrGpu* gpu = context->contextPriv().getGpu();
+
const int kWidth = 10;
const int kHeight = 10;
std::unique_ptr<uint32_t[]> pixels(new uint32_t[kWidth * kHeight]);
sk_memset32(pixels.get(), color, kWidth * kHeight);
- *outTexture = context->getGpu()->createTestingOnlyBackendTexture(
+ *outTexture = gpu->createTestingOnlyBackendTexture(
pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
- if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
+ if (!outTexture->isValid() || !gpu->isTestingOnlyBackendTexture(*outTexture)) {
return nullptr;
}
@@ -601,7 +603,7 @@
kRGBA_8888_SkColorType,
nullptr, nullptr);
if (!surface) {
- context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
+ gpu->deleteTestingOnlyBackendTexture(outTexture);
return nullptr;
}
return surface;
@@ -609,15 +611,17 @@
static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
GrContext* context, int sampleCnt, uint32_t color, GrBackendTexture* outTexture) {
+ GrGpu* gpu = context->contextPriv().getGpu();
+
const int kWidth = 10;
const int kHeight = 10;
std::unique_ptr<uint32_t[]> pixels(new uint32_t[kWidth * kHeight]);
sk_memset32(pixels.get(), color, kWidth * kHeight);
- *outTexture = context->getGpu()->createTestingOnlyBackendTexture(
+ *outTexture = gpu->createTestingOnlyBackendTexture(
pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
- if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
+ if (!outTexture->isValid() || !gpu->isTestingOnlyBackendTexture(*outTexture)) {
return nullptr;
}
@@ -626,7 +630,7 @@
nullptr, nullptr);
if (!surface) {
- context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
+ gpu->deleteTestingOnlyBackendTexture(outTexture);
return nullptr;
}
return surface;
@@ -674,6 +678,7 @@
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
+ GrGpu* gpu = context->contextPriv().getGpu();
std::function<sk_sp<GrSurfaceContext>(SkSurface*)> grSurfaceContextGetters[] = {
[] (SkSurface* s){
@@ -703,7 +708,7 @@
auto surface = surfaceFunc(context, 0, kOrigColor, &backendTex);
test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor);
surface.reset();
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
}
}
@@ -751,7 +756,7 @@
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
- GrGpu* gpu = ctxInfo.grContext()->getGpu();
+ GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
if (!gpu) {
return;
}
@@ -774,7 +779,7 @@
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInfo) {
- GrGpu* gpu = ctxInfo.grContext()->getGpu();
+ GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
if (!gpu) {
return;
}
@@ -875,6 +880,7 @@
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
+
bool f16Support = context->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig, false);
auto surfaceMaker = [context](const SkImageInfo& info) {
return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
@@ -884,14 +890,16 @@
std::vector<GrBackendTexture> backendTextures;
auto wrappedSurfaceMaker = [ context, &backendTextures ](const SkImageInfo& info) {
+ GrGpu* gpu = context->contextPriv().getGpu();
+
static const int kSize = 10;
GrPixelConfig config = SkImageInfo2GrPixelConfig(info, *context->caps());
- GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
+ GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
nullptr, kSize, kSize, config, true, GrMipMapped::kNo);
if (!backendTex.isValid() ||
- !context->getGpu()->isTestingOnlyBackendTexture(backendTex)) {
+ !gpu->isTestingOnlyBackendTexture(backendTex)) {
return sk_sp<SkSurface>(nullptr);
}
backendTextures.push_back(backendTex);
@@ -907,8 +915,9 @@
context->flush();
+ GrGpu* gpu = context->contextPriv().getGpu();
for (auto backendTex : backendTextures) {
- context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
+ gpu->deleteTestingOnlyBackendTexture(&backendTex);
}
}
#endif