aboutsummaryrefslogtreecommitdiff
path: root/tools/skqp
diff options
context:
space:
mode:
authorHal Canary <halcanary@google.com>2019-02-08 13:43:26 -0500
committerHal Canary <halcanary@google.com>2019-02-15 21:10:41 +0000
commitcf6780d9110c3f27a338f2f6e63ab19e40e95e33 (patch)
tree0f9a68aeafedf3383aa063f5c5b688976bd4ae72 /tools/skqp
parent407e7f28d30a2684d60841ec627bb49b574b1d14 (diff)
downloadskqp-cf6780d9110c3f27a338f2f6e63ab19e40e95e33.tar.gz
SkQP: make test context outlast gm
Change-Id: Ia8e3b42d1b88d111a3885a7b2ae90c29985a8c10 Reviewed-on: https://skia-review.googlesource.com/c/190672 Reviewed-by: Greg Daniel <egdaniel@google.com> Cherry-Pick: 70441faaef1d845114f496887177b0f54da8d4ca Reviewed-on: https://skia-review.googlesource.com/c/190674 Cherry-Pick: 14848961000e7d91e810871cf00fcf3d4920be4b
Diffstat (limited to 'tools/skqp')
-rw-r--r--tools/skqp/src/skqp.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/skqp/src/skqp.cpp b/tools/skqp/src/skqp.cpp
index 7c41a99bee..b259a54d78 100644
--- a/tools/skqp/src/skqp.cpp
+++ b/tools/skqp/src/skqp.cpp
@@ -264,6 +264,12 @@ std::tuple<SkQP::RenderOutcome, std::string> SkQP::evaluateGM(SkQP::SkiaBackend
static constexpr SkQP::RenderOutcome kError = {INT_MAX, INT_MAX, INT64_MAX};
static constexpr SkQP::RenderOutcome kPass = {0, 0, 0};
+ std::unique_ptr<sk_gpu_test::TestContext> testCtx = make_test_context(backend);
+ if (!testCtx) {
+ return std::make_tuple(kError, "Skia Failure: test context");
+ }
+ testCtx->makeCurrent();
+
SkASSERT(gmFact);
std::unique_ptr<skiagm::GM> gm(gmFact(nullptr));
SkASSERT(gm);
@@ -275,11 +281,6 @@ std::tuple<SkQP::RenderOutcome, std::string> SkQP::evaluateGM(SkQP::SkiaBackend
SkImageInfo::Make(w, h, skqp::kColorType, kPremul_SkAlphaType, nullptr);
const SkSurfaceProps props(0, SkSurfaceProps::kLegacyFontHost_InitType);
- std::unique_ptr<sk_gpu_test::TestContext> testCtx = make_test_context(backend);
- if (!testCtx) {
- return std::make_tuple(kError, "Skia Failure: test context");
- }
- testCtx->makeCurrent();
sk_sp<SkSurface> surf = SkSurface::MakeRenderTarget(
testCtx->makeGrContext(context_options(gm.get())).get(),
SkBudgeted::kNo, info, 0, &props);