diff options
Diffstat (limited to 'tests/Test.cpp')
-rw-r--r-- | tests/Test.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/Test.cpp b/tests/Test.cpp index 07107bc934..bebb351253 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp @@ -83,15 +83,24 @@ bool Test::run() { /////////////////////////////////////////////////////////////////////////////// +#if SK_SUPPORT_GPU + static SkAutoTUnref<SkNativeGLContext> gGLContext; + static SkAutoTUnref<GrContext> gGrContext; +#endif -GrContext* GpuTest::GetContext() { +void GpuTest::DestroyContext() { #if SK_SUPPORT_GPU // preserve this order, we want gGrContext destroyed after gEGLContext - static SkTLazy<SkNativeGLContext> gGLContext; - static SkAutoTUnref<GrContext> gGrContext; + gGLContext.reset(NULL); + gGrContext.reset(NULL); +#endif +} + +GrContext* GpuTest::GetContext() { +#if SK_SUPPORT_GPU if (NULL == gGrContext.get()) { - gGLContext.init(); + gGLContext.reset(new SkNativeGLContext()); if (gGLContext.get()->init(800, 600)) { GrBackendContext ctx = reinterpret_cast<GrBackendContext>(gGLContext.get()->gl()); gGrContext.reset(GrContext::Create(kOpenGL_GrBackend, ctx)); |