aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Test.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-04 16:13:32 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-04 16:13:32 +0000
commit67b915de99e6b89d476907930ac8c27afb64d10e (patch)
tree75e0c17ae09477f51ebd8561af40b5c0931433ad /tests/Test.cpp
parent7de18e5c7b4e4a8ad8910b1016688ded902f185b (diff)
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
Diffstat (limited to 'tests/Test.cpp')
-rw-r--r--tests/Test.cpp29
1 files changed, 8 insertions, 21 deletions
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<SkNativeGLContext> gGLContext;
- static SkAutoTUnref<GrContext> 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<GrBackendContext>(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
}