aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-12-03 12:58:06 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-03 12:58:06 -0800
commit6dea83f244cfdea52901eef6b31cee60b07a8ea0 (patch)
tree2fde780eafe3efe1981fd8ede81d0d2c6ffe5dd3 /dm
parent6f2753deee7b8cd03224e3df91dfea21bbeb9f7f (diff)
Add option to draw wireframe batch bounds
Diffstat (limited to 'dm')
-rw-r--r--dm/DMGpuSupport.h9
-rw-r--r--dm/DMSrcSink.cpp4
2 files changed, 8 insertions, 5 deletions
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index 9f20dd51da..bccf112f72 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -13,6 +13,10 @@
#include "SkSurface.h"
+// This should be safe to include even in no-gpu builds. Include by relative path so it
+// can be found in non-gpu builds.
+#include "../include/gpu/GrContextOptions.h"
+
#if SK_SUPPORT_GPU
// Ganesh is available. Yippee!
@@ -55,11 +59,6 @@ public:
void dumpGpuStats(SkString*) const {}
};
-struct GrContextOptions {
- bool fImmediateMode;
- bool fClipBatchToBounds;
-};
-
class GrContextFactory {
public:
GrContextFactory() {};
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 2861ae8ea2..26ba13b547 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -807,6 +807,7 @@ void PreAbandonGpuContextErrorHandler(SkError, void*) {}
DEFINE_bool(imm, false, "Run gpu configs in immediate mode.");
DEFINE_bool(batchClip, false, "Clip each GrBatch to its device bounds for testing.");
+DEFINE_bool(batchBounds, false, "Draw a wireframe bounds of each GrBatch.");
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) const {
GrContextOptions options;
@@ -816,6 +817,9 @@ Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString* log) co
if (FLAGS_batchClip) {
options.fClipBatchToBounds = true;
}
+ if (FLAGS_batchBounds) {
+ options.fDrawBatchBounds = true;
+ }
src.modifyGrContextOptions(&options);
GrContextFactory factory(options);