Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Unified Diff: src/gpu/GrTest.cpp

Issue 23352003: Create new target to hold gpu test code, enable direct testing of GrEffects in GM. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrTest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTest.cpp
diff --git a/src/gpu/GrTest.cpp b/src/gpu/GrTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..934f089f3d6dce70bc850cbe24c56faeaccc1811
--- /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;
+}
« no previous file with comments | « src/gpu/GrTest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698