diff options
author | Derek Sollenberger <djsollen@google.com> | 2012-01-18 08:56:56 -0500 |
---|---|---|
committer | Derek Sollenberger <derek@android.com> | 2012-02-06 14:14:40 -0500 |
commit | 1cab2921ab279367f8206cdadc9259d12e603548 (patch) | |
tree | 2852f9dc2481f639122e18fc7831ae6ca43d6d5a /tests/Test.cpp | |
parent | d7176fd5571bc9878d3cdac8696eaa35ec170d9d (diff) | |
download | external_skia-1cab2921ab279367f8206cdadc9259d12e603548.zip external_skia-1cab2921ab279367f8206cdadc9259d12e603548.tar.gz external_skia-1cab2921ab279367f8206cdadc9259d12e603548.tar.bz2 |
Skia merge (revision 3022)
This CL has companion changes to account for API updates in...
(1) frameworks/base
(2) external/webkit
Change-Id: Ibb989e76e8bd24313849f9631dbef42cdef9eb7d
Diffstat (limited to 'tests/Test.cpp')
-rw-r--r-- | tests/Test.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/Test.cpp b/tests/Test.cpp index 2bcd3e0..1c3b691 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp @@ -1,5 +1,16 @@ + +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ #include "Test.h" +#include "GrContext.h" +#include "SkNativeGLContext.h" +#include "SkTLazy.h" + using namespace skiatest; Reporter::Reporter() { @@ -63,3 +74,24 @@ bool Test::run() { return fReporter->getCurrSuccess(); } +/////////////////////////////////////////////////////////////////////////////// + + +GrContext* GpuTest::GetContext() { + // preserve this order, we want gGrContext destroyed after gEGLContext + static SkTLazy<SkNativeGLContext> gGLContext; + static SkAutoTUnref<GrContext> gGrContext; + + if (NULL == gGrContext.get()) { + gGLContext.init(); + if (gGLContext.get()->init(800, 600)) { + GrPlatform3DContext ctx = reinterpret_cast<GrPlatform3DContext>(gGLContext.get()->gl()); + gGrContext.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, ctx)); + } + } + if (gGLContext.get()) { + gGLContext.get()->makeCurrent(); + } + return gGrContext.get(); +} + |