aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SurfaceTest.cpp
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-01-19 18:18:20 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-19 18:18:24 +0000
commit07320e46c0064dc1fe876f4621e94cb9ad529f85 (patch)
tree45d4d7d185beaa1d58e4b67c7c9eb60d9892d86f /tests/SurfaceTest.cpp
parentb69a2f66448603c26b0265201cec7161cf6d6f75 (diff)
Revert "Move more internal methods from GrContext to GrContextPriv"
This reverts commit f440cecbfdf1910104f36aedd0e963da2ae8b6a8. Reason for revert: breaking android builds. Original change's description: > 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 <robertphillips@google.com> > Reviewed-by: Greg Daniel <egdaniel@google.com> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com Change-Id: If263f8161f0fbe3fc6ee8f34bb09e237705c3694 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/97200 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'tests/SurfaceTest.cpp')
-rw-r--r--tests/SurfaceTest.cpp33
1 files changed, 12 insertions, 21 deletions
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index c06ba240ed..7f0d9973b5 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -584,17 +584,15 @@ DEF_TEST(surface_raster_zeroinitialized, reporter) {
#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 = gpu->createTestingOnlyBackendTexture(
+ *outTexture = context->getGpu()->createTestingOnlyBackendTexture(
pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
- if (!outTexture->isValid() || !gpu->isTestingOnlyBackendTexture(*outTexture)) {
+ if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
return nullptr;
}
@@ -603,7 +601,7 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture(
kRGBA_8888_SkColorType,
nullptr, nullptr);
if (!surface) {
- gpu->deleteTestingOnlyBackendTexture(outTexture);
+ context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
return nullptr;
}
return surface;
@@ -611,17 +609,15 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture(
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 = gpu->createTestingOnlyBackendTexture(
+ *outTexture = context->getGpu()->createTestingOnlyBackendTexture(
pixels.get(), kWidth, kHeight, kRGBA_8888_GrPixelConfig, true, GrMipMapped::kNo);
- if (!outTexture->isValid() || !gpu->isTestingOnlyBackendTexture(*outTexture)) {
+ if (!outTexture->isValid() || !context->getGpu()->isTestingOnlyBackendTexture(*outTexture)) {
return nullptr;
}
@@ -630,7 +626,7 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
nullptr, nullptr);
if (!surface) {
- gpu->deleteTestingOnlyBackendTexture(outTexture);
+ context->getGpu()->deleteTestingOnlyBackendTexture(outTexture);
return nullptr;
}
return surface;
@@ -678,7 +674,6 @@ static void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> su
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){
@@ -708,7 +703,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceClear_Gpu, reporter, ctxInfo) {
auto surface = surfaceFunc(context, 0, kOrigColor, &backendTex);
test_surface_clear(reporter, surface, grSurfaceGetter, kOrigColor);
surface.reset();
- gpu->deleteTestingOnlyBackendTexture(&backendTex);
+ context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
}
}
}
@@ -756,7 +751,7 @@ static void test_surface_draw_partially(
}
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
- GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
+ GrGpu* gpu = ctxInfo.grContext()->getGpu();
if (!gpu) {
return;
}
@@ -779,7 +774,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacePartialDraw_Gpu, reporter, ctxInfo) {
DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SurfaceAttachStencil_Gpu, reporter, ctxInfo) {
- GrGpu* gpu = ctxInfo.grContext()->contextPriv().getGpu();
+ GrGpu* gpu = ctxInfo.grContext()->getGpu();
if (!gpu) {
return;
}
@@ -880,7 +875,6 @@ DEF_TEST(SurfaceCreationWithColorSpace, reporter) {
#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);
@@ -890,16 +884,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter,
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 = gpu->createTestingOnlyBackendTexture(
+ GrBackendTexture backendTex = context->getGpu()->createTestingOnlyBackendTexture(
nullptr, kSize, kSize, config, true, GrMipMapped::kNo);
if (!backendTex.isValid() ||
- !gpu->isTestingOnlyBackendTexture(backendTex)) {
+ !context->getGpu()->isTestingOnlyBackendTexture(backendTex)) {
return sk_sp<SkSurface>(nullptr);
}
backendTextures.push_back(backendTex);
@@ -915,9 +907,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCreationWithColorSpace_Gpu, reporter,
context->flush();
- GrGpu* gpu = context->contextPriv().getGpu();
for (auto backendTex : backendTextures) {
- gpu->deleteTestingOnlyBackendTexture(&backendTex);
+ context->getGpu()->deleteTestingOnlyBackendTexture(&backendTex);
}
}
#endif