aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTest.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-21 19:27:48 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-08-21 19:27:48 +0000
commit78a1078f17f4f0ae63415298517262a64f706af6 (patch)
tree6f622a5a976570c22f9806b63f52cccbeacad5a8 /src/gpu/GrTest.cpp
parent05f85ade7895606badc57e4137c48ee5c8eefab5 (diff)
Create new target to hold gpu test code, enable direct testing of GrEffects in GM.
R=robertphillips@google.com, jvanverth@google.com, egdaniel@google.com Author: bsalomon@google.com Review URL: https://chromiumcodereview.appspot.com/23352003 git-svn-id: http://skia.googlecode.com/svn/trunk@10866 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrTest.cpp')
-rw-r--r--src/gpu/GrTest.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
new file mode 100644
index 0000000000..934f089f3d
--- /dev/null
+++ b/src/gpu/GrTest.cpp
@@ -0,0 +1,37 @@
+
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrTest.h"
+
+#include "GrGpu.h"
+
+void GrTestTarget::init(GrContext* ctx, GrDrawTarget* target) {
+ SkASSERT(!fContext);
+
+ fContext.reset(SkRef(ctx));
+ fDrawTarget.reset(SkRef(target));
+
+ SkNEW_IN_TLAZY(&fASR, GrDrawTarget::AutoStateRestore, (target, GrDrawTarget::kReset_ASRInit));
+ SkNEW_IN_TLAZY(&fACR, GrDrawTarget::AutoClipRestore, (target));
+ SkNEW_IN_TLAZY(&fAGP, GrDrawTarget::AutoGeometryPush, (target));
+}
+
+void GrContext::getTestTarget(GrTestTarget* tar) {
+ this->flush();
+ // We could create a proxy GrDrawTarget that passes through to fGpu until ~GrTextTarget() and
+ // then disconnects. This would help prevent test writers from mixing using the returned
+ // GrDrawTarget and regular drawing. We could also assert or fail in GrContext drawing methods
+ // until ~GrTestTarget().
+ tar->init(this, fGpu);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+void GrContext::setMaxTextureSizeOverride(int maxTextureSizeOverride) {
+ fMaxTextureSizeOverride = maxTextureSizeOverride;
+}