From 67b915de99e6b89d476907930ac8c27afb64d10e Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Mon, 4 Feb 2013 16:13:32 +0000 Subject: Make GPU unit tests use GrContexts of different GL types. Review URL: https://codereview.appspot.com/7281046 git-svn-id: http://skia.googlecode.com/svn/trunk@7540 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/Test.cpp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) (limited to 'tests/Test.cpp') diff --git a/tests/Test.cpp b/tests/Test.cpp index de5e79335f..e0b997a8b7 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp @@ -84,33 +84,20 @@ bool Test::run() { /////////////////////////////////////////////////////////////////////////////// #if SK_SUPPORT_GPU - static SkAutoTUnref gGLContext; - static SkAutoTUnref gGrContext; +#include "GrContextFactory.h" +GrContextFactory gGrContextFactory; #endif -void GpuTest::DestroyContext() { +GrContextFactory* GpuTest::GetGrContextFactory() { #if SK_SUPPORT_GPU - // preserve this order, we want gGrContext destroyed before gGLContext - gGrContext.reset(NULL); - gGLContext.reset(NULL); + return &gGrContextFactory; +#else + return NULL; #endif } - -GrContext* GpuTest::GetContext() { +void GpuTest::DestroyContexts() { #if SK_SUPPORT_GPU - if (NULL == gGrContext.get()) { - gGLContext.reset(new SkNativeGLContext()); - if (gGLContext.get()->init(800, 600)) { - GrBackendContext ctx = reinterpret_cast(gGLContext.get()->gl()); - gGrContext.reset(GrContext::Create(kOpenGL_GrBackend, ctx)); - } - } - if (gGLContext.get()) { - gGLContext.get()->makeCurrent(); - } - return gGrContext.get(); -#else - return NULL; + gGrContextFactory.destroyContexts(); #endif } -- cgit v1.2.3